| 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 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 FrameScope frame_scope(masm, StackFrame::MANUAL); | 487 FrameScope frame_scope(masm, StackFrame::MANUAL); |
| 488 __ pushq(rbp); // Caller's frame pointer. | 488 __ pushq(rbp); // Caller's frame pointer. |
| 489 __ movp(rbp, rsp); | 489 __ movp(rbp, rsp); |
| 490 __ Push(rsi); // Callee's context. | 490 __ Push(rsi); // Callee's context. |
| 491 __ Push(rdi); // Callee's JS function. | 491 __ Push(rdi); // Callee's JS function. |
| 492 __ Push(rdx); // Callee's new target. | 492 __ Push(rdx); // Callee's new target. |
| 493 | 493 |
| 494 // Get the bytecode array from the function object and load the pointer to the | 494 // Get the bytecode array from the function object and load the pointer to the |
| 495 // first entry into edi (InterpreterBytecodeRegister). | 495 // first entry into edi (InterpreterBytecodeRegister). |
| 496 __ movp(rax, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset)); | 496 __ movp(rax, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset)); |
| 497 |
| 498 Label load_debug_bytecode_array, bytecode_array_loaded; |
| 499 DCHECK_EQ(Smi::FromInt(0), DebugInfo::uninitialized()); |
| 500 __ cmpp(FieldOperand(rax, SharedFunctionInfo::kDebugInfoOffset), |
| 501 Immediate(0)); |
| 502 __ j(not_equal, &load_debug_bytecode_array); |
| 497 __ movp(kInterpreterBytecodeArrayRegister, | 503 __ movp(kInterpreterBytecodeArrayRegister, |
| 498 FieldOperand(rax, SharedFunctionInfo::kFunctionDataOffset)); | 504 FieldOperand(rax, SharedFunctionInfo::kFunctionDataOffset)); |
| 505 __ bind(&bytecode_array_loaded); |
| 499 | 506 |
| 500 if (FLAG_debug_code) { | 507 if (FLAG_debug_code) { |
| 501 // Check function data field is actually a BytecodeArray object. | 508 // Check function data field is actually a BytecodeArray object. |
| 502 __ AssertNotSmi(kInterpreterBytecodeArrayRegister); | 509 __ AssertNotSmi(kInterpreterBytecodeArrayRegister); |
| 503 __ CmpObjectType(kInterpreterBytecodeArrayRegister, BYTECODE_ARRAY_TYPE, | 510 __ CmpObjectType(kInterpreterBytecodeArrayRegister, BYTECODE_ARRAY_TYPE, |
| 504 rax); | 511 rax); |
| 505 __ Assert(equal, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); | 512 __ Assert(equal, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); |
| 506 } | 513 } |
| 507 | 514 |
| 508 // Push bytecode array. | 515 // Push bytecode array. |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 kInterpreterBytecodeOffsetRegister, times_1, 0)); | 568 kInterpreterBytecodeOffsetRegister, times_1, 0)); |
| 562 __ movp(rbx, Operand(kInterpreterDispatchTableRegister, rbx, | 569 __ movp(rbx, Operand(kInterpreterDispatchTableRegister, rbx, |
| 563 times_pointer_size, 0)); | 570 times_pointer_size, 0)); |
| 564 // TODO(rmcilroy): Make dispatch table point to code entrys to avoid untagging | 571 // TODO(rmcilroy): Make dispatch table point to code entrys to avoid untagging |
| 565 // and header removal. | 572 // and header removal. |
| 566 __ addp(rbx, Immediate(Code::kHeaderSize - kHeapObjectTag)); | 573 __ addp(rbx, Immediate(Code::kHeaderSize - kHeapObjectTag)); |
| 567 __ call(rbx); | 574 __ call(rbx); |
| 568 | 575 |
| 569 // Even though the first bytecode handler was called, we will never return. | 576 // Even though the first bytecode handler was called, we will never return. |
| 570 __ Abort(kUnexpectedReturnFromBytecodeHandler); | 577 __ Abort(kUnexpectedReturnFromBytecodeHandler); |
| 578 |
| 579 // Load debug copy of the bytecode array. |
| 580 __ bind(&load_debug_bytecode_array); |
| 581 Register debug_info = kInterpreterBytecodeArrayRegister; |
| 582 __ movp(debug_info, FieldOperand(rax, SharedFunctionInfo::kDebugInfoOffset)); |
| 583 __ movp(kInterpreterBytecodeArrayRegister, |
| 584 FieldOperand(debug_info, DebugInfo::kAbstractCodeIndex)); |
| 585 __ jmp(&bytecode_array_loaded); |
| 571 } | 586 } |
| 572 | 587 |
| 573 | 588 |
| 574 void Builtins::Generate_InterpreterExitTrampoline(MacroAssembler* masm) { | 589 void Builtins::Generate_InterpreterExitTrampoline(MacroAssembler* masm) { |
| 575 // TODO(rmcilroy): List of things not currently dealt with here but done in | 590 // TODO(rmcilroy): List of things not currently dealt with here but done in |
| 576 // fullcodegen's EmitReturnSequence. | 591 // fullcodegen's EmitReturnSequence. |
| 577 // - Supporting FLAG_trace for Runtime::TraceExit. | 592 // - Supporting FLAG_trace for Runtime::TraceExit. |
| 578 // - Support profiler (specifically decrementing profiling_counter | 593 // - Support profiler (specifically decrementing profiling_counter |
| 579 // appropriately and calling out to HandleInterrupts if necessary). | 594 // appropriately and calling out to HandleInterrupts if necessary). |
| 580 | 595 |
| (...skipping 2145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2726 __ ret(0); | 2741 __ ret(0); |
| 2727 } | 2742 } |
| 2728 | 2743 |
| 2729 | 2744 |
| 2730 #undef __ | 2745 #undef __ |
| 2731 | 2746 |
| 2732 } // namespace internal | 2747 } // namespace internal |
| 2733 } // namespace v8 | 2748 } // namespace v8 |
| 2734 | 2749 |
| 2735 #endif // V8_TARGET_ARCH_X64 | 2750 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |