| 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 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 // The live registers are: | 589 // The live registers are: |
| 590 // o rdi: the JS function object being called | 590 // o rdi: the JS function object being called |
| 591 // o rdx: the new target | 591 // o rdx: the new target |
| 592 // o rsi: our context | 592 // o rsi: our context |
| 593 // o rbp: the caller's frame pointer | 593 // o rbp: the caller's frame pointer |
| 594 // o rsp: stack pointer (pointing to return address) | 594 // o rsp: stack pointer (pointing to return address) |
| 595 // | 595 // |
| 596 // The function builds an interpreter frame. See InterpreterFrameConstants in | 596 // The function builds an interpreter frame. See InterpreterFrameConstants in |
| 597 // frames.h for its layout. | 597 // frames.h for its layout. |
| 598 void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) { | 598 void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) { |
| 599 ProfileEntryHookStub::MaybeCallEntryHook(masm); |
| 600 |
| 599 // Open a frame scope to indicate that there is a frame on the stack. The | 601 // Open a frame scope to indicate that there is a frame on the stack. The |
| 600 // MANUAL indicates that the scope shouldn't actually generate code to set up | 602 // MANUAL indicates that the scope shouldn't actually generate code to set up |
| 601 // the frame (that is done below). | 603 // the frame (that is done below). |
| 602 FrameScope frame_scope(masm, StackFrame::MANUAL); | 604 FrameScope frame_scope(masm, StackFrame::MANUAL); |
| 603 __ pushq(rbp); // Caller's frame pointer. | 605 __ pushq(rbp); // Caller's frame pointer. |
| 604 __ movp(rbp, rsp); | 606 __ movp(rbp, rsp); |
| 605 __ Push(rsi); // Callee's context. | 607 __ Push(rsi); // Callee's context. |
| 606 __ Push(rdi); // Callee's JS function. | 608 __ Push(rdi); // Callee's JS function. |
| 607 __ Push(rdx); // Callee's new target. | 609 __ Push(rdx); // Callee's new target. |
| 608 | 610 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 654 __ j(always, &loop_check); | 656 __ j(always, &loop_check); |
| 655 __ bind(&loop_header); | 657 __ bind(&loop_header); |
| 656 // TODO(rmcilroy): Consider doing more than one push per loop iteration. | 658 // TODO(rmcilroy): Consider doing more than one push per loop iteration. |
| 657 __ Push(rdx); | 659 __ Push(rdx); |
| 658 // Continue loop if not done. | 660 // Continue loop if not done. |
| 659 __ bind(&loop_check); | 661 __ bind(&loop_check); |
| 660 __ subp(rcx, Immediate(kPointerSize)); | 662 __ subp(rcx, Immediate(kPointerSize)); |
| 661 __ j(greater_equal, &loop_header, Label::kNear); | 663 __ j(greater_equal, &loop_header, Label::kNear); |
| 662 } | 664 } |
| 663 | 665 |
| 664 // TODO(rmcilroy): List of things not currently dealt with here but done in | |
| 665 // fullcodegen's prologue: | |
| 666 // - Call ProfileEntryHookStub when isolate has a function_entry_hook. | |
| 667 // - Code aging of the BytecodeArray object. | |
| 668 | |
| 669 // Load accumulator, register file, bytecode offset, dispatch table into | 666 // Load accumulator, register file, bytecode offset, dispatch table into |
| 670 // registers. | 667 // registers. |
| 671 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex); | 668 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex); |
| 672 __ movp(kInterpreterRegisterFileRegister, rbp); | 669 __ movp(kInterpreterRegisterFileRegister, rbp); |
| 673 __ addp(kInterpreterRegisterFileRegister, | 670 __ addp(kInterpreterRegisterFileRegister, |
| 674 Immediate(InterpreterFrameConstants::kRegisterFilePointerFromFp)); | 671 Immediate(InterpreterFrameConstants::kRegisterFilePointerFromFp)); |
| 675 __ movp(kInterpreterBytecodeOffsetRegister, | 672 __ movp(kInterpreterBytecodeOffsetRegister, |
| 676 Immediate(BytecodeArray::kHeaderSize - kHeapObjectTag)); | 673 Immediate(BytecodeArray::kHeaderSize - kHeapObjectTag)); |
| 677 __ Move( | 674 __ Move( |
| 678 kInterpreterDispatchTableRegister, | 675 kInterpreterDispatchTableRegister, |
| (...skipping 2240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2919 __ ret(0); | 2916 __ ret(0); |
| 2920 } | 2917 } |
| 2921 | 2918 |
| 2922 | 2919 |
| 2923 #undef __ | 2920 #undef __ |
| 2924 | 2921 |
| 2925 } // namespace internal | 2922 } // namespace internal |
| 2926 } // namespace v8 | 2923 } // namespace v8 |
| 2927 | 2924 |
| 2928 #endif // V8_TARGET_ARCH_X64 | 2925 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |