Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(205)

Side by Side Diff: src/interpreter/bytecode-generator.cc

Issue 2212383003: Revert of Separate Scope into DeclarationScope and Scope (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/interpreter/bytecode-generator.h ('k') | src/parsing/parameter-initializer-rewriter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/interpreter/bytecode-generator.h" 5 #include "src/interpreter/bytecode-generator.h"
6 6
7 #include "src/ast/scopes.h" 7 #include "src/ast/scopes.h"
8 #include "src/code-stubs.h" 8 #include "src/code-stubs.h"
9 #include "src/compiler.h" 9 #include "src/compiler.h"
10 #include "src/interpreter/bytecode-flags.h" 10 #include "src/interpreter/bytecode-flags.h"
(...skipping 3033 matching lines...) Expand 10 before | Expand all | Expand 10 after
3044 .StoreAccumulatorInRegister(scope_info) 3044 .StoreAccumulatorInRegister(scope_info)
3045 .CallRuntime(Runtime::kNewScriptContext, closure, 2); 3045 .CallRuntime(Runtime::kNewScriptContext, closure, 2);
3046 } else { 3046 } else {
3047 int slot_count = scope->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; 3047 int slot_count = scope->num_heap_slots() - Context::MIN_CONTEXT_SLOTS;
3048 builder()->CreateFunctionContext(slot_count); 3048 builder()->CreateFunctionContext(slot_count);
3049 } 3049 }
3050 execution_result()->SetResultInAccumulator(); 3050 execution_result()->SetResultInAccumulator();
3051 } 3051 }
3052 3052
3053 void BytecodeGenerator::VisitBuildLocalActivationContext() { 3053 void BytecodeGenerator::VisitBuildLocalActivationContext() {
3054 DeclarationScope* scope = this->scope(); 3054 Scope* scope = this->scope();
3055 3055
3056 if (scope->has_this_declaration() && scope->receiver()->IsContextSlot()) { 3056 if (scope->has_this_declaration() && scope->receiver()->IsContextSlot()) {
3057 Variable* variable = scope->receiver(); 3057 Variable* variable = scope->receiver();
3058 Register receiver(builder()->Parameter(0)); 3058 Register receiver(builder()->Parameter(0));
3059 // Context variable (at bottom of the context chain). 3059 // Context variable (at bottom of the context chain).
3060 DCHECK_EQ(0, scope->ContextChainLength(variable->scope())); 3060 DCHECK_EQ(0, scope->ContextChainLength(variable->scope()));
3061 builder()->LoadAccumulatorWithRegister(receiver).StoreContextSlot( 3061 builder()->LoadAccumulatorWithRegister(receiver).StoreContextSlot(
3062 execution_context()->reg(), variable->index()); 3062 execution_context()->reg(), variable->index());
3063 } 3063 }
3064 3064
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
3193 void BytecodeGenerator::VisitNewTargetVariable(Variable* variable) { 3193 void BytecodeGenerator::VisitNewTargetVariable(Variable* variable) {
3194 if (variable == nullptr) return; 3194 if (variable == nullptr) return;
3195 3195
3196 // Store the new target we were called with in the given variable. 3196 // Store the new target we were called with in the given variable.
3197 builder()->LoadAccumulatorWithRegister(Register::new_target()); 3197 builder()->LoadAccumulatorWithRegister(Register::new_target());
3198 VisitVariableAssignment(variable, Token::INIT, FeedbackVectorSlot::Invalid()); 3198 VisitVariableAssignment(variable, Token::INIT, FeedbackVectorSlot::Invalid());
3199 } 3199 }
3200 3200
3201 void BytecodeGenerator::VisitFunctionClosureForContext() { 3201 void BytecodeGenerator::VisitFunctionClosureForContext() {
3202 AccumulatorResultScope accumulator_execution_result(this); 3202 AccumulatorResultScope accumulator_execution_result(this);
3203 DeclarationScope* closure_scope = 3203 Scope* closure_scope = execution_context()->scope()->ClosureScope();
3204 execution_context()->scope()->GetClosureScope();
3205 if (closure_scope->is_script_scope() || 3204 if (closure_scope->is_script_scope() ||
3206 closure_scope->is_module_scope()) { 3205 closure_scope->is_module_scope()) {
3207 // Contexts nested in the native context have a canonical empty function as 3206 // Contexts nested in the native context have a canonical empty function as
3208 // their closure, not the anonymous closure containing the global code. 3207 // their closure, not the anonymous closure containing the global code.
3209 Register native_context = register_allocator()->NewRegister(); 3208 Register native_context = register_allocator()->NewRegister();
3210 builder() 3209 builder()
3211 ->LoadContextSlot(execution_context()->reg(), 3210 ->LoadContextSlot(execution_context()->reg(),
3212 Context::NATIVE_CONTEXT_INDEX) 3211 Context::NATIVE_CONTEXT_INDEX)
3213 .StoreAccumulatorInRegister(native_context) 3212 .StoreAccumulatorInRegister(native_context)
3214 .LoadContextSlot(native_context, Context::CLOSURE_INDEX); 3213 .LoadContextSlot(native_context, Context::CLOSURE_INDEX);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
3272 return execution_context()->scope()->language_mode(); 3271 return execution_context()->scope()->language_mode();
3273 } 3272 }
3274 3273
3275 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { 3274 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const {
3276 return TypeFeedbackVector::GetIndex(slot); 3275 return TypeFeedbackVector::GetIndex(slot);
3277 } 3276 }
3278 3277
3279 } // namespace interpreter 3278 } // namespace interpreter
3280 } // namespace internal 3279 } // namespace internal
3281 } // namespace v8 3280 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/bytecode-generator.h ('k') | src/parsing/parameter-initializer-rewriter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698