| 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 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 Node* reg_index = __ BytecodeOperandReg(0); | 549 Node* reg_index = __ BytecodeOperandReg(0); |
| 550 Node* context = __ LoadRegister(reg_index); | 550 Node* context = __ LoadRegister(reg_index); |
| 551 Node* slot_index = __ BytecodeOperandIdx(1); | 551 Node* slot_index = __ BytecodeOperandIdx(1); |
| 552 Node* depth = __ BytecodeOperandUImm(2); | 552 Node* depth = __ BytecodeOperandUImm(2); |
| 553 Node* slot_context = __ GetContextAtDepth(context, depth); | 553 Node* slot_context = __ GetContextAtDepth(context, depth); |
| 554 Node* result = __ LoadContextElement(slot_context, slot_index); | 554 Node* result = __ LoadContextElement(slot_context, slot_index); |
| 555 __ SetAccumulator(result); | 555 __ SetAccumulator(result); |
| 556 __ Dispatch(); | 556 __ Dispatch(); |
| 557 } | 557 } |
| 558 | 558 |
| 559 // LdaImmutableContextSlot <context> <slot_index> <depth> | |
| 560 // | |
| 561 // Load the object in |slot_index| of the context at |depth| in the context | |
| 562 // chain starting at |context| into the accumulator. | |
| 563 void Interpreter::DoLdaImmutableContextSlot(InterpreterAssembler* assembler) { | |
| 564 // TODO(danno) Share the actual code object rather creating a duplicate one. | |
| 565 DoLdaContextSlot(assembler); | |
| 566 } | |
| 567 | |
| 568 // LdaCurrentContextSlot <slot_index> | 559 // LdaCurrentContextSlot <slot_index> |
| 569 // | 560 // |
| 570 // Load the object in |slot_index| of the current context into the accumulator. | 561 // Load the object in |slot_index| of the current context into the accumulator. |
| 571 void Interpreter::DoLdaCurrentContextSlot(InterpreterAssembler* assembler) { | 562 void Interpreter::DoLdaCurrentContextSlot(InterpreterAssembler* assembler) { |
| 572 Node* slot_index = __ BytecodeOperandIdx(0); | 563 Node* slot_index = __ BytecodeOperandIdx(0); |
| 573 Node* slot_context = __ GetContext(); | 564 Node* slot_context = __ GetContext(); |
| 574 Node* result = __ LoadContextElement(slot_context, slot_index); | 565 Node* result = __ LoadContextElement(slot_context, slot_index); |
| 575 __ SetAccumulator(result); | 566 __ SetAccumulator(result); |
| 576 __ Dispatch(); | 567 __ Dispatch(); |
| 577 } | 568 } |
| 578 | 569 |
| 579 // LdaImmutableCurrentContextSlot <slot_index> | |
| 580 // | |
| 581 // Load the object in |slot_index| of the current context into the accumulator. | |
| 582 void Interpreter::DoLdaImmutableCurrentContextSlot( | |
| 583 InterpreterAssembler* assembler) { | |
| 584 // TODO(danno) Share the actual code object rather creating a duplicate one. | |
| 585 DoLdaCurrentContextSlot(assembler); | |
| 586 } | |
| 587 | |
| 588 // StaContextSlot <context> <slot_index> <depth> | 570 // StaContextSlot <context> <slot_index> <depth> |
| 589 // | 571 // |
| 590 // Stores the object in the accumulator into |slot_index| of the context at | 572 // Stores the object in the accumulator into |slot_index| of the context at |
| 591 // |depth| in the context chain starting at |context|. | 573 // |depth| in the context chain starting at |context|. |
| 592 void Interpreter::DoStaContextSlot(InterpreterAssembler* assembler) { | 574 void Interpreter::DoStaContextSlot(InterpreterAssembler* assembler) { |
| 593 Node* value = __ GetAccumulator(); | 575 Node* value = __ GetAccumulator(); |
| 594 Node* reg_index = __ BytecodeOperandReg(0); | 576 Node* reg_index = __ BytecodeOperandReg(0); |
| 595 Node* context = __ LoadRegister(reg_index); | 577 Node* context = __ LoadRegister(reg_index); |
| 596 Node* slot_index = __ BytecodeOperandIdx(1); | 578 Node* slot_index = __ BytecodeOperandIdx(1); |
| 597 Node* depth = __ BytecodeOperandUImm(2); | 579 Node* depth = __ BytecodeOperandUImm(2); |
| (...skipping 2731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3329 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, | 3311 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, |
| 3330 __ SmiTag(new_state)); | 3312 __ SmiTag(new_state)); |
| 3331 __ SetAccumulator(old_state); | 3313 __ SetAccumulator(old_state); |
| 3332 | 3314 |
| 3333 __ Dispatch(); | 3315 __ Dispatch(); |
| 3334 } | 3316 } |
| 3335 | 3317 |
| 3336 } // namespace interpreter | 3318 } // namespace interpreter |
| 3337 } // namespace internal | 3319 } // namespace internal |
| 3338 } // namespace v8 | 3320 } // namespace v8 |
| OLD | NEW |