From: Dmitry Lomov Date: Thu, 12 Feb 2015 20:06:52 +0000 (+0100) Subject: Remove --experimental-classes flag and related dead code. X-Git-Tag: upstream/4.7.83~4409 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7866f00508a2a3b0f18442787eee67ee4a094d72;p=platform%2Fupstream%2Fv8.git Remove --experimental-classes flag and related dead code. R=arv@chromium.org BUG=v8:3834 LOG=N Review URL: https://codereview.chromium.org/919643008 Cr-Commit-Position: refs/heads/master@{#26631} --- diff --git a/BUILD.gn b/BUILD.gn index 1824601..8faaef7 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -461,8 +461,6 @@ source_set("v8_base") { "src/assert-scope.cc", "src/ast-numbering.cc", "src/ast-numbering.h", - "src/ast-this-access-visitor.cc", - "src/ast-this-access-visitor.h", "src/ast-value-factory.cc", "src/ast-value-factory.h", "src/ast.cc", diff --git a/src/arm/full-codegen-arm.cc b/src/arm/full-codegen-arm.cc index 4146251..8a8fe37 100644 --- a/src/arm/full-codegen-arm.cc +++ b/src/arm/full-codegen-arm.cc @@ -455,8 +455,7 @@ void FullCodeGenerator::EmitReturnSequence() { // sequence. { Assembler::BlockConstPoolScope block_const_pool(masm_); int32_t arg_count = info_->scope()->num_parameters() + 1; - if (FLAG_experimental_classes && - IsSubclassConstructor(info_->function()->kind())) { + if (IsSubclassConstructor(info_->function()->kind())) { arg_count++; } int32_t sp_delta = arg_count * kPointerSize; @@ -3189,15 +3188,7 @@ void FullCodeGenerator::VisitCall(Call* expr) { } } } else if (call_type == Call::SUPER_CALL) { - if (FLAG_experimental_classes) { - EmitSuperConstructorCall(expr); - } else { - EmitLoadSuperConstructor(); - __ Push(result_register()); - SuperReference* super_ref = callee->AsSuperReference(); - VisitForStackValue(super_ref->this_var()); - EmitCall(expr, CallICState::METHOD); - } + EmitSuperConstructorCall(expr); } else { DCHECK(call_type == Call::OTHER_CALL); // Call to an arbitrary expression not handled specially above. diff --git a/src/arm64/full-codegen-arm64.cc b/src/arm64/full-codegen-arm64.cc index ba9eb27..dd47e0f 100644 --- a/src/arm64/full-codegen-arm64.cc +++ b/src/arm64/full-codegen-arm64.cc @@ -460,8 +460,7 @@ void FullCodeGenerator::EmitReturnSequence() { __ add(current_sp, current_sp, ip0); __ ret(); int32_t arg_count = info_->scope()->num_parameters() + 1; - if (FLAG_experimental_classes && - IsSubclassConstructor(info_->function()->kind())) { + if (IsSubclassConstructor(info_->function()->kind())) { arg_count++; } __ dc64(kXRegSize * arg_count); @@ -2878,15 +2877,7 @@ void FullCodeGenerator::VisitCall(Call* expr) { } } } else if (call_type == Call::SUPER_CALL) { - if (FLAG_experimental_classes) { - EmitSuperConstructorCall(expr); - } else { - SuperReference* super_ref = callee->AsSuperReference(); - EmitLoadSuperConstructor(); - __ Push(result_register()); - VisitForStackValue(super_ref->this_var()); - EmitCall(expr, CallICState::METHOD); - } + EmitSuperConstructorCall(expr); } else { DCHECK(call_type == Call::OTHER_CALL); // Call to an arbitrary expression not handled specially above. diff --git a/src/ast-this-access-visitor.cc b/src/ast-this-access-visitor.cc deleted file mode 100644 index d3af53d..0000000 --- a/src/ast-this-access-visitor.cc +++ /dev/null @@ -1,239 +0,0 @@ -// Copyright 2014 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "src/ast-this-access-visitor.h" -#include "src/parser.h" - -namespace v8 { -namespace internal { - -typedef class AstThisAccessVisitor ATAV; // for code shortitude. - -ATAV::AstThisAccessVisitor(Isolate* isolate, Zone* zone) : uses_this_(false) { - InitializeAstVisitor(isolate, zone); -} - - -void ATAV::VisitVariableProxy(VariableProxy* proxy) { - if (proxy->is_this()) { - uses_this_ = true; - } -} - - -void ATAV::VisitSuperReference(SuperReference* leaf) { - // disallow super.method() and super(...). - uses_this_ = true; -} - - -void ATAV::VisitCallNew(CallNew* e) { - // new super(..) does not use 'this'. - if (!e->expression()->IsSuperReference()) { - Visit(e->expression()); - } - VisitExpressions(e->arguments()); -} - - -// --------------------------------------------------------------------------- -// -- Leaf nodes ------------------------------------------------------------- -// --------------------------------------------------------------------------- - -void ATAV::VisitVariableDeclaration(VariableDeclaration* leaf) {} -void ATAV::VisitFunctionDeclaration(FunctionDeclaration* leaf) {} -void ATAV::VisitModuleDeclaration(ModuleDeclaration* leaf) {} -void ATAV::VisitImportDeclaration(ImportDeclaration* leaf) {} -void ATAV::VisitExportDeclaration(ExportDeclaration* leaf) {} -void ATAV::VisitModuleVariable(ModuleVariable* leaf) {} -void ATAV::VisitModulePath(ModulePath* leaf) {} -void ATAV::VisitModuleUrl(ModuleUrl* leaf) {} -void ATAV::VisitEmptyStatement(EmptyStatement* leaf) {} -void ATAV::VisitContinueStatement(ContinueStatement* leaf) {} -void ATAV::VisitBreakStatement(BreakStatement* leaf) {} -void ATAV::VisitDebuggerStatement(DebuggerStatement* leaf) {} -void ATAV::VisitFunctionLiteral(FunctionLiteral* leaf) {} -void ATAV::VisitNativeFunctionLiteral(NativeFunctionLiteral* leaf) {} -void ATAV::VisitLiteral(Literal* leaf) {} -void ATAV::VisitRegExpLiteral(RegExpLiteral* leaf) {} -void ATAV::VisitThisFunction(ThisFunction* leaf) {} - -// --------------------------------------------------------------------------- -// -- Pass-through nodes------------------------------------------------------ -// --------------------------------------------------------------------------- -void ATAV::VisitModuleLiteral(ModuleLiteral* e) { Visit(e->body()); } - - -void ATAV::VisitBlock(Block* stmt) { VisitStatements(stmt->statements()); } - - -void ATAV::VisitExpressionStatement(ExpressionStatement* stmt) { - Visit(stmt->expression()); -} - - -void ATAV::VisitIfStatement(IfStatement* stmt) { - Visit(stmt->condition()); - Visit(stmt->then_statement()); - Visit(stmt->else_statement()); -} - - -void ATAV::VisitReturnStatement(ReturnStatement* stmt) { - Visit(stmt->expression()); -} - - -void ATAV::VisitWithStatement(WithStatement* stmt) { - Visit(stmt->expression()); - Visit(stmt->statement()); -} - - -void ATAV::VisitSwitchStatement(SwitchStatement* stmt) { - Visit(stmt->tag()); - ZoneList* clauses = stmt->cases(); - for (int i = 0; i < clauses->length(); i++) { - Visit(clauses->at(i)); - } -} - - -void ATAV::VisitTryFinallyStatement(TryFinallyStatement* stmt) { - Visit(stmt->try_block()); - Visit(stmt->finally_block()); -} - - -void ATAV::VisitClassLiteral(ClassLiteral* e) { - VisitIfNotNull(e->extends()); - Visit(e->constructor()); - ZoneList* properties = e->properties(); - for (int i = 0; i < properties->length(); i++) { - Visit(properties->at(i)->value()); - } -} - - -void ATAV::VisitConditional(Conditional* e) { - Visit(e->condition()); - Visit(e->then_expression()); - Visit(e->else_expression()); -} - - -void ATAV::VisitObjectLiteral(ObjectLiteral* e) { - ZoneList* properties = e->properties(); - for (int i = 0; i < properties->length(); i++) { - Visit(properties->at(i)->value()); - } -} - - -void ATAV::VisitArrayLiteral(ArrayLiteral* e) { VisitExpressions(e->values()); } - - -void ATAV::VisitYield(Yield* stmt) { - Visit(stmt->generator_object()); - Visit(stmt->expression()); -} - - -void ATAV::VisitThrow(Throw* stmt) { Visit(stmt->exception()); } - - -void ATAV::VisitProperty(Property* e) { - Visit(e->obj()); - Visit(e->key()); -} - - -void ATAV::VisitCall(Call* e) { - Visit(e->expression()); - VisitExpressions(e->arguments()); -} - - -void ATAV::VisitCallRuntime(CallRuntime* e) { - VisitExpressions(e->arguments()); -} - - -void ATAV::VisitUnaryOperation(UnaryOperation* e) { Visit(e->expression()); } - - -void ATAV::VisitBinaryOperation(BinaryOperation* e) { - Visit(e->left()); - Visit(e->right()); -} - - -void ATAV::VisitCompareOperation(CompareOperation* e) { - Visit(e->left()); - Visit(e->right()); -} - - -void ATAV::VisitCaseClause(CaseClause* cc) { - if (!cc->is_default()) Visit(cc->label()); - VisitStatements(cc->statements()); -} - - -void ATAV::VisitModuleStatement(ModuleStatement* stmt) { Visit(stmt->body()); } - - -void ATAV::VisitTryCatchStatement(TryCatchStatement* stmt) { - Visit(stmt->try_block()); - Visit(stmt->catch_block()); -} - - -void ATAV::VisitDoWhileStatement(DoWhileStatement* loop) { - Visit(loop->body()); - Visit(loop->cond()); -} - - -void ATAV::VisitWhileStatement(WhileStatement* loop) { - Visit(loop->cond()); - Visit(loop->body()); -} - - -void ATAV::VisitForStatement(ForStatement* loop) { - VisitIfNotNull(loop->init()); - VisitIfNotNull(loop->cond()); - Visit(loop->body()); - VisitIfNotNull(loop->next()); -} - - -void ATAV::VisitForInStatement(ForInStatement* loop) { - Visit(loop->each()); - Visit(loop->subject()); - Visit(loop->body()); -} - - -void ATAV::VisitForOfStatement(ForOfStatement* loop) { - Visit(loop->each()); - Visit(loop->subject()); - Visit(loop->body()); -} - - -void ATAV::VisitAssignment(Assignment* stmt) { - Expression* l = stmt->target(); - Visit(l); - Visit(stmt->value()); -} - - -void ATAV::VisitCountOperation(CountOperation* e) { - Expression* l = e->expression(); - Visit(l); -} -} -} // namespace v8::internal diff --git a/src/ast-this-access-visitor.h b/src/ast-this-access-visitor.h deleted file mode 100644 index 08dddee..0000000 --- a/src/ast-this-access-visitor.h +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2014 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef V8_AST_THIS_ACCESS_VISITOR_H_ -#define V8_AST_THIS_ACCESS_VISITOR_H_ -#include "src/ast.h" - -namespace v8 { -namespace internal { - -class AstThisAccessVisitor : public AstVisitor { - public: - AstThisAccessVisitor(Isolate* isolate, Zone* zone); - - bool UsesThis() { return uses_this_; } - -#define DECLARE_VISIT(type) void Visit##type(type* node) OVERRIDE; - AST_NODE_LIST(DECLARE_VISIT) -#undef DECLARE_VISIT - - private: - bool uses_this_; - - void VisitIfNotNull(AstNode* node) { - if (node != NULL) Visit(node); - } - - DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); - DISALLOW_COPY_AND_ASSIGN(AstThisAccessVisitor); -}; -} -} // namespace v8::internal -#endif // V8_AST_THIS_ACCESS_VISITOR_H_ diff --git a/src/ast.cc b/src/ast.cc index 9ef8af4..2d4d3d5 100644 --- a/src/ast.cc +++ b/src/ast.cc @@ -567,7 +567,7 @@ bool Call::IsUsingCallFeedbackICSlot(Isolate* isolate) const { bool Call::IsUsingCallFeedbackSlot(Isolate* isolate) const { // SuperConstructorCall uses a CallConstructStub, which wants // a Slot, not an IC slot. - return FLAG_experimental_classes && GetCallType(isolate) == SUPER_CALL; + return GetCallType(isolate) == SUPER_CALL; } diff --git a/src/compiler.cc b/src/compiler.cc index 6706a5f..92f8646 100644 --- a/src/compiler.cc +++ b/src/compiler.cc @@ -7,7 +7,6 @@ #include "src/compiler.h" #include "src/ast-numbering.h" -#include "src/ast-this-access-visitor.h" #include "src/bootstrapper.h" #include "src/codegen.h" #include "src/compilation-cache.h" @@ -749,82 +748,12 @@ static bool Renumber(CompilationInfo* info) { } -static void ThrowSuperConstructorCheckError(CompilationInfo* info, - Statement* stmt) { - MaybeHandle obj = info->isolate()->factory()->NewTypeError( - "super_constructor_call", HandleVector(nullptr, 0)); - Handle exception; - if (!obj.ToHandle(&exception)) return; - - MessageLocation location(info->script(), stmt->position(), stmt->position()); - USE(info->isolate()->Throw(*exception, &location)); -} - - -static bool CheckSuperConstructorCall(CompilationInfo* info) { - FunctionLiteral* function = info->function(); - if (FLAG_experimental_classes) return true; - if (!function->uses_super_constructor_call()) return true; - if (IsDefaultConstructor(function->kind())) return true; - - ZoneList* body = function->body(); - CHECK(body->length() > 0); - - int super_call_index = 0; - // Allow 'use strict' and similiar and empty statements. - while (true) { - CHECK(super_call_index < body->length()); // We know there is a super call. - Statement* stmt = body->at(super_call_index); - if (stmt->IsExpressionStatement() && - stmt->AsExpressionStatement()->expression()->IsLiteral()) { - super_call_index++; - continue; - } - if (stmt->IsEmptyStatement()) { - super_call_index++; - continue; - } - break; - } - - Statement* stmt = body->at(super_call_index); - ExpressionStatement* exprStm = stmt->AsExpressionStatement(); - if (exprStm == nullptr) { - ThrowSuperConstructorCheckError(info, stmt); - return false; - } - Call* callExpr = exprStm->expression()->AsCall(); - if (callExpr == nullptr) { - ThrowSuperConstructorCheckError(info, stmt); - return false; - } - - if (!callExpr->expression()->IsSuperReference()) { - ThrowSuperConstructorCheckError(info, stmt); - return false; - } - - ZoneList* arguments = callExpr->arguments(); - - AstThisAccessVisitor this_access_visitor(info->isolate(), info->zone()); - this_access_visitor.VisitExpressions(arguments); - - if (this_access_visitor.HasStackOverflow()) return false; - if (this_access_visitor.UsesThis()) { - ThrowSuperConstructorCheckError(info, stmt); - return false; - } - return true; -} - - bool Compiler::Analyze(CompilationInfo* info) { DCHECK(info->function() != NULL); if (!Rewriter::Rewrite(info)) return false; if (!Scope::Analyze(info)) return false; if (!Renumber(info)) return false; DCHECK(info->scope() != NULL); - if (!CheckSuperConstructorCall(info)) return false; return true; } diff --git a/src/flag-definitions.h b/src/flag-definitions.h index c19b653..e43f565 100644 --- a/src/flag-definitions.h +++ b/src/flag-definitions.h @@ -264,11 +264,6 @@ DEFINE_IMPLICATION(track_field_types, track_fields) DEFINE_IMPLICATION(track_field_types, track_heap_object_fields) DEFINE_BOOL(smi_binop, true, "support smi representation in binary operations") DEFINE_BOOL(vector_ics, false, "support vector-based ics") -DEFINE_BOOL(experimental_classes, false, - "experimental new semantics for super() calls") -DEFINE_IMPLICATION(harmony_classes, experimental_classes) -DEFINE_IMPLICATION(experimental_classes, harmony_classes) -DEFINE_IMPLICATION(experimental_classes, harmony_object_literals) // Flags for optimization types. DEFINE_BOOL(optimize_for_size, false, diff --git a/src/ia32/full-codegen-ia32.cc b/src/ia32/full-codegen-ia32.cc index 33422e4..17bdcf5 100644 --- a/src/ia32/full-codegen-ia32.cc +++ b/src/ia32/full-codegen-ia32.cc @@ -418,8 +418,7 @@ void FullCodeGenerator::EmitReturnSequence() { __ pop(ebp); int arg_count = info_->scope()->num_parameters() + 1; - if (FLAG_experimental_classes && - IsSubclassConstructor(info_->function()->kind())) { + if (IsSubclassConstructor(info_->function()->kind())) { arg_count++; } int arguments_bytes = arg_count * kPointerSize; @@ -3070,15 +3069,7 @@ void FullCodeGenerator::VisitCall(Call* expr) { } } } else if (call_type == Call::SUPER_CALL) { - if (FLAG_experimental_classes) { - EmitSuperConstructorCall(expr); - } else { - SuperReference* super_ref = callee->AsSuperReference(); - EmitLoadSuperConstructor(); - __ push(result_register()); - VisitForStackValue(super_ref->this_var()); - EmitCall(expr, CallICState::METHOD); - } + EmitSuperConstructorCall(expr); } else { DCHECK(call_type == Call::OTHER_CALL); // Call to an arbitrary expression not handled specially above. diff --git a/src/mips/full-codegen-mips.cc b/src/mips/full-codegen-mips.cc index 7b49328..36681fd 100644 --- a/src/mips/full-codegen-mips.cc +++ b/src/mips/full-codegen-mips.cc @@ -444,8 +444,7 @@ void FullCodeGenerator::EmitReturnSequence() { // Here we use masm_-> instead of the __ macro to avoid the code coverage // tool from instrumenting as we rely on the code size here. int32_t arg_count = info_->scope()->num_parameters() + 1; - if (FLAG_experimental_classes && - IsSubclassConstructor(info_->function()->kind())) { + if (IsSubclassConstructor(info_->function()->kind())) { arg_count++; } int32_t sp_delta = arg_count * kPointerSize; @@ -3162,15 +3161,7 @@ void FullCodeGenerator::VisitCall(Call* expr) { } } } else if (call_type == Call::SUPER_CALL) { - if (FLAG_experimental_classes) { - EmitSuperConstructorCall(expr); - } else { - EmitLoadSuperConstructor(); - __ Push(result_register()); - SuperReference* super_ref = callee->AsSuperReference(); - VisitForStackValue(super_ref->this_var()); - EmitCall(expr, CallICState::METHOD); - } + EmitSuperConstructorCall(expr); } else { DCHECK(call_type == Call::OTHER_CALL); // Call to an arbitrary expression not handled specially above. diff --git a/src/mips64/full-codegen-mips64.cc b/src/mips64/full-codegen-mips64.cc index 18c1027..4fc1908 100644 --- a/src/mips64/full-codegen-mips64.cc +++ b/src/mips64/full-codegen-mips64.cc @@ -440,8 +440,7 @@ void FullCodeGenerator::EmitReturnSequence() { // Here we use masm_-> instead of the __ macro to avoid the code coverage // tool from instrumenting as we rely on the code size here. int32_t arg_count = info_->scope()->num_parameters() + 1; - if (FLAG_experimental_classes && - IsSubclassConstructor(info_->function()->kind())) { + if (IsSubclassConstructor(info_->function()->kind())) { arg_count++; } int32_t sp_delta = arg_count * kPointerSize; @@ -3161,15 +3160,7 @@ void FullCodeGenerator::VisitCall(Call* expr) { } } } else if (call_type == Call::SUPER_CALL) { - if (FLAG_experimental_classes) { - EmitSuperConstructorCall(expr); - } else { - EmitLoadSuperConstructor(); - __ Push(result_register()); - SuperReference* super_ref = callee->AsSuperReference(); - VisitForStackValue(super_ref->this_var()); - EmitCall(expr, CallICState::METHOD); - } + EmitSuperConstructorCall(expr); } else { DCHECK(call_type == Call::OTHER_CALL); // Call to an arbitrary expression not handled specially above. diff --git a/src/objects.cc b/src/objects.cc index 646080d..c92b5f1 100644 --- a/src/objects.cc +++ b/src/objects.cc @@ -10388,7 +10388,7 @@ void SharedFunctionInfo::DisableOptimization(BailoutReason reason) { void SharedFunctionInfo::InitFromFunctionLiteral( Handle shared_info, FunctionLiteral* lit) { shared_info->set_length(lit->parameter_count()); - if (FLAG_experimental_classes && IsSubclassConstructor(lit->kind())) { + if (IsSubclassConstructor(lit->kind())) { shared_info->set_internal_formal_parameter_count(lit->parameter_count() + 1); } else { diff --git a/src/parser.cc b/src/parser.cc index 6db2b0d..47ef343 100644 --- a/src/parser.cc +++ b/src/parser.cc @@ -272,9 +272,8 @@ FunctionLiteral* Parser::DefaultConstructor(bool call_super, Scope* scope, const AstRawString* name = ast_value_factory()->empty_string(); - FunctionKind kind = call_super && !FLAG_experimental_classes - ? FunctionKind::kDefaultBaseConstructor - : FunctionKind::kDefaultSubclassConstructor; + FunctionKind kind = call_super ? FunctionKind::kDefaultSubclassConstructor + : FunctionKind::kDefaultBaseConstructor; Scope* function_scope = NewScope(scope, FUNCTION_SCOPE, kind); function_scope->SetLanguageMode( static_cast(scope->language_mode() | STRICT_BIT)); @@ -293,19 +292,11 @@ FunctionLiteral* Parser::DefaultConstructor(bool call_super, Scope* scope, if (call_super) { ZoneList* args = new (zone()) ZoneList(0, zone()); - if (FLAG_experimental_classes) { - CallRuntime* call = factory()->NewCallRuntime( - ast_value_factory()->empty_string(), - Runtime::FunctionForId(Runtime::kInlineDefaultConstructorCallSuper), - args, pos); - body->Add(factory()->NewReturnStatement(call, pos), zone()); - } else { - CallRuntime* call = factory()->NewCallRuntime( - ast_value_factory()->empty_string(), - Runtime::FunctionForId(Runtime::kDefaultConstructorSuperCall), args, - pos); - body->Add(factory()->NewExpressionStatement(call, pos), zone()); - } + CallRuntime* call = factory()->NewCallRuntime( + ast_value_factory()->empty_string(), + Runtime::FunctionForId(Runtime::kInlineDefaultConstructorCallSuper), + args, pos); + body->Add(factory()->NewReturnStatement(call, pos), zone()); function_scope->RecordSuperConstructorCallUsage(); } @@ -2635,8 +2626,7 @@ Statement* Parser::ParseReturnStatement(bool* ok) { tok == Token::SEMICOLON || tok == Token::RBRACE || tok == Token::EOS) { - if (FLAG_experimental_classes && - IsSubclassConstructor(function_state_->kind())) { + if (IsSubclassConstructor(function_state_->kind())) { return_value = ThisExpression(scope_, factory(), loc.beg_pos); } else { return_value = GetLiteralUndefined(position()); @@ -3922,8 +3912,6 @@ void Parser::SkipLazyFunctionBody(const AstRawString* function_name, void Parser::AddAssertIsConstruct(ZoneList* body, int pos) { - if (!FLAG_experimental_classes) return; - ZoneList* arguments = new (zone()) ZoneList(0, zone()); CallRuntime* construct_check = factory()->NewCallRuntime( @@ -4000,7 +3988,7 @@ ZoneList* Parser::ParseEagerFunctionBody( yield, RelocInfo::kNoPosition), zone()); } - if (FLAG_experimental_classes && IsSubclassConstructor(kind)) { + if (IsSubclassConstructor(kind)) { body->Add( factory()->NewReturnStatement( this->ThisExpression(scope_, factory(), RelocInfo::kNoPosition), diff --git a/src/ppc/full-codegen-ppc.cc b/src/ppc/full-codegen-ppc.cc index 39f0ed9..69bcc05 100644 --- a/src/ppc/full-codegen-ppc.cc +++ b/src/ppc/full-codegen-ppc.cc @@ -3169,15 +3169,7 @@ void FullCodeGenerator::VisitCall(Call* expr) { } } } else if (call_type == Call::SUPER_CALL) { - if (FLAG_experimental_classes) { - EmitSuperConstructorCall(expr); - } else { - SuperReference* super_ref = callee->AsSuperReference(); - EmitLoadSuperConstructor(super_ref); - __ Push(result_register()); - VisitForStackValue(super_ref->this_var()); - EmitCall(expr, CallICState::METHOD); - } + EmitSuperConstructorCall(expr); } else { DCHECK(call_type == Call::OTHER_CALL); // Call to an arbitrary expression not handled specially above. diff --git a/src/preparser.h b/src/preparser.h index 75b7382..a60b218 100644 --- a/src/preparser.h +++ b/src/preparser.h @@ -319,8 +319,7 @@ class ParserBase : public Traits { kind == kNormalFunction); Scope* result = new (zone()) Scope(zone(), parent, scope_type, ast_value_factory()); - bool uninitialized_this = - FLAG_experimental_classes && IsSubclassConstructor(kind); + bool uninitialized_this = IsSubclassConstructor(kind); result->Initialize(uninitialized_this); return result; } diff --git a/src/runtime/runtime-classes.cc b/src/runtime/runtime-classes.cc index df428f4..266f4d9 100644 --- a/src/runtime/runtime-classes.cc +++ b/src/runtime/runtime-classes.cc @@ -116,11 +116,9 @@ RUNTIME_FUNCTION(Runtime_DefineClass) { : isolate->factory()->empty_string(); constructor->shared()->set_name(*name_string); - if (FLAG_experimental_classes) { - if (!super_class->IsTheHole()) { - Handle stub(isolate->builtins()->JSConstructStubForDerived()); - constructor->shared()->set_construct_stub(*stub); - } + if (!super_class->IsTheHole()) { + Handle stub(isolate->builtins()->JSConstructStubForDerived()); + constructor->shared()->set_construct_stub(*stub); } JSFunction::SetPrototype(constructor, prototype); @@ -431,54 +429,5 @@ RUNTIME_FUNCTION(RuntimeReference_DefaultConstructorCallSuper) { UNREACHABLE(); return nullptr; } - - -// TODO(dslomov): deprecated, will remove when experimenal classes is default. -RUNTIME_FUNCTION(Runtime_DefaultConstructorSuperCall) { - CHECK(!FLAG_experimental_classes); - HandleScope scope(isolate); - DCHECK(args.length() == 0); - - // Compute the frame holding the arguments. - JavaScriptFrameIterator it(isolate); - it.AdvanceToArgumentsFrame(); - JavaScriptFrame* frame = it.frame(); - - Handle function(frame->function(), isolate); - Handle receiver(frame->receiver(), isolate); - - Handle proto_function; - ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, proto_function, - Runtime::GetPrototype(isolate, function)); - - // Get the actual number of provided arguments. - const int argc = frame->ComputeParametersCount(); - - // Loose upper bound to allow fuzzing. We'll most likely run out of - // stack space before hitting this limit. - static int kMaxArgc = 1000000; - RUNTIME_ASSERT(argc >= 0 && argc <= kMaxArgc); - - // If there are too many arguments, allocate argv via malloc. - const int argv_small_size = 10; - Handle argv_small_buffer[argv_small_size]; - SmartArrayPointer > argv_large_buffer; - Handle* argv = argv_small_buffer; - if (argc > argv_small_size) { - argv = new Handle[argc]; - if (argv == NULL) return isolate->StackOverflow(); - argv_large_buffer = SmartArrayPointer >(argv); - } - - for (int i = 0; i < argc; ++i) { - argv[i] = handle(frame->GetParameter(i), isolate); - } - - Handle result; - ASSIGN_RETURN_FAILURE_ON_EXCEPTION( - isolate, result, - Execution::Call(isolate, proto_function, receiver, argc, argv, false)); - return *result; -} } } // namespace v8::internal diff --git a/src/runtime/runtime.h b/src/runtime/runtime.h index a68a568..b337b32 100644 --- a/src/runtime/runtime.h +++ b/src/runtime/runtime.h @@ -187,7 +187,6 @@ namespace internal { /* Classes support */ \ F(ToMethod, 2, 1) \ F(HomeObjectSymbol, 0, 1) \ - F(DefaultConstructorSuperCall, 0, 1) \ F(DefineClass, 6, 1) \ F(DefineClassMethod, 3, 1) \ F(ClassGetSourceCode, 1, 1) \ diff --git a/src/scopes.cc b/src/scopes.cc index d7362c0..6392586 100644 --- a/src/scopes.cc +++ b/src/scopes.cc @@ -309,7 +309,6 @@ void Scope::Initialize(bool subclass_constructor) { // invoking scripts if (is_declaration_scope()) { DCHECK(!subclass_constructor || is_function_scope()); - DCHECK(FLAG_experimental_classes || !subclass_constructor); Variable* var = variables_.Declare( this, ast_value_factory_->this_string(), subclass_constructor ? CONST : VAR, false, Variable::THIS, diff --git a/src/x64/full-codegen-x64.cc b/src/x64/full-codegen-x64.cc index 82cfac0..db59015 100644 --- a/src/x64/full-codegen-x64.cc +++ b/src/x64/full-codegen-x64.cc @@ -422,8 +422,7 @@ void FullCodeGenerator::EmitReturnSequence() { int no_frame_start = masm_->pc_offset(); int arg_count = info_->scope()->num_parameters() + 1; - if (FLAG_experimental_classes && - IsSubclassConstructor(info_->function()->kind())) { + if (IsSubclassConstructor(info_->function()->kind())) { arg_count++; } int arguments_bytes = arg_count * kPointerSize; @@ -3076,15 +3075,7 @@ void FullCodeGenerator::VisitCall(Call* expr) { } } } else if (call_type == Call::SUPER_CALL) { - if (FLAG_experimental_classes) { - EmitSuperConstructorCall(expr); - } else { - EmitLoadSuperConstructor(); - __ Push(result_register()); - SuperReference* super_ref = callee->AsSuperReference(); - VisitForStackValue(super_ref->this_var()); - EmitCall(expr, CallICState::METHOD); - } + EmitSuperConstructorCall(expr); } else { DCHECK(call_type == Call::OTHER_CALL); // Call to an arbitrary expression not handled specially above. diff --git a/src/x87/full-codegen-x87.cc b/src/x87/full-codegen-x87.cc index ff009fd..160ae20 100644 --- a/src/x87/full-codegen-x87.cc +++ b/src/x87/full-codegen-x87.cc @@ -415,8 +415,7 @@ void FullCodeGenerator::EmitReturnSequence() { __ pop(ebp); int arg_count = info_->scope()->num_parameters() + 1; - if (FLAG_experimental_classes && - IsSubclassConstructor(info_->function()->kind())) { + if (IsSubclassConstructor(info_->function()->kind())) { arg_count++; } int arguments_bytes = arg_count * kPointerSize; @@ -3057,15 +3056,7 @@ void FullCodeGenerator::VisitCall(Call* expr) { } } } else if (call_type == Call::SUPER_CALL) { - if (FLAG_experimental_classes) { - EmitSuperConstructorCall(expr); - } else { - SuperReference* super_ref = callee->AsSuperReference(); - EmitLoadSuperConstructor(); - __ push(result_register()); - VisitForStackValue(super_ref->this_var()); - EmitCall(expr, CallICState::METHOD); - } + EmitSuperConstructorCall(expr); } else { DCHECK(call_type == Call::OTHER_CALL); // Call to an arbitrary expression not handled specially above. diff --git a/test/mjsunit/harmony/classes-experimental.js b/test/mjsunit/harmony/classes-experimental.js index 4e6cdc9..657c3b6 100644 --- a/test/mjsunit/harmony/classes-experimental.js +++ b/test/mjsunit/harmony/classes-experimental.js @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // -// Flags: --experimental-classes --harmony-classes +// Flags: --harmony-classes 'use strict'; (function TestArgumentsAccess() { diff --git a/test/mjsunit/harmony/regress/regress-455141.js b/test/mjsunit/harmony/regress/regress-455141.js index 6f5abb5..cf2141f 100644 --- a/test/mjsunit/harmony/regress/regress-455141.js +++ b/test/mjsunit/harmony/regress/regress-455141.js @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // -// Flags: --experimental-classes --no-lazy +// Flags: --harmony-classes --no-lazy "use strict"; class Base { } diff --git a/tools/gyp/v8.gyp b/tools/gyp/v8.gyp index 2e177e7..7fa63e4 100644 --- a/tools/gyp/v8.gyp +++ b/tools/gyp/v8.gyp @@ -366,8 +366,6 @@ '../../src/assembler.h', '../../src/assert-scope.h', '../../src/assert-scope.cc', - '../../src/ast-this-access-visitor.cc', - '../../src/ast-this-access-visitor.h', '../../src/ast-value-factory.cc', '../../src/ast-value-factory.h', '../../src/ast-numbering.cc',