Lines Matching defs:scope

21 #include "src/heap/parked-scope.h"
49 ContextScope(BytecodeGenerator* generator, Scope* scope,
52 scope_(scope),
56 DCHECK(scope->NeedsContext() || outer_ == nullptr);
82 // Returns the depth of the given |scope| for the current execution context.
83 int ContextChainDepth(Scope* scope) {
84 return scope_->ContextChainLength(scope);
161 // Helper to pop the context chain to a depth expected by this control scope.
176 // Helper class for a try-finally control scope. It can record intercepted
762 if (info->scope()->is_module_scope()) {
763 for (Declaration* decl : *info->scope()->declarations()) {
789 for (Declaration* decl : *info->scope()->declarations()) {
859 CurrentScope(BytecodeGenerator* generator, Scope* scope)
861 if (scope != nullptr) {
862 DCHECK_EQ(outer_scope_, scope->outer_scope());
863 generator_->set_current_scope(scope);
881 MultipleEntryBlockContextScope(BytecodeGenerator* generator, Scope* scope)
882 : generator_(generator), scope_(scope), is_in_scope_(false) {
883 if (scope) {
1045 // LoopScope delimits the scope of {loop}, from its header to its final jump.
1142 info->scope()->num_stack_slots(), info->feedback_vector_spec(),
1146 closure_scope_(info->scope()),
1147 current_scope_(info->scope()),
1361 bool NeedsContextInitialization(DeclarationScope* scope) {
1362 return scope->NeedsContext() && !scope->is_script_scope() &&
1363 !scope->is_module_scope();
1373 // Initialize control scope.
1388 // Push a new inner context scope for the function.
1438 // Increment the function-scope block coverage counter.
1441 // Visit declarations within the function scope.
1456 ClassScope* scope = info()->scope()->outer_scope()->AsClassScope();
1457 DCHECK_NOT_NULL(scope->brand());
1458 BuildPrivateBrandInitialization(builder()->Receiver(), scope->brand());
1519 CurrentScope current_scope(this, stmt->scope());
1520 if (stmt->scope() != nullptr && stmt->scope()->NeedsContext()) {
1521 BuildNewLocalBlockContext(stmt->scope());
1522 ContextScope scope(this, stmt->scope());
1532 if (stmt->scope() != nullptr) {
1533 VisitDeclarations(stmt->scope()->declarations());
1564 DCHECK_EQ(0, execution_context()->ContextChainDepth(variable->scope()));
1604 DCHECK_EQ(0, execution_context()->ContextChainDepth(variable->scope()));
1719 // Allocate an outer register allocations scope for the statement.
1802 BuildNewLocalWithContext(stmt->scope());
1803 VisitInScope(stmt->statement(), stmt->scope());
1990 // We need this scope because we visit for register values. We have to
1991 // maintain a execution result scope where registers can be allocated.
2013 ControlScopeForBreakable scope(this, stmt, &switch_builder);
2153 // Evaluate the try-block inside a control scope. This simulates a handler
2157 ControlScopeForTryCatch scope(this, &try_control_builder);
2206 // Evaluate the try-block inside a control scope. This simulates a handler
2210 ControlScopeForTryFinally scope(this, &try_control_builder, &commands);
2357 EffectResultScope scope(this);
2476 if (stmt->scope()) {
2477 // Create a catch scope that binds the exception.
2478 BuildNewLocalCatchContext(stmt->scope());
2491 if (stmt->scope()) {
2492 VisitInScope(stmt->catch_block(), stmt->scope());
2515 DCHECK_EQ(expr->scope()->outer_scope(), current_scope());
2539 UnparkedScope scope(local_isolate_);
2564 VisitDeclarations(expr->scope()->declarations());
2571 if (expr->scope()->brand() != nullptr) {
2574 expr->scope()->class_variable() != nullptr
2575 ? expr->scope()->class_variable()->raw_name()
2581 BuildVariableAssignment(expr->scope()->brand(), Token::INIT,
2725 Variable* class_variable = expr->scope()->class_variable();
2799 CurrentScope current_scope(this, expr->scope());
2800 DCHECK_NOT_NULL(expr->scope());
2801 if (expr->scope()->NeedsContext()) {
2804 // between the scope and the context, where we already are in a
2805 // block context for the class, but not yet in the class scope.
2807 BuildNewLocalBlockContext(expr->scope());
2808 ContextScope scope(this, expr->scope());
2905 int depth = execution_context()->ContextChainDepth(brand->scope());
2916 // arrow function or a eval(), so the class scope context isn't
2919 DCHECK_NE(info()->literal()->scope()->outer_scope(), brand->scope());
3053 this, home_object ? home_object->scope() : nullptr);
3218 // Computed property keys don't belong to the object literal scope (even
3261 // Computed property keys don't belong to the object literal scope (even
3466 RegisterAllocationScope scope(this);
3565 int depth = execution_context()->ContextChainDepth(variable->scope());
3592 execution_context()->ContextChainDepth(local_variable->scope());
3616 int depth = execution_context()->ContextChainDepth(variable->scope());
3749 int depth = execution_context()->ContextChainDepth(variable->scope());
3797 int depth = execution_context()->ContextChainDepth(variable->scope());
3936 AccumulatorPreservingScope scope(this, accumulator_preserving_mode);
3943 AccumulatorPreservingScope scope(this, accumulator_preserving_mode);
3953 AccumulatorPreservingScope scope(this, accumulator_preserving_mode);
3960 AccumulatorPreservingScope scope(this, accumulator_preserving_mode);
3975 AccumulatorPreservingScope scope(this, accumulator_preserving_mode);
4148 RegisterAllocationScope scope(this);
4247 RegisterAllocationScope scope(this);
5005 info()->scope()->is_repl_mode_scope());
5128 RegisterAllocationScope scope(this);
5143 RegisterAllocationScope scope(this);
5159 ClassScope* scope = private_name->scope()->AsClassScope();
5163 if (scope->class_variable() == nullptr) {
5196 BuildVariableLoadForAccumulatorValue(scope->class_variable(),
5201 BuildVariableLoadForAccumulatorValue(scope->brand(),
5219 ClassScope* scope = private_name->scope()->AsClassScope();
5224 if (scope->class_variable() == nullptr) {
5232 // something other than scope->class_variable() in this scenario.
5245 BuildVariableLoadForAccumulatorValue(scope->class_variable(),
5250 const AstRawString* name = scope->class_variable()->raw_name();
5264 BuildVariableLoadForAccumulatorValue(scope->brand(),
5669 // The constructor scope always needs ScopeInfo, so we are certain that
5670 // the first constructor scope found in the outer scope chain is the
5671 // scope that we are looking for for this super() call.
5675 DeclarationScope* constructor_scope = info()->scope()->GetConstructorScope();
5679 // the case we are certain that its outer class scope requires a context to
5681 // from the outer scope.
5891 // behavior, but does unnecessary context-walking (since scope
5893 // any non-global scope). Consider adding a DeleteGlobal bytecode
6289 RegisterAllocationScope scope(this);
6331 RegisterAllocationScope scope(this);
6834 Scope* scope = closure_scope();
6838 DCHECK(scope->is_function_scope() || scope->is_eval_scope());
6839 int slot_count = scope->num_heap_slots() - Context::MIN_CONTEXT_SLOTS;
6841 switch (scope->scope_type()) {
6843 builder()->CreateEvalContext(scope, slot_count);
6846 builder()->CreateFunctionContext(scope, slot_count);
6853 builder()->LoadLiteral(scope).StoreAccumulatorInRegister(arg).CallRuntime(
6859 DeclarationScope* scope = closure_scope();
6861 if (scope->has_this_declaration() && scope->receiver()->IsContextSlot()) {
6862 Variable* variable = scope->receiver();
6865 DCHECK_EQ(0, scope->ContextChainLength(variable->scope()));
6871 int num_parameters = scope->num_parameters();
6873 Variable* variable = scope->parameter(i);
6878 DCHECK_EQ(0, scope->ContextChainLength(variable->scope()));
6884 void BytecodeGenerator::BuildNewLocalBlockContext(Scope* scope) {
6886 DCHECK(scope->is_block_scope());
6888 builder()->CreateBlockContext(scope);
6891 void BytecodeGenerator::BuildNewLocalWithContext(Scope* scope) {
6897 builder()->CreateWithContext(extension_object, scope);
6900 void BytecodeGenerator::BuildNewLocalCatchContext(Scope* scope) {
6902 DCHECK(scope->catch_variable()->IsContextSlot());
6906 builder()->CreateCatchContext(exception, scope);
7127 // jumps below, we ensure that the result scope is deleted before doing so.
7179 void BytecodeGenerator::VisitInScope(Statement* stmt, Scope* scope) {
7180 DCHECK(scope->declarations()->is_empty());
7181 CurrentScope current_scope(this, scope);
7182 ContextScope context_scope(this, scope);