diff options
author | Michaël Zasso <targos@protonmail.com> | 2018-03-07 08:54:53 +0100 |
---|---|---|
committer | Michaël Zasso <targos@protonmail.com> | 2018-03-07 16:48:52 +0100 |
commit | 88786fecff336342a56e6f2e7ff3b286be716e47 (patch) | |
tree | 92e6ba5b8ac8dae1a058988d20c9d27bfa654390 /deps/v8/src/ast | |
parent | 4e86f9b5ab83cbabf43839385bf383e6a7ef7d19 (diff) | |
download | node-new-88786fecff336342a56e6f2e7ff3b286be716e47.tar.gz |
deps: update V8 to 6.5.254.31
PR-URL: https://github.com/nodejs/node/pull/18453
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Yang Guo <yangguo@chromium.org>
Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Diffstat (limited to 'deps/v8/src/ast')
-rw-r--r-- | deps/v8/src/ast/ast-numbering.cc | 26 | ||||
-rw-r--r-- | deps/v8/src/ast/ast-traversal-visitor.h | 9 | ||||
-rw-r--r-- | deps/v8/src/ast/ast.cc | 21 | ||||
-rw-r--r-- | deps/v8/src/ast/ast.h | 71 | ||||
-rw-r--r-- | deps/v8/src/ast/prettyprinter.cc | 43 | ||||
-rw-r--r-- | deps/v8/src/ast/prettyprinter.h | 1 | ||||
-rw-r--r-- | deps/v8/src/ast/scopes.cc | 26 | ||||
-rw-r--r-- | deps/v8/src/ast/scopes.h | 14 |
8 files changed, 136 insertions, 75 deletions
diff --git a/deps/v8/src/ast/ast-numbering.cc b/deps/v8/src/ast/ast-numbering.cc index 0736e543e2..ade1a85349 100644 --- a/deps/v8/src/ast/ast-numbering.cc +++ b/deps/v8/src/ast/ast-numbering.cc @@ -16,10 +16,7 @@ class AstNumberingVisitor final : public AstVisitor<AstNumberingVisitor> { public: AstNumberingVisitor(uintptr_t stack_limit, Zone* zone, Compiler::EagerInnerFunctionLiterals* eager_literals) - : zone_(zone), - eager_literals_(eager_literals), - suspend_count_(0), - dont_optimize_reason_(kNoReason) { + : zone_(zone), eager_literals_(eager_literals), suspend_count_(0) { InitializeAstVisitor(stack_limit); } @@ -39,19 +36,12 @@ class AstNumberingVisitor final : public AstVisitor<AstNumberingVisitor> { void VisitArguments(ZoneList<Expression*>* arguments); void VisitLiteralProperty(LiteralProperty* property); - void DisableOptimization(BailoutReason reason) { - dont_optimize_reason_ = reason; - } - - BailoutReason dont_optimize_reason() const { return dont_optimize_reason_; } - Zone* zone() const { return zone_; } Zone* zone_; Compiler::EagerInnerFunctionLiterals* eager_literals_; int suspend_count_; FunctionKind function_kind_; - BailoutReason dont_optimize_reason_; DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); DISALLOW_COPY_AND_ASSIGN(AstNumberingVisitor); @@ -80,7 +70,6 @@ void AstNumberingVisitor::VisitDebuggerStatement(DebuggerStatement* node) { void AstNumberingVisitor::VisitNativeFunctionLiteral( NativeFunctionLiteral* node) { - DisableOptimization(kNativeFunctionLiteral); } void AstNumberingVisitor::VisitDoExpression(DoExpression* node) { @@ -206,6 +195,11 @@ void AstNumberingVisitor::VisitProperty(Property* node) { Visit(node->obj()); } +void AstNumberingVisitor::VisitResolvedProperty(ResolvedProperty* node) { + Visit(node->object()); + Visit(node->property()); +} + void AstNumberingVisitor::VisitAssignment(Assignment* node) { Visit(node->target()); Visit(node->value()); @@ -262,6 +256,7 @@ void AstNumberingVisitor::VisitForInStatement(ForInStatement* node) { void AstNumberingVisitor::VisitForOfStatement(ForOfStatement* node) { Visit(node->assign_iterator()); // Not part of loop. + Visit(node->assign_next()); node->set_first_suspend_id(suspend_count_); Visit(node->next_result()); Visit(node->result_done()); @@ -326,11 +321,6 @@ void AstNumberingVisitor::VisitObjectLiteral(ObjectLiteral* node) { for (int i = 0; i < node->properties()->length(); i++) { VisitLiteralProperty(node->properties()->at(i)); } - node->InitDepthAndFlags(); - // Mark all computed expressions that are bound to a key that - // is shadowed by a later occurrence of the same key. For the - // marked expressions, no store code will be is emitted. - node->CalculateEmitStore(zone_); } void AstNumberingVisitor::VisitLiteralProperty(LiteralProperty* node) { @@ -342,7 +332,6 @@ void AstNumberingVisitor::VisitArrayLiteral(ArrayLiteral* node) { for (int i = 0; i < node->values()->length(); i++) { Visit(node->values()->at(i)); } - node->InitDepthAndFlags(); } void AstNumberingVisitor::VisitCall(Call* node) { @@ -402,7 +391,6 @@ bool AstNumberingVisitor::Renumber(FunctionLiteral* node) { VisitDeclarations(scope->declarations()); VisitStatements(node->body()); - node->set_dont_optimize_reason(dont_optimize_reason()); node->set_suspend_count(suspend_count_); return !HasStackOverflow(); diff --git a/deps/v8/src/ast/ast-traversal-visitor.h b/deps/v8/src/ast/ast-traversal-visitor.h index 6ad4df357c..3679ec762a 100644 --- a/deps/v8/src/ast/ast-traversal-visitor.h +++ b/deps/v8/src/ast/ast-traversal-visitor.h @@ -243,6 +243,7 @@ void AstTraversalVisitor<Subclass>::VisitForStatement(ForStatement* stmt) { template <class Subclass> void AstTraversalVisitor<Subclass>::VisitForInStatement(ForInStatement* stmt) { PROCESS_NODE(stmt); + RECURSE(Visit(stmt->each())); RECURSE(Visit(stmt->enumerable())); RECURSE(Visit(stmt->body())); } @@ -392,6 +393,14 @@ void AstTraversalVisitor<Subclass>::VisitProperty(Property* expr) { } template <class Subclass> +void AstTraversalVisitor<Subclass>::VisitResolvedProperty( + ResolvedProperty* expr) { + PROCESS_EXPRESSION(expr); + RECURSE_EXPRESSION(VisitVariableProxy(expr->object())); + RECURSE_EXPRESSION(VisitVariableProxy(expr->property())); +} + +template <class Subclass> void AstTraversalVisitor<Subclass>::VisitCall(Call* expr) { PROCESS_EXPRESSION(expr); RECURSE_EXPRESSION(Visit(expr->expression())); diff --git a/deps/v8/src/ast/ast.cc b/deps/v8/src/ast/ast.cc index 710cbb40a5..da14d87475 100644 --- a/deps/v8/src/ast/ast.cc +++ b/deps/v8/src/ast/ast.cc @@ -514,18 +514,17 @@ bool ArrayLiteral::is_empty() const { } int ArrayLiteral::InitDepthAndFlags() { - DCHECK_LT(first_spread_index_, 0); if (is_initialized()) return depth(); - int constants_length = values()->length(); + int constants_length = + first_spread_index_ >= 0 ? first_spread_index_ : values()->length(); // Fill in the literals. - bool is_simple = true; + bool is_simple = first_spread_index_ < 0; int depth_acc = 1; int array_index = 0; for (; array_index < constants_length; array_index++) { Expression* element = values()->at(array_index); - DCHECK(!element->IsSpread()); MaterializedLiteral* literal = element->AsMaterializedLiteral(); if (literal != nullptr) { int subliteral_depth = literal->InitDepthAndFlags() + 1; @@ -546,11 +545,10 @@ int ArrayLiteral::InitDepthAndFlags() { } void ArrayLiteral::BuildConstantElements(Isolate* isolate) { - DCHECK_LT(first_spread_index_, 0); - if (!constant_elements_.is_null()) return; - int constants_length = values()->length(); + int constants_length = + first_spread_index_ >= 0 ? first_spread_index_ : values()->length(); ElementsKind kind = FIRST_FAST_ELEMENTS_KIND; Handle<FixedArray> fixed_array = isolate->factory()->NewFixedArrayWithHoles(constants_length); @@ -614,11 +612,6 @@ bool ArrayLiteral::IsFastCloningSupported() const { ConstructorBuiltins::kMaximumClonedShallowArrayElements; } -void ArrayLiteral::RewindSpreads() { - values_->Rewind(first_spread_index_); - first_spread_index_ = -1; -} - bool MaterializedLiteral::IsSimple() const { if (IsArrayLiteral()) return AsArrayLiteral()->is_simple(); if (IsObjectLiteral()) return AsObjectLiteral()->is_simple(); @@ -812,6 +805,10 @@ Call::CallType Call::GetCallType() const { } } + if (expression()->IsResolvedProperty()) { + return RESOLVED_PROPERTY_CALL; + } + return OTHER_CALL; } diff --git a/deps/v8/src/ast/ast.h b/deps/v8/src/ast/ast.h index 1ca192a462..f608621d3b 100644 --- a/deps/v8/src/ast/ast.h +++ b/deps/v8/src/ast/ast.h @@ -94,6 +94,7 @@ namespace internal { V(Literal) \ V(NativeFunctionLiteral) \ V(Property) \ + V(ResolvedProperty) \ V(RewritableExpression) \ V(Spread) \ V(SuperCallReference) \ @@ -590,11 +591,13 @@ class ForInStatement final : public ForEachStatement { class ForOfStatement final : public ForEachStatement { public: void Initialize(Statement* body, Variable* iterator, - Expression* assign_iterator, Expression* next_result, - Expression* result_done, Expression* assign_each) { + Expression* assign_iterator, Expression* assign_next, + Expression* next_result, Expression* result_done, + Expression* assign_each) { ForEachStatement::Initialize(body); iterator_ = iterator; assign_iterator_ = assign_iterator; + assign_next_ = assign_next; next_result_ = next_result; result_done_ = result_done; assign_each_ = assign_each; @@ -609,6 +612,9 @@ class ForOfStatement final : public ForEachStatement { return assign_iterator_; } + // iteratorRecord.next = iterator.next + Expression* assign_next() const { return assign_next_; } + // result = iterator.next() // with type check Expression* next_result() const { return next_result_; @@ -624,6 +630,12 @@ class ForOfStatement final : public ForEachStatement { return assign_each_; } + void set_assign_iterator(Expression* e) { assign_iterator_ = e; } + void set_assign_next(Expression* e) { assign_next_ = e; } + void set_next_result(Expression* e) { next_result_ = e; } + void set_result_done(Expression* e) { result_done_ = e; } + void set_assign_each(Expression* e) { assign_each_ = e; } + private: friend class AstNodeFactory; @@ -637,6 +649,7 @@ class ForOfStatement final : public ForEachStatement { Variable* iterator_; Expression* assign_iterator_; + Expression* assign_next_; Expression* next_result_; Expression* result_done_; Expression* assign_each_; @@ -1450,22 +1463,23 @@ class ArrayLiteral final : public AggregateLiteral { } // Provide a mechanism for iterating through values to rewrite spreads. - ZoneList<Expression*>::iterator FirstSpread() const { + ZoneList<Expression*>::iterator FirstSpreadOrEndValue() const { return (first_spread_index_ >= 0) ? values_->begin() + first_spread_index_ : values_->end(); } + ZoneList<Expression*>::iterator BeginValue() const { + return values_->begin(); + } ZoneList<Expression*>::iterator EndValue() const { return values_->end(); } - // Rewind an array literal omitting everything from the first spread on. - void RewindSpreads(); - private: friend class AstNodeFactory; ArrayLiteral(ZoneList<Expression*>* values, int first_spread_index, int pos) : AggregateLiteral(pos, kArrayLiteral), first_spread_index_(first_spread_index), - values_(values) {} + values_(values) { + } int first_spread_index_; Handle<ConstantElementsPair> constant_elements_; @@ -1606,6 +1620,25 @@ class Property final : public Expression { Expression* key_; }; +// ResolvedProperty pairs a receiver field with a value field. It allows Call +// to support arbitrary receivers while still taking advantage of TypeFeedback. +class ResolvedProperty final : public Expression { + public: + VariableProxy* object() const { return object_; } + VariableProxy* property() const { return property_; } + + void set_object(VariableProxy* e) { object_ = e; } + void set_property(VariableProxy* e) { property_ = e; } + + private: + friend class AstNodeFactory; + + ResolvedProperty(VariableProxy* obj, VariableProxy* property, int pos) + : Expression(pos, kResolvedProperty), object_(obj), property_(property) {} + + VariableProxy* object_; + VariableProxy* property_; +}; class Call final : public Expression { public: @@ -1632,6 +1665,7 @@ class Call final : public Expression { NAMED_SUPER_PROPERTY_CALL, KEYED_SUPER_PROPERTY_CALL, SUPER_CALL, + RESOLVED_PROPERTY_CALL, OTHER_CALL }; @@ -1697,11 +1731,10 @@ class CallNew final : public Expression { ZoneList<Expression*>* arguments_; }; - // The CallRuntime class does not represent any official JavaScript // language construct. Instead it is used to call a C or JS function // with a set of arguments. This is used from the builtins that are -// implemented in JavaScript (see "v8natives.js"). +// implemented in JavaScript. class CallRuntime final : public Expression { public: ZoneList<Expression*>* arguments() const { return arguments_; } @@ -2104,7 +2137,6 @@ class YieldStar final : public Suspend { // - One for awaiting the iterator result yielded by the delegated iterator // (await_delegated_iterator_output_suspend_id) int await_iterator_close_suspend_id() const { - DCHECK_NE(-1, await_iterator_close_suspend_id_); return await_iterator_close_suspend_id_; } void set_await_iterator_close_suspend_id(int id) { @@ -2112,7 +2144,6 @@ class YieldStar final : public Suspend { } int await_delegated_iterator_output_suspend_id() const { - DCHECK_NE(-1, await_delegated_iterator_output_suspend_id_); return await_delegated_iterator_output_suspend_id_; } void set_await_delegated_iterator_output_suspend_id(int id) { @@ -2168,7 +2199,8 @@ class FunctionLiteral final : public Expression { kAnonymousExpression, kNamedExpression, kDeclaration, - kAccessorOrMethod + kAccessorOrMethod, + kWrapped, }; enum IdType { kIdTypeInvalid = -1, kIdTypeTopLevel = 0 }; @@ -2199,6 +2231,7 @@ class FunctionLiteral final : public Expression { bool is_anonymous_expression() const { return function_type() == kAnonymousExpression; } + bool is_wrapped() const { return function_type() == kWrapped; } LanguageMode language_mode() const; static bool NeedsHomeObject(Expression* expr); @@ -2274,7 +2307,9 @@ class FunctionLiteral final : public Expression { } FunctionKind kind() const; - bool dont_optimize() { return dont_optimize_reason() != kNoReason; } + bool dont_optimize() { + return dont_optimize_reason() != BailoutReason::kNoReason; + } BailoutReason dont_optimize_reason() { return DontOptimizeReasonField::decode(bit_field_); } @@ -2337,14 +2372,14 @@ class FunctionLiteral final : public Expression { Pretenure::encode(false) | HasDuplicateParameters::encode(has_duplicate_parameters == kHasDuplicateParameters) | - DontOptimizeReasonField::encode(kNoReason) | + DontOptimizeReasonField::encode(BailoutReason::kNoReason) | RequiresInstanceFieldsInitializer::encode(false); if (eager_compile_hint == kShouldEagerCompile) SetShouldEagerCompile(); DCHECK_EQ(body == nullptr, expected_property_count < 0); } class FunctionTypeBits - : public BitField<FunctionType, Expression::kNextBitFieldIndex, 2> {}; + : public BitField<FunctionType, Expression::kNextBitFieldIndex, 3> {}; class Pretenure : public BitField<bool, FunctionTypeBits::kNext, 1> {}; class HasDuplicateParameters : public BitField<bool, Pretenure::kNext, 1> {}; class DontOptimizeReasonField @@ -2993,6 +3028,12 @@ class AstNodeFactory final BASE_EMBEDDED { return new (zone_) Property(obj, key, pos); } + ResolvedProperty* NewResolvedProperty(VariableProxy* obj, + VariableProxy* property, + int pos = kNoSourcePosition) { + return new (zone_) ResolvedProperty(obj, property, pos); + } + Call* NewCall(Expression* expression, ZoneList<Expression*>* arguments, int pos, Call::PossiblyEval possibly_eval = Call::NOT_EVAL) { return new (zone_) Call(expression, arguments, pos, possibly_eval); diff --git a/deps/v8/src/ast/prettyprinter.cc b/deps/v8/src/ast/prettyprinter.cc index f01ade8896..374c848289 100644 --- a/deps/v8/src/ast/prettyprinter.cc +++ b/deps/v8/src/ast/prettyprinter.cc @@ -26,6 +26,7 @@ CallPrinter::CallPrinter(Isolate* isolate, bool is_user_js) is_iterator_error_ = false; is_async_iterator_error_ = false; is_user_js_ = is_user_js; + function_kind_ = kNormalFunction; InitializeAstVisitor(isolate); } @@ -187,7 +188,10 @@ void CallPrinter::VisitDebuggerStatement(DebuggerStatement* node) {} void CallPrinter::VisitFunctionLiteral(FunctionLiteral* node) { + FunctionKind last_function_kind = function_kind_; + function_kind_ = node->kind(); FindStatements(node->body()); + function_kind_ = last_function_kind; } @@ -250,7 +254,17 @@ void CallPrinter::VisitArrayLiteral(ArrayLiteral* node) { Print("["); for (int i = 0; i < node->values()->length(); i++) { if (i != 0) Print(","); - Find(node->values()->at(i), true); + Expression* subexpr = node->values()->at(i); + Spread* spread = subexpr->AsSpread(); + if (spread != nullptr && !found_ && + position_ == spread->expression()->position()) { + found_ = true; + is_iterator_error_ = true; + Find(spread->expression(), true); + done_ = true; + return; + } + Find(subexpr, true); } Print("]"); } @@ -277,7 +291,17 @@ void CallPrinter::VisitCompoundAssignment(CompoundAssignment* node) { void CallPrinter::VisitYield(Yield* node) { Find(node->expression()); } -void CallPrinter::VisitYieldStar(YieldStar* node) { Find(node->expression()); } +void CallPrinter::VisitYieldStar(YieldStar* node) { + if (!found_ && position_ == node->expression()->position()) { + found_ = true; + if (IsAsyncFunction(function_kind_)) + is_async_iterator_error_ = true; + else + is_iterator_error_ = true; + Print("yield* "); + } + Find(node->expression()); +} void CallPrinter::VisitAwait(Await* node) { Find(node->expression()); } @@ -302,6 +326,7 @@ void CallPrinter::VisitProperty(Property* node) { } } +void CallPrinter::VisitResolvedProperty(ResolvedProperty* node) {} void CallPrinter::VisitCall(Call* node) { bool was_found = false; @@ -960,8 +985,10 @@ void AstPrinter::VisitTryCatchStatement(TryCatchStatement* node) { UNREACHABLE(); } Print(" %s\n", prediction); - PrintLiteralWithModeIndented("CATCHVAR", node->scope()->catch_variable(), - node->scope()->catch_variable()->raw_name()); + if (node->scope()) { + PrintLiteralWithModeIndented("CATCHVAR", node->scope()->catch_variable(), + node->scope()->catch_variable()->raw_name()); + } PrintIndentedVisit("CATCH", node->catch_block()); } @@ -1223,6 +1250,14 @@ void AstPrinter::VisitProperty(Property* node) { } } +void AstPrinter::VisitResolvedProperty(ResolvedProperty* node) { + EmbeddedVector<char, 128> buf; + SNPrintF(buf, "RESOLVED-PROPERTY"); + IndentedScope indent(this, buf.start(), node->position()); + + PrintIndentedVisit("RECEIVER", node->object()); + PrintIndentedVisit("PROPERTY", node->property()); +} void AstPrinter::VisitCall(Call* node) { EmbeddedVector<char, 128> buf; diff --git a/deps/v8/src/ast/prettyprinter.h b/deps/v8/src/ast/prettyprinter.h index 97c2437877..d93137b7cf 100644 --- a/deps/v8/src/ast/prettyprinter.h +++ b/deps/v8/src/ast/prettyprinter.h @@ -50,6 +50,7 @@ class CallPrinter final : public AstVisitor<CallPrinter> { bool is_iterator_error_; bool is_async_iterator_error_; bool is_call_error_; + FunctionKind function_kind_; DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); protected: diff --git a/deps/v8/src/ast/scopes.cc b/deps/v8/src/ast/scopes.cc index d012ec90f1..8f2f85080c 100644 --- a/deps/v8/src/ast/scopes.cc +++ b/deps/v8/src/ast/scopes.cc @@ -147,8 +147,6 @@ Scope::Scope(Zone* zone, Scope* outer_scope, ScopeType scope_type) DCHECK_NE(SCRIPT_SCOPE, scope_type); SetDefaults(); set_language_mode(outer_scope->language_mode()); - force_context_allocation_ = - !is_function_scope() && outer_scope->has_forced_context_allocation(); outer_scope_->AddInnerScope(this); } @@ -649,8 +647,8 @@ void DeclarationScope::Analyze(ParseInfo* info) { RuntimeCallTimerScope runtimeTimer( info->runtime_call_stats(), info->on_background_thread() - ? &RuntimeCallStats::CompileBackgroundScopeAnalysis - : &RuntimeCallStats::CompileScopeAnalysis); + ? RuntimeCallCounterId::kCompileBackgroundScopeAnalysis + : RuntimeCallCounterId::kCompileScopeAnalysis); DCHECK_NOT_NULL(info->literal()); DeclarationScope* scope = info->literal()->scope(); @@ -1370,12 +1368,8 @@ bool Scope::AllowsLazyParsingWithoutUnresolvedVariables( if (s->is_catch_scope()) continue; // With scopes do not introduce variables that need allocation. if (s->is_with_scope()) continue; - // Module scopes context-allocate all variables, and have no - // {this} or {arguments} variables whose existence depends on - // references to them. - if (s->is_module_scope()) continue; - // Only block scopes and function scopes should disallow preparsing. - DCHECK(s->is_block_scope() || s->is_function_scope()); + DCHECK(s->is_module_scope() || s->is_block_scope() || + s->is_function_scope()); return false; } return true; @@ -1443,6 +1437,10 @@ bool Scope::NeedsScopeInfo() const { return NeedsContext(); } +bool Scope::ShouldBanArguments() { + return GetReceiverScope()->should_ban_arguments(); +} + DeclarationScope* Scope::GetReceiverScope() { Scope* scope = this; while (!scope->is_script_scope() && @@ -1734,9 +1732,6 @@ void Scope::Print(int n) { if (scope->was_lazily_parsed()) Indent(n1, "// lazily parsed\n"); if (scope->ShouldEagerCompile()) Indent(n1, "// will be compiled\n"); } - if (has_forced_context_allocation()) { - Indent(n1, "// forces context allocation\n"); - } if (num_stack_slots_ > 0) { Indent(n1, "// "); PrintF("%d stack slots\n", num_stack_slots_); @@ -2111,11 +2106,8 @@ bool Scope::MustAllocateInContext(Variable* var) { // an eval() call or a runtime with lookup), it must be allocated in the // context. // - // Exceptions: If the scope as a whole has forced context allocation, all - // variables will have context allocation, even temporaries. Otherwise - // temporary variables are always stack-allocated. Catch-bound variables are + // Temporary variables are always stack-allocated. Catch-bound variables are // always context-allocated. - if (has_forced_context_allocation()) return true; if (var->mode() == TEMPORARY) return false; if (is_catch_scope()) return true; if ((is_script_scope() || is_eval_scope()) && diff --git a/deps/v8/src/ast/scopes.h b/deps/v8/src/ast/scopes.h index bcfd2187df..d2e8886319 100644 --- a/deps/v8/src/ast/scopes.h +++ b/deps/v8/src/ast/scopes.h @@ -334,14 +334,6 @@ class V8_EXPORT_PRIVATE Scope : public NON_EXPORTED_BASE(ZoneObject) { bool is_hidden() const { return is_hidden_; } void set_is_hidden() { is_hidden_ = true; } - // In some cases we want to force context allocation for a whole scope. - void ForceContextAllocation() { - DCHECK(!already_resolved_); - force_context_allocation_ = true; - } - bool has_forced_context_allocation() const { - return force_context_allocation_; - } void ForceContextAllocationForParameters() { DCHECK(!already_resolved_); force_context_allocation_for_parameters_ = true; @@ -404,6 +396,8 @@ class V8_EXPORT_PRIVATE Scope : public NON_EXPORTED_BASE(ZoneObject) { return static_cast<Variable*>(variables_.Start()->value); } + bool ShouldBanArguments(); + // --------------------------------------------------------------------------- // Variable allocation. @@ -704,6 +698,10 @@ class V8_EXPORT_PRIVATE DeclarationScope : public Scope { bool asm_module() const { return asm_module_; } void set_asm_module(); + bool should_ban_arguments() const { + return IsClassFieldsInitializerFunction(function_kind()); + } + void DeclareThis(AstValueFactory* ast_value_factory); void DeclareArguments(AstValueFactory* ast_value_factory); void DeclareDefaultFunctionVariables(AstValueFactory* ast_value_factory); |