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 2909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2920 // A JSFunction representing a module is called with the module object as | 2920 // A JSFunction representing a module is called with the module object as |
2921 // its sole argument, which we pass on to PushModuleContext. | 2921 // its sole argument, which we pass on to PushModuleContext. |
2922 RegisterList args = register_allocator()->NewRegisterList(3); | 2922 RegisterList args = register_allocator()->NewRegisterList(3); |
2923 builder() | 2923 builder() |
2924 ->MoveRegister(builder()->Parameter(1), args[0]) | 2924 ->MoveRegister(builder()->Parameter(1), args[0]) |
2925 .LoadAccumulatorWithRegister(Register::function_closure()) | 2925 .LoadAccumulatorWithRegister(Register::function_closure()) |
2926 .StoreAccumulatorInRegister(args[1]) | 2926 .StoreAccumulatorInRegister(args[1]) |
2927 .LoadLiteral(scope->scope_info()) | 2927 .LoadLiteral(scope->scope_info()) |
2928 .StoreAccumulatorInRegister(args[2]) | 2928 .StoreAccumulatorInRegister(args[2]) |
2929 .CallRuntime(Runtime::kPushModuleContext, args); | 2929 .CallRuntime(Runtime::kPushModuleContext, args); |
| 2930 } else if (scope->is_eval_scope()) { |
| 2931 int slot_count = scope->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; |
| 2932 builder()->CreateEvalContext(slot_count); |
2930 } else { | 2933 } else { |
2931 int slot_count = scope->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; | 2934 int slot_count = scope->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; |
2932 builder()->CreateFunctionContext(slot_count); | 2935 builder()->CreateFunctionContext(slot_count); |
2933 } | 2936 } |
2934 } | 2937 } |
2935 | 2938 |
2936 void BytecodeGenerator::BuildLocalActivationContextInitialization() { | 2939 void BytecodeGenerator::BuildLocalActivationContextInitialization() { |
2937 DeclarationScope* scope = this->scope(); | 2940 DeclarationScope* scope = this->scope(); |
2938 | 2941 |
2939 if (scope->has_this_declaration() && scope->receiver()->IsContextSlot()) { | 2942 if (scope->has_this_declaration() && scope->receiver()->IsContextSlot()) { |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3177 } | 3180 } |
3178 | 3181 |
3179 Runtime::FunctionId BytecodeGenerator::StoreKeyedToSuperRuntimeId() { | 3182 Runtime::FunctionId BytecodeGenerator::StoreKeyedToSuperRuntimeId() { |
3180 return is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict | 3183 return is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict |
3181 : Runtime::kStoreKeyedToSuper_Sloppy; | 3184 : Runtime::kStoreKeyedToSuper_Sloppy; |
3182 } | 3185 } |
3183 | 3186 |
3184 } // namespace interpreter | 3187 } // namespace interpreter |
3185 } // namespace internal | 3188 } // namespace internal |
3186 } // namespace v8 | 3189 } // namespace v8 |
OLD | NEW |