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 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
586 // Open a frame scope to indicate that there is a frame on the stack. The | 586 // Open a frame scope to indicate that there is a frame on the stack. The |
587 // MANUAL indicates that the scope shouldn't actually generate code to set up | 587 // MANUAL indicates that the scope shouldn't actually generate code to set up |
588 // the frame (that is done below). | 588 // the frame (that is done below). |
589 FrameScope frame_scope(masm, StackFrame::MANUAL); | 589 FrameScope frame_scope(masm, StackFrame::MANUAL); |
590 __ pushq(rbp); // Caller's frame pointer. | 590 __ pushq(rbp); // Caller's frame pointer. |
591 __ movp(rbp, rsp); | 591 __ movp(rbp, rsp); |
592 __ Push(rsi); // Callee's context. | 592 __ Push(rsi); // Callee's context. |
593 __ Push(rdi); // Callee's JS function. | 593 __ Push(rdi); // Callee's JS function. |
594 __ Push(rdx); // Callee's new target. | 594 __ Push(rdx); // Callee's new target. |
595 | 595 |
| 596 // Push zero for bytecode array offset. |
| 597 __ Push(Immediate(0)); |
| 598 |
596 // Get the bytecode array from the function object and load the pointer to the | 599 // Get the bytecode array from the function object and load the pointer to the |
597 // first entry into edi (InterpreterBytecodeRegister). | 600 // first entry into edi (InterpreterBytecodeRegister). |
598 __ movp(rax, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset)); | 601 __ movp(rax, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset)); |
599 __ movp(kInterpreterBytecodeArrayRegister, | 602 __ movp(kInterpreterBytecodeArrayRegister, |
600 FieldOperand(rax, SharedFunctionInfo::kFunctionDataOffset)); | 603 FieldOperand(rax, SharedFunctionInfo::kFunctionDataOffset)); |
601 | 604 |
602 if (FLAG_debug_code) { | 605 if (FLAG_debug_code) { |
603 // Check function data field is actually a BytecodeArray object. | 606 // Check function data field is actually a BytecodeArray object. |
604 __ AssertNotSmi(kInterpreterBytecodeArrayRegister); | 607 __ AssertNotSmi(kInterpreterBytecodeArrayRegister); |
605 __ CmpObjectType(kInterpreterBytecodeArrayRegister, BYTECODE_ARRAY_TYPE, | 608 __ CmpObjectType(kInterpreterBytecodeArrayRegister, BYTECODE_ARRAY_TYPE, |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
651 __ Push(kInterpreterBytecodeArrayRegister); | 654 __ Push(kInterpreterBytecodeArrayRegister); |
652 __ CallRuntime(Runtime::kStackGuard, 0); | 655 __ CallRuntime(Runtime::kStackGuard, 0); |
653 __ Pop(kInterpreterBytecodeArrayRegister); | 656 __ Pop(kInterpreterBytecodeArrayRegister); |
654 __ bind(&ok); | 657 __ bind(&ok); |
655 } | 658 } |
656 | 659 |
657 // Load accumulator, register file, bytecode offset, dispatch table into | 660 // Load accumulator, register file, bytecode offset, dispatch table into |
658 // registers. | 661 // registers. |
659 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex); | 662 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex); |
660 __ movp(kInterpreterRegisterFileRegister, rbp); | 663 __ movp(kInterpreterRegisterFileRegister, rbp); |
661 __ subp(kInterpreterRegisterFileRegister, | 664 __ addp(kInterpreterRegisterFileRegister, |
662 Immediate(2 * kPointerSize + | 665 Immediate(InterpreterFrameConstants::kRegisterFilePointerFromFp)); |
663 StandardFrameConstants::kFixedFrameSizeFromFp)); | |
664 __ movp(kInterpreterBytecodeOffsetRegister, | 666 __ movp(kInterpreterBytecodeOffsetRegister, |
665 Immediate(BytecodeArray::kHeaderSize - kHeapObjectTag)); | 667 Immediate(BytecodeArray::kHeaderSize - kHeapObjectTag)); |
666 __ LoadRoot(kInterpreterDispatchTableRegister, | 668 __ LoadRoot(kInterpreterDispatchTableRegister, |
667 Heap::kInterpreterTableRootIndex); | 669 Heap::kInterpreterTableRootIndex); |
668 __ addp(kInterpreterDispatchTableRegister, | 670 __ addp(kInterpreterDispatchTableRegister, |
669 Immediate(FixedArray::kHeaderSize - kHeapObjectTag)); | 671 Immediate(FixedArray::kHeaderSize - kHeapObjectTag)); |
670 | 672 |
671 // Dispatch to the first bytecode handler for the function. | 673 // Dispatch to the first bytecode handler for the function. |
672 __ movzxbp(rbx, Operand(kInterpreterBytecodeArrayRegister, | 674 __ movzxbp(rbx, Operand(kInterpreterBytecodeArrayRegister, |
673 kInterpreterBytecodeOffsetRegister, times_1, 0)); | 675 kInterpreterBytecodeOffsetRegister, times_1, 0)); |
(...skipping 1377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2051 __ ret(0); | 2053 __ ret(0); |
2052 } | 2054 } |
2053 | 2055 |
2054 | 2056 |
2055 #undef __ | 2057 #undef __ |
2056 | 2058 |
2057 } // namespace internal | 2059 } // namespace internal |
2058 } // namespace v8 | 2060 } // namespace v8 |
2059 | 2061 |
2060 #endif // V8_TARGET_ARCH_X64 | 2062 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |