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