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 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 } | 525 } |
526 | 526 |
527 | 527 |
528 // Generate code for entering a JS function with the interpreter. | 528 // Generate code for entering a JS function with the interpreter. |
529 // On entry to the function the receiver and arguments have been pushed on the | 529 // On entry to the function the receiver and arguments have been pushed on the |
530 // stack left to right. The actual argument count matches the formal parameter | 530 // stack left to right. The actual argument count matches the formal parameter |
531 // count expected by the function. | 531 // count expected by the function. |
532 // | 532 // |
533 // The live registers are: | 533 // The live registers are: |
534 // o edi: the JS function object being called | 534 // o edi: the JS function object being called |
| 535 // o edx: the new target |
535 // o esi: our context | 536 // o esi: our context |
536 // o ebp: the caller's frame pointer | 537 // o ebp: the caller's frame pointer |
537 // o esp: stack pointer (pointing to return address) | 538 // o esp: stack pointer (pointing to return address) |
538 // | 539 // |
539 // The function builds a JS frame. Please see JavaScriptFrameConstants in | 540 // The function builds a JS frame. Please see JavaScriptFrameConstants in |
540 // frames-ia32.h for its layout. | 541 // frames-ia32.h for its layout. |
541 // TODO(rmcilroy): We will need to include the current bytecode pointer in the | 542 // TODO(rmcilroy): We will need to include the current bytecode pointer in the |
542 // frame. | 543 // frame. |
543 void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) { | 544 void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) { |
544 // Open a frame scope to indicate that there is a frame on the stack. The | 545 // Open a frame scope to indicate that there is a frame on the stack. The |
545 // MANUAL indicates that the scope shouldn't actually generate code to set up | 546 // MANUAL indicates that the scope shouldn't actually generate code to set up |
546 // the frame (that is done below). | 547 // the frame (that is done below). |
547 FrameScope frame_scope(masm, StackFrame::MANUAL); | 548 FrameScope frame_scope(masm, StackFrame::MANUAL); |
548 __ push(ebp); // Caller's frame pointer. | 549 __ push(ebp); // Caller's frame pointer. |
549 __ mov(ebp, esp); | 550 __ mov(ebp, esp); |
550 __ push(esi); // Callee's context. | 551 __ push(esi); // Callee's context. |
551 __ push(edi); // Callee's JS function. | 552 __ push(edi); // Callee's JS function. |
| 553 __ push(edx); // Callee's new target. |
552 | 554 |
553 // Get the bytecode array from the function object and load the pointer to the | 555 // Get the bytecode array from the function object and load the pointer to the |
554 // first entry into edi (InterpreterBytecodeRegister). | 556 // first entry into edi (InterpreterBytecodeRegister). |
555 __ mov(eax, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); | 557 __ mov(eax, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); |
556 __ mov(kInterpreterBytecodeArrayRegister, | 558 __ mov(kInterpreterBytecodeArrayRegister, |
557 FieldOperand(eax, SharedFunctionInfo::kFunctionDataOffset)); | 559 FieldOperand(eax, SharedFunctionInfo::kFunctionDataOffset)); |
558 | 560 |
559 if (FLAG_debug_code) { | 561 if (FLAG_debug_code) { |
560 // Check function data field is actually a BytecodeArray object. | 562 // Check function data field is actually a BytecodeArray object. |
561 __ AssertNotSmi(kInterpreterBytecodeArrayRegister); | 563 __ AssertNotSmi(kInterpreterBytecodeArrayRegister); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
612 __ push(kInterpreterBytecodeArrayRegister); | 614 __ push(kInterpreterBytecodeArrayRegister); |
613 __ CallRuntime(Runtime::kStackGuard, 0); | 615 __ CallRuntime(Runtime::kStackGuard, 0); |
614 __ pop(kInterpreterBytecodeArrayRegister); | 616 __ pop(kInterpreterBytecodeArrayRegister); |
615 __ bind(&ok); | 617 __ bind(&ok); |
616 } | 618 } |
617 | 619 |
618 // Load accumulator, register file, bytecode offset, dispatch table into | 620 // Load accumulator, register file, bytecode offset, dispatch table into |
619 // registers. | 621 // registers. |
620 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex); | 622 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex); |
621 __ mov(kInterpreterRegisterFileRegister, ebp); | 623 __ mov(kInterpreterRegisterFileRegister, ebp); |
622 __ sub( | 624 __ sub(kInterpreterRegisterFileRegister, |
623 kInterpreterRegisterFileRegister, | 625 Immediate(2 * kPointerSize + |
624 Immediate(kPointerSize + StandardFrameConstants::kFixedFrameSizeFromFp)); | 626 StandardFrameConstants::kFixedFrameSizeFromFp)); |
625 __ mov(kInterpreterBytecodeOffsetRegister, | 627 __ mov(kInterpreterBytecodeOffsetRegister, |
626 Immediate(BytecodeArray::kHeaderSize - kHeapObjectTag)); | 628 Immediate(BytecodeArray::kHeaderSize - kHeapObjectTag)); |
627 // Since the dispatch table root might be set after builtins are generated, | 629 // Since the dispatch table root might be set after builtins are generated, |
628 // load directly from the roots table. | 630 // load directly from the roots table. |
629 __ LoadRoot(ebx, Heap::kInterpreterTableRootIndex); | 631 __ LoadRoot(ebx, Heap::kInterpreterTableRootIndex); |
630 __ add(ebx, Immediate(FixedArray::kHeaderSize - kHeapObjectTag)); | 632 __ add(ebx, Immediate(FixedArray::kHeaderSize - kHeapObjectTag)); |
631 | 633 |
632 // Push context as a stack located parameter to the bytecode handler. | 634 // Push context as a stack located parameter to the bytecode handler. |
633 DCHECK_EQ(-1, kInterpreterDispatchTableSpillSlot); | 635 DCHECK_EQ(-1, kInterpreterDispatchTableSpillSlot); |
634 __ push(ebx); | 636 __ push(ebx); |
(...skipping 1358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1993 | 1995 |
1994 __ bind(&ok); | 1996 __ bind(&ok); |
1995 __ ret(0); | 1997 __ ret(0); |
1996 } | 1998 } |
1997 | 1999 |
1998 #undef __ | 2000 #undef __ |
1999 } // namespace internal | 2001 } // namespace internal |
2000 } // namespace v8 | 2002 } // namespace v8 |
2001 | 2003 |
2002 #endif // V8_TARGET_ARCH_X87 | 2004 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |