OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 #if V8_TARGET_ARCH_X64 | 5 #if V8_TARGET_ARCH_X64 |
6 | 6 |
7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/codegen.h" | 8 #include "src/codegen.h" |
9 #include "src/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
10 #include "src/full-codegen/full-codegen.h" | 10 #include "src/full-codegen/full-codegen.h" |
(...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
610 // Open a frame scope to indicate that there is a frame on the stack. The | 610 // Open a frame scope to indicate that there is a frame on the stack. The |
611 // MANUAL indicates that the scope shouldn't actually generate code to set up | 611 // MANUAL indicates that the scope shouldn't actually generate code to set up |
612 // the frame (that is done below). | 612 // the frame (that is done below). |
613 FrameScope frame_scope(masm, StackFrame::MANUAL); | 613 FrameScope frame_scope(masm, StackFrame::MANUAL); |
614 __ pushq(rbp); // Caller's frame pointer. | 614 __ pushq(rbp); // Caller's frame pointer. |
615 __ movp(rbp, rsp); | 615 __ movp(rbp, rsp); |
616 __ Push(rsi); // Callee's context. | 616 __ Push(rsi); // Callee's context. |
617 __ Push(rdi); // Callee's JS function. | 617 __ Push(rdi); // Callee's JS function. |
618 __ Push(rdx); // Callee's new target. | 618 __ Push(rdx); // Callee's new target. |
619 | 619 |
| 620 // Push dispatch table pointer. |
| 621 __ Move(rax, ExternalReference::interpreter_dispatch_table_address( |
| 622 masm->isolate())); |
| 623 __ Push(rax); |
620 // Push zero for bytecode array offset. | 624 // Push zero for bytecode array offset. |
621 __ Push(Immediate(0)); | 625 __ Push(Immediate(0)); |
622 | 626 |
623 // Get the bytecode array from the function object and load the pointer to the | 627 // Get the bytecode array from the function object and load the pointer to the |
624 // first entry into edi (InterpreterBytecodeRegister). | 628 // first entry into edi (InterpreterBytecodeRegister). |
625 __ movp(rax, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset)); | 629 __ movp(rax, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset)); |
626 __ movp(kInterpreterBytecodeArrayRegister, | 630 __ movp(kInterpreterBytecodeArrayRegister, |
627 FieldOperand(rax, SharedFunctionInfo::kFunctionDataOffset)); | 631 FieldOperand(rax, SharedFunctionInfo::kFunctionDataOffset)); |
628 | 632 |
629 if (FLAG_debug_code) { | 633 if (FLAG_debug_code) { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
670 // - Code aging of the BytecodeArray object. | 674 // - Code aging of the BytecodeArray object. |
671 | 675 |
672 // Load accumulator, register file, bytecode offset, dispatch table into | 676 // Load accumulator, register file, bytecode offset, dispatch table into |
673 // registers. | 677 // registers. |
674 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex); | 678 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex); |
675 __ movp(kInterpreterRegisterFileRegister, rbp); | 679 __ movp(kInterpreterRegisterFileRegister, rbp); |
676 __ addp(kInterpreterRegisterFileRegister, | 680 __ addp(kInterpreterRegisterFileRegister, |
677 Immediate(InterpreterFrameConstants::kRegisterFilePointerFromFp)); | 681 Immediate(InterpreterFrameConstants::kRegisterFilePointerFromFp)); |
678 __ movp(kInterpreterBytecodeOffsetRegister, | 682 __ movp(kInterpreterBytecodeOffsetRegister, |
679 Immediate(BytecodeArray::kHeaderSize - kHeapObjectTag)); | 683 Immediate(BytecodeArray::kHeaderSize - kHeapObjectTag)); |
680 __ Move( | 684 __ movp(kInterpreterDispatchTableRegister, |
681 kInterpreterDispatchTableRegister, | 685 Operand(rbp, InterpreterFrameConstants::kDispatchTableFromFp)); |
682 ExternalReference::interpreter_dispatch_table_address(masm->isolate())); | |
683 | 686 |
684 // Dispatch to the first bytecode handler for the function. | 687 // Dispatch to the first bytecode handler for the function. |
685 __ movzxbp(rbx, Operand(kInterpreterBytecodeArrayRegister, | 688 __ movzxbp(rbx, Operand(kInterpreterBytecodeArrayRegister, |
686 kInterpreterBytecodeOffsetRegister, times_1, 0)); | 689 kInterpreterBytecodeOffsetRegister, times_1, 0)); |
687 __ movp(rbx, Operand(kInterpreterDispatchTableRegister, rbx, | 690 __ movp(rbx, Operand(kInterpreterDispatchTableRegister, rbx, |
688 times_pointer_size, 0)); | 691 times_pointer_size, 0)); |
689 // TODO(rmcilroy): Make dispatch table point to code entrys to avoid untagging | 692 // TODO(rmcilroy): Make dispatch table point to code entrys to avoid untagging |
690 // and header removal. | 693 // and header removal. |
691 __ addp(rbx, Immediate(Code::kHeaderSize - kHeapObjectTag)); | 694 __ addp(rbx, Immediate(Code::kHeaderSize - kHeapObjectTag)); |
692 __ call(rbx); | 695 __ call(rbx); |
(...skipping 2155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2848 __ ret(0); | 2851 __ ret(0); |
2849 } | 2852 } |
2850 | 2853 |
2851 | 2854 |
2852 #undef __ | 2855 #undef __ |
2853 | 2856 |
2854 } // namespace internal | 2857 } // namespace internal |
2855 } // namespace v8 | 2858 } // namespace v8 |
2856 | 2859 |
2857 #endif // V8_TARGET_ARCH_X64 | 2860 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |