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/interpreter.h" | 5 #include "src/interpreter/interpreter.h" |
6 | 6 |
7 #include <fstream> | 7 #include <fstream> |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "src/ast/prettyprinter.h" | 10 #include "src/ast/prettyprinter.h" |
(...skipping 2394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2405 __ Dispatch(); | 2405 __ Dispatch(); |
2406 } | 2406 } |
2407 | 2407 |
2408 // CreateFunctionContext <slots> | 2408 // CreateFunctionContext <slots> |
2409 // | 2409 // |
2410 // Creates a new context with number of |slots| for the function closure. | 2410 // Creates a new context with number of |slots| for the function closure. |
2411 void Interpreter::DoCreateFunctionContext(InterpreterAssembler* assembler) { | 2411 void Interpreter::DoCreateFunctionContext(InterpreterAssembler* assembler) { |
2412 Node* closure = __ LoadRegister(Register::function_closure()); | 2412 Node* closure = __ LoadRegister(Register::function_closure()); |
2413 Node* slots = __ BytecodeOperandUImm(0); | 2413 Node* slots = __ BytecodeOperandUImm(0); |
2414 Node* context = __ GetContext(); | 2414 Node* context = __ GetContext(); |
2415 __ SetAccumulator( | 2415 __ SetAccumulator(FastNewFunctionContextStub::Generate( |
2416 FastNewFunctionContextStub::Generate(assembler, closure, slots, context)); | 2416 assembler, closure, slots, context, FUNCTION_SCOPE)); |
2417 __ Dispatch(); | 2417 __ Dispatch(); |
2418 } | 2418 } |
2419 | 2419 |
| 2420 // CreateEvalContext <slots> |
| 2421 // |
| 2422 // Creates a new context with number of |slots| for an eval closure. |
| 2423 void Interpreter::DoCreateEvalContext(InterpreterAssembler* assembler) { |
| 2424 Node* closure = __ LoadRegister(Register::function_closure()); |
| 2425 Node* slots = __ BytecodeOperandUImm(0); |
| 2426 Node* context = __ GetContext(); |
| 2427 __ SetAccumulator(FastNewFunctionContextStub::Generate( |
| 2428 assembler, closure, slots, context, EVAL_SCOPE)); |
| 2429 __ Dispatch(); |
| 2430 } |
| 2431 |
2420 // CreateWithContext <register> <scope_info_idx> | 2432 // CreateWithContext <register> <scope_info_idx> |
2421 // | 2433 // |
2422 // Creates a new context with the ScopeInfo at |scope_info_idx| for a | 2434 // Creates a new context with the ScopeInfo at |scope_info_idx| for a |
2423 // with-statement with the object in |register| and the closure in the | 2435 // with-statement with the object in |register| and the closure in the |
2424 // accumulator. | 2436 // accumulator. |
2425 void Interpreter::DoCreateWithContext(InterpreterAssembler* assembler) { | 2437 void Interpreter::DoCreateWithContext(InterpreterAssembler* assembler) { |
2426 Node* reg_index = __ BytecodeOperandReg(0); | 2438 Node* reg_index = __ BytecodeOperandReg(0); |
2427 Node* object = __ LoadRegister(reg_index); | 2439 Node* object = __ LoadRegister(reg_index); |
2428 Node* scope_info_idx = __ BytecodeOperandIdx(1); | 2440 Node* scope_info_idx = __ BytecodeOperandIdx(1); |
2429 Node* scope_info = __ LoadConstantPoolEntry(scope_info_idx); | 2441 Node* scope_info = __ LoadConstantPoolEntry(scope_info_idx); |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2852 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, | 2864 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, |
2853 __ SmiTag(new_state)); | 2865 __ SmiTag(new_state)); |
2854 __ SetAccumulator(old_state); | 2866 __ SetAccumulator(old_state); |
2855 | 2867 |
2856 __ Dispatch(); | 2868 __ Dispatch(); |
2857 } | 2869 } |
2858 | 2870 |
2859 } // namespace interpreter | 2871 } // namespace interpreter |
2860 } // namespace internal | 2872 } // namespace internal |
2861 } // namespace v8 | 2873 } // namespace v8 |
OLD | NEW |