Chromium Code Reviews| OLD | NEW | 
|---|---|
| 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 2984 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2995 // its sole argument, which we pass on to PushModuleContext. | 2995 // its sole argument, which we pass on to PushModuleContext. | 
| 2996 RegisterList args = register_allocator()->NewRegisterList(3); | 2996 RegisterList args = register_allocator()->NewRegisterList(3); | 
| 2997 builder() | 2997 builder() | 
| 2998 ->MoveRegister(builder()->Parameter(1), args[0]) | 2998 ->MoveRegister(builder()->Parameter(1), args[0]) | 
| 2999 .LoadAccumulatorWithRegister(Register::function_closure()) | 2999 .LoadAccumulatorWithRegister(Register::function_closure()) | 
| 3000 .StoreAccumulatorInRegister(args[1]) | 3000 .StoreAccumulatorInRegister(args[1]) | 
| 3001 .LoadLiteral(scope->scope_info()) | 3001 .LoadLiteral(scope->scope_info()) | 
| 3002 .StoreAccumulatorInRegister(args[2]) | 3002 .StoreAccumulatorInRegister(args[2]) | 
| 3003 .CallRuntime(Runtime::kPushModuleContext, args); | 3003 .CallRuntime(Runtime::kPushModuleContext, args); | 
| 3004 } else { | 3004 } else { | 
| 3005 DCHECK(scope->is_function_scope() || scope->is_eval_scope()); | |
| 3005 int slot_count = scope->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; | 3006 int slot_count = scope->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; | 
| 3006 if (slot_count <= FastNewFunctionContextStub::kMaximumSlots) { | 3007 if (slot_count <= FastNewFunctionContextStub::MaximumSlots()) { | 
| 3007 builder()->CreateFunctionContext(slot_count); | 3008 switch (scope->scope_type()) { | 
| 3009 case EVAL_SCOPE: | |
| 3010 builder()->CreateEvalContext(slot_count); | |
| 3011 break; | |
| 3012 case FUNCTION_SCOPE: | |
| 3013 builder()->CreateFunctionContext(slot_count); | |
| 3014 break; | |
| 3015 default: | |
| 3016 UNREACHABLE(); | |
| 3017 } | |
| 3008 } else { | 3018 } else { | 
| 3009 builder()->CallRuntime(Runtime::kNewFunctionContext, | 3019 RegisterList args = register_allocator()->NewRegisterList(2); | 
| 3010 Register::function_closure()); | 3020 builder() | 
| 3021 ->LoadAccumulatorWithRegister(Register::function_closure()) | |
| 
 
Michael Starzinger
2016/12/15 09:42:59
nit: Would MoveRegister(Register::function_closure
 
Dan Ehrenberg
2016/12/15 23:51:50
Done.
 
 | |
| 3022 .StoreAccumulatorInRegister(args[0]) | |
| 3023 .LoadLiteral(Smi::FromInt(scope->scope_type())) | |
| 3024 .StoreAccumulatorInRegister(args[1]) | |
| 3025 .CallRuntime(Runtime::kNewFunctionContext, args); | |
| 3011 } | 3026 } | 
| 3012 } | 3027 } | 
| 3013 } | 3028 } | 
| 3014 | 3029 | 
| 3015 void BytecodeGenerator::BuildLocalActivationContextInitialization() { | 3030 void BytecodeGenerator::BuildLocalActivationContextInitialization() { | 
| 3016 DeclarationScope* scope = this->scope(); | 3031 DeclarationScope* scope = this->scope(); | 
| 3017 | 3032 | 
| 3018 if (scope->has_this_declaration() && scope->receiver()->IsContextSlot()) { | 3033 if (scope->has_this_declaration() && scope->receiver()->IsContextSlot()) { | 
| 3019 Variable* variable = scope->receiver(); | 3034 Variable* variable = scope->receiver(); | 
| 3020 Register receiver(builder()->Parameter(0)); | 3035 Register receiver(builder()->Parameter(0)); | 
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3260 } | 3275 } | 
| 3261 | 3276 | 
| 3262 Runtime::FunctionId BytecodeGenerator::StoreKeyedToSuperRuntimeId() { | 3277 Runtime::FunctionId BytecodeGenerator::StoreKeyedToSuperRuntimeId() { | 
| 3263 return is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict | 3278 return is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict | 
| 3264 : Runtime::kStoreKeyedToSuper_Sloppy; | 3279 : Runtime::kStoreKeyedToSuper_Sloppy; | 
| 3265 } | 3280 } | 
| 3266 | 3281 | 
| 3267 } // namespace interpreter | 3282 } // namespace interpreter | 
| 3268 } // namespace internal | 3283 } // namespace internal | 
| 3269 } // namespace v8 | 3284 } // namespace v8 | 
| OLD | NEW |