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

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

Issue 2435023002: Use a different map to distinguish eval contexts (Closed)
Patch Set: Changes from review Created 4 years 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-array-builder.cc ('k') | src/interpreter/bytecodes.h » ('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/compile-time-value.h" 7 #include "src/ast/compile-time-value.h"
8 #include "src/ast/scopes.h" 8 #include "src/ast/scopes.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/compilation-info.h" 10 #include "src/compilation-info.h"
(...skipping 2987 matching lines...) Expand 10 before | Expand all | Expand 10 after
2998 // its sole argument, which we pass on to PushModuleContext. 2998 // its sole argument, which we pass on to PushModuleContext.
2999 RegisterList args = register_allocator()->NewRegisterList(3); 2999 RegisterList args = register_allocator()->NewRegisterList(3);
3000 builder() 3000 builder()
3001 ->MoveRegister(builder()->Parameter(1), args[0]) 3001 ->MoveRegister(builder()->Parameter(1), args[0])
3002 .LoadAccumulatorWithRegister(Register::function_closure()) 3002 .LoadAccumulatorWithRegister(Register::function_closure())
3003 .StoreAccumulatorInRegister(args[1]) 3003 .StoreAccumulatorInRegister(args[1])
3004 .LoadLiteral(scope->scope_info()) 3004 .LoadLiteral(scope->scope_info())
3005 .StoreAccumulatorInRegister(args[2]) 3005 .StoreAccumulatorInRegister(args[2])
3006 .CallRuntime(Runtime::kPushModuleContext, args); 3006 .CallRuntime(Runtime::kPushModuleContext, args);
3007 } else { 3007 } else {
3008 DCHECK(scope->is_function_scope() || scope->is_eval_scope());
3008 int slot_count = scope->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; 3009 int slot_count = scope->num_heap_slots() - Context::MIN_CONTEXT_SLOTS;
3009 if (slot_count <= FastNewFunctionContextStub::kMaximumSlots) { 3010 if (slot_count <= FastNewFunctionContextStub::MaximumSlots()) {
3010 builder()->CreateFunctionContext(slot_count); 3011 switch (scope->scope_type()) {
3012 case EVAL_SCOPE:
3013 builder()->CreateEvalContext(slot_count);
3014 break;
3015 case FUNCTION_SCOPE:
3016 builder()->CreateFunctionContext(slot_count);
3017 break;
3018 default:
3019 UNREACHABLE();
3020 }
3011 } else { 3021 } else {
3012 builder()->CallRuntime(Runtime::kNewFunctionContext, 3022 RegisterList args = register_allocator()->NewRegisterList(2);
3013 Register::function_closure()); 3023 builder()
3024 ->MoveRegister(Register::function_closure(), args[0])
3025 .LoadLiteral(Smi::FromInt(scope->scope_type()))
3026 .StoreAccumulatorInRegister(args[1])
3027 .CallRuntime(Runtime::kNewFunctionContext, args);
3014 } 3028 }
3015 } 3029 }
3016 } 3030 }
3017 3031
3018 void BytecodeGenerator::BuildLocalActivationContextInitialization() { 3032 void BytecodeGenerator::BuildLocalActivationContextInitialization() {
3019 DeclarationScope* scope = this->scope(); 3033 DeclarationScope* scope = this->scope();
3020 3034
3021 if (scope->has_this_declaration() && scope->receiver()->IsContextSlot()) { 3035 if (scope->has_this_declaration() && scope->receiver()->IsContextSlot()) {
3022 Variable* variable = scope->receiver(); 3036 Variable* variable = scope->receiver();
3023 Register receiver(builder()->Parameter(0)); 3037 Register receiver(builder()->Parameter(0));
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
3285 } 3299 }
3286 3300
3287 Runtime::FunctionId BytecodeGenerator::StoreKeyedToSuperRuntimeId() { 3301 Runtime::FunctionId BytecodeGenerator::StoreKeyedToSuperRuntimeId() {
3288 return is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict 3302 return is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict
3289 : Runtime::kStoreKeyedToSuper_Sloppy; 3303 : Runtime::kStoreKeyedToSuper_Sloppy;
3290 } 3304 }
3291 3305
3292 } // namespace interpreter 3306 } // namespace interpreter
3293 } // namespace internal 3307 } // namespace internal
3294 } // namespace v8 3308 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/bytecode-array-builder.cc ('k') | src/interpreter/bytecodes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698