| 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 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 534 DoStaGlobal(ic, assembler); | 534 DoStaGlobal(ic, assembler); |
| 535 } | 535 } |
| 536 | 536 |
| 537 compiler::Node* Interpreter::BuildLoadContextSlot( | 537 compiler::Node* Interpreter::BuildLoadContextSlot( |
| 538 InterpreterAssembler* assembler) { | 538 InterpreterAssembler* assembler) { |
| 539 Node* reg_index = __ BytecodeOperandReg(0); | 539 Node* reg_index = __ BytecodeOperandReg(0); |
| 540 Node* context = __ LoadRegister(reg_index); | 540 Node* context = __ LoadRegister(reg_index); |
| 541 Node* slot_index = __ BytecodeOperandIdx(1); | 541 Node* slot_index = __ BytecodeOperandIdx(1); |
| 542 Node* depth = __ BytecodeOperandUImm(2); | 542 Node* depth = __ BytecodeOperandUImm(2); |
| 543 Node* slot_context = __ GetContextAtDepth(context, depth); | 543 Node* slot_context = __ GetContextAtDepth(context, depth); |
| 544 return __ LoadContextSlot(slot_context, slot_index); | 544 return __ LoadContextElement(slot_context, slot_index); |
| 545 } | 545 } |
| 546 | 546 |
| 547 compiler::Node* Interpreter::BuildLoadCurrentContextSlot( | 547 compiler::Node* Interpreter::BuildLoadCurrentContextSlot( |
| 548 InterpreterAssembler* assembler) { | 548 InterpreterAssembler* assembler) { |
| 549 Node* slot_index = __ BytecodeOperandIdx(0); | 549 Node* slot_index = __ BytecodeOperandIdx(0); |
| 550 Node* slot_context = __ GetContext(); | 550 Node* slot_context = __ GetContext(); |
| 551 return __ LoadContextSlot(slot_context, slot_index); | 551 return __ LoadContextElement(slot_context, slot_index); |
| 552 } | 552 } |
| 553 | 553 |
| 554 // LdaContextSlot <context> <slot_index> <depth> | 554 // LdaContextSlot <context> <slot_index> <depth> |
| 555 // | 555 // |
| 556 // Load the object in |slot_index| of the context at |depth| in the context | 556 // Load the object in |slot_index| of the context at |depth| in the context |
| 557 // chain starting at |context| into the accumulator. | 557 // chain starting at |context| into the accumulator. |
| 558 void Interpreter::DoLdaContextSlot(InterpreterAssembler* assembler) { | 558 void Interpreter::DoLdaContextSlot(InterpreterAssembler* assembler) { |
| 559 Node* result = BuildLoadContextSlot(assembler); | 559 Node* result = BuildLoadContextSlot(assembler); |
| 560 __ SetAccumulator(result); | 560 __ SetAccumulator(result); |
| 561 __ Dispatch(); | 561 __ Dispatch(); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 595 // | 595 // |
| 596 // Stores the object in the accumulator into |slot_index| of the context at | 596 // Stores the object in the accumulator into |slot_index| of the context at |
| 597 // |depth| in the context chain starting at |context|. | 597 // |depth| in the context chain starting at |context|. |
| 598 void Interpreter::DoStaContextSlot(InterpreterAssembler* assembler) { | 598 void Interpreter::DoStaContextSlot(InterpreterAssembler* assembler) { |
| 599 Node* value = __ GetAccumulator(); | 599 Node* value = __ GetAccumulator(); |
| 600 Node* reg_index = __ BytecodeOperandReg(0); | 600 Node* reg_index = __ BytecodeOperandReg(0); |
| 601 Node* context = __ LoadRegister(reg_index); | 601 Node* context = __ LoadRegister(reg_index); |
| 602 Node* slot_index = __ BytecodeOperandIdx(1); | 602 Node* slot_index = __ BytecodeOperandIdx(1); |
| 603 Node* depth = __ BytecodeOperandUImm(2); | 603 Node* depth = __ BytecodeOperandUImm(2); |
| 604 Node* slot_context = __ GetContextAtDepth(context, depth); | 604 Node* slot_context = __ GetContextAtDepth(context, depth); |
| 605 __ StoreContextSlot(slot_context, slot_index, value); | 605 __ StoreContextElement(slot_context, slot_index, value); |
| 606 __ Dispatch(); | 606 __ Dispatch(); |
| 607 } | 607 } |
| 608 | 608 |
| 609 // StaCurrentContextSlot <slot_index> | 609 // StaCurrentContextSlot <slot_index> |
| 610 // | 610 // |
| 611 // Stores the object in the accumulator into |slot_index| of the current | 611 // Stores the object in the accumulator into |slot_index| of the current |
| 612 // context. | 612 // context. |
| 613 void Interpreter::DoStaCurrentContextSlot(InterpreterAssembler* assembler) { | 613 void Interpreter::DoStaCurrentContextSlot(InterpreterAssembler* assembler) { |
| 614 Node* value = __ GetAccumulator(); | 614 Node* value = __ GetAccumulator(); |
| 615 Node* slot_index = __ BytecodeOperandIdx(0); | 615 Node* slot_index = __ BytecodeOperandIdx(0); |
| 616 Node* slot_context = __ GetContext(); | 616 Node* slot_context = __ GetContext(); |
| 617 __ StoreContextSlot(slot_context, slot_index, value); | 617 __ StoreContextElement(slot_context, slot_index, value); |
| 618 __ Dispatch(); | 618 __ Dispatch(); |
| 619 } | 619 } |
| 620 | 620 |
| 621 void Interpreter::DoLdaLookupSlot(Runtime::FunctionId function_id, | 621 void Interpreter::DoLdaLookupSlot(Runtime::FunctionId function_id, |
| 622 InterpreterAssembler* assembler) { | 622 InterpreterAssembler* assembler) { |
| 623 Node* name_index = __ BytecodeOperandIdx(0); | 623 Node* name_index = __ BytecodeOperandIdx(0); |
| 624 Node* name = __ LoadConstantPoolEntry(name_index); | 624 Node* name = __ LoadConstantPoolEntry(name_index); |
| 625 Node* context = __ GetContext(); | 625 Node* context = __ GetContext(); |
| 626 Node* result = __ CallRuntime(function_id, context, name); | 626 Node* result = __ CallRuntime(function_id, context, name); |
| 627 __ SetAccumulator(result); | 627 __ SetAccumulator(result); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 652 Node* depth = __ BytecodeOperandUImm(2); | 652 Node* depth = __ BytecodeOperandUImm(2); |
| 653 | 653 |
| 654 Label slowpath(assembler, Label::kDeferred); | 654 Label slowpath(assembler, Label::kDeferred); |
| 655 | 655 |
| 656 // Check for context extensions to allow the fast path. | 656 // Check for context extensions to allow the fast path. |
| 657 __ GotoIfHasContextExtensionUpToDepth(context, depth, &slowpath); | 657 __ GotoIfHasContextExtensionUpToDepth(context, depth, &slowpath); |
| 658 | 658 |
| 659 // Fast path does a normal load context. | 659 // Fast path does a normal load context. |
| 660 { | 660 { |
| 661 Node* slot_context = __ GetContextAtDepth(context, depth); | 661 Node* slot_context = __ GetContextAtDepth(context, depth); |
| 662 Node* result = __ LoadContextSlot(slot_context, slot_index); | 662 Node* result = __ LoadContextElement(slot_context, slot_index); |
| 663 __ SetAccumulator(result); | 663 __ SetAccumulator(result); |
| 664 __ Dispatch(); | 664 __ Dispatch(); |
| 665 } | 665 } |
| 666 | 666 |
| 667 // Slow path when we have to call out to the runtime. | 667 // Slow path when we have to call out to the runtime. |
| 668 __ Bind(&slowpath); | 668 __ Bind(&slowpath); |
| 669 { | 669 { |
| 670 Node* name = __ LoadConstantPoolEntry(name_index); | 670 Node* name = __ LoadConstantPoolEntry(name_index); |
| 671 Node* result = __ CallRuntime(function_id, context, name); | 671 Node* result = __ CallRuntime(function_id, context, name); |
| 672 __ SetAccumulator(result); | 672 __ SetAccumulator(result); |
| (...skipping 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1751 Node* context_index = __ BytecodeOperandIdx(0); | 1751 Node* context_index = __ BytecodeOperandIdx(0); |
| 1752 Node* receiver_reg = __ BytecodeOperandReg(1); | 1752 Node* receiver_reg = __ BytecodeOperandReg(1); |
| 1753 Node* first_arg = __ RegisterLocation(receiver_reg); | 1753 Node* first_arg = __ RegisterLocation(receiver_reg); |
| 1754 Node* receiver_args_count = __ BytecodeOperandCount(2); | 1754 Node* receiver_args_count = __ BytecodeOperandCount(2); |
| 1755 Node* receiver_count = __ Int32Constant(1); | 1755 Node* receiver_count = __ Int32Constant(1); |
| 1756 Node* args_count = __ Int32Sub(receiver_args_count, receiver_count); | 1756 Node* args_count = __ Int32Sub(receiver_args_count, receiver_count); |
| 1757 | 1757 |
| 1758 // Get the function to call from the native context. | 1758 // Get the function to call from the native context. |
| 1759 Node* context = __ GetContext(); | 1759 Node* context = __ GetContext(); |
| 1760 Node* native_context = __ LoadNativeContext(context); | 1760 Node* native_context = __ LoadNativeContext(context); |
| 1761 Node* function = __ LoadContextSlot(native_context, context_index); | 1761 Node* function = __ LoadContextElement(native_context, context_index); |
| 1762 | 1762 |
| 1763 // Call the function. | 1763 // Call the function. |
| 1764 Node* result = __ CallJS(function, context, first_arg, args_count, | 1764 Node* result = __ CallJS(function, context, first_arg, args_count, |
| 1765 TailCallMode::kDisallow); | 1765 TailCallMode::kDisallow); |
| 1766 __ SetAccumulator(result); | 1766 __ SetAccumulator(result); |
| 1767 __ Dispatch(); | 1767 __ Dispatch(); |
| 1768 } | 1768 } |
| 1769 | 1769 |
| 1770 // New <constructor> <first_arg> <arg_count> | 1770 // New <constructor> <first_arg> <arg_count> |
| 1771 // | 1771 // |
| (...skipping 922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2694 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, | 2694 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, |
| 2695 __ SmiTag(new_state)); | 2695 __ SmiTag(new_state)); |
| 2696 __ SetAccumulator(old_state); | 2696 __ SetAccumulator(old_state); |
| 2697 | 2697 |
| 2698 __ Dispatch(); | 2698 __ Dispatch(); |
| 2699 } | 2699 } |
| 2700 | 2700 |
| 2701 } // namespace interpreter | 2701 } // namespace interpreter |
| 2702 } // namespace internal | 2702 } // namespace internal |
| 2703 } // namespace v8 | 2703 } // namespace v8 |
| OLD | NEW |