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_X87 | 5 #if V8_TARGET_ARCH_X87 |
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 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 // stack left to right. The actual argument count matches the formal parameter | 526 // stack left to right. The actual argument count matches the formal parameter |
527 // count expected by the function. | 527 // count expected by the function. |
528 // | 528 // |
529 // The live registers are: | 529 // The live registers are: |
530 // o edi: the JS function object being called | 530 // o edi: the JS function object being called |
531 // o edx: the new target | 531 // o edx: the new target |
532 // o esi: our context | 532 // o esi: our context |
533 // o ebp: the caller's frame pointer | 533 // o ebp: the caller's frame pointer |
534 // o esp: stack pointer (pointing to return address) | 534 // o esp: stack pointer (pointing to return address) |
535 // | 535 // |
536 // The function builds a JS frame. Please see JavaScriptFrameConstants in | 536 // The function builds an interpreter frame. See InterpreterFrameConstants in |
537 // frames-ia32.h for its layout. | 537 // frames.h for its layout. |
538 // TODO(rmcilroy): We will need to include the current bytecode pointer in the | |
539 // frame. | |
540 void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) { | 538 void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) { |
541 // Open a frame scope to indicate that there is a frame on the stack. The | 539 // Open a frame scope to indicate that there is a frame on the stack. The |
542 // MANUAL indicates that the scope shouldn't actually generate code to set up | 540 // MANUAL indicates that the scope shouldn't actually generate code to set up |
543 // the frame (that is done below). | 541 // the frame (that is done below). |
544 FrameScope frame_scope(masm, StackFrame::MANUAL); | 542 FrameScope frame_scope(masm, StackFrame::MANUAL); |
545 __ push(ebp); // Caller's frame pointer. | 543 __ push(ebp); // Caller's frame pointer. |
546 __ mov(ebp, esp); | 544 __ mov(ebp, esp); |
547 __ push(esi); // Callee's context. | 545 __ push(esi); // Callee's context. |
548 __ push(edi); // Callee's JS function. | 546 __ push(edi); // Callee's JS function. |
549 __ push(edx); // Callee's new target. | 547 __ push(edx); // Callee's new target. |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
638 kInterpreterBytecodeOffsetRegister, times_1, 0)); | 636 kInterpreterBytecodeOffsetRegister, times_1, 0)); |
639 __ mov(ebx, Operand(ebx, eax, times_pointer_size, 0)); | 637 __ mov(ebx, Operand(ebx, eax, times_pointer_size, 0)); |
640 // Restore undefined_value in accumulator (eax) | 638 // Restore undefined_value in accumulator (eax) |
641 // TODO(rmcilroy): Remove this once we move the dispatch table back into a | 639 // TODO(rmcilroy): Remove this once we move the dispatch table back into a |
642 // register. | 640 // register. |
643 __ mov(eax, Immediate(masm->isolate()->factory()->undefined_value())); | 641 __ mov(eax, Immediate(masm->isolate()->factory()->undefined_value())); |
644 // TODO(rmcilroy): Make dispatch table point to code entrys to avoid untagging | 642 // TODO(rmcilroy): Make dispatch table point to code entrys to avoid untagging |
645 // and header removal. | 643 // and header removal. |
646 __ add(ebx, Immediate(Code::kHeaderSize - kHeapObjectTag)); | 644 __ add(ebx, Immediate(Code::kHeaderSize - kHeapObjectTag)); |
647 __ call(ebx); | 645 __ call(ebx); |
648 __ nop(); // Ensure that return address still counts as interpreter entry | 646 |
649 // trampoline. | 647 // Even though the first bytecode handler was called, we will never return. |
| 648 __ Abort(kUnexpectedReturnFromBytecodeHandler); |
650 } | 649 } |
651 | 650 |
652 | 651 |
653 void Builtins::Generate_InterpreterExitTrampoline(MacroAssembler* masm) { | 652 void Builtins::Generate_InterpreterExitTrampoline(MacroAssembler* masm) { |
654 // TODO(rmcilroy): List of things not currently dealt with here but done in | 653 // TODO(rmcilroy): List of things not currently dealt with here but done in |
655 // fullcodegen's EmitReturnSequence. | 654 // fullcodegen's EmitReturnSequence. |
656 // - Supporting FLAG_trace for Runtime::TraceExit. | 655 // - Supporting FLAG_trace for Runtime::TraceExit. |
657 // - Support profiler (specifically decrementing profiling_counter | 656 // - Support profiler (specifically decrementing profiling_counter |
658 // appropriately and calling out to HandleInterrupts if necessary). | 657 // appropriately and calling out to HandleInterrupts if necessary). |
659 | 658 |
(...skipping 2023 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2683 | 2682 |
2684 __ bind(&ok); | 2683 __ bind(&ok); |
2685 __ ret(0); | 2684 __ ret(0); |
2686 } | 2685 } |
2687 | 2686 |
2688 #undef __ | 2687 #undef __ |
2689 } // namespace internal | 2688 } // namespace internal |
2690 } // namespace v8 | 2689 } // namespace v8 |
2691 | 2690 |
2692 #endif // V8_TARGET_ARCH_X87 | 2691 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |