Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(898)

Side by Side Diff: src/x64/builtins-x64.cc

Issue 1642063002: [interpreter] Add a safety-net for interpreter entry. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comment. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/ppc/builtins-ppc.cc ('k') | src/x87/builtins-x87.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 586 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 // stack left to right. The actual argument count matches the formal parameter 597 // stack left to right. The actual argument count matches the formal parameter
598 // count expected by the function. 598 // count expected by the function.
599 // 599 //
600 // The live registers are: 600 // The live registers are:
601 // o rdi: the JS function object being called 601 // o rdi: the JS function object being called
602 // o rdx: the new target 602 // o rdx: the new target
603 // o rsi: our context 603 // o rsi: our context
604 // o rbp: the caller's frame pointer 604 // o rbp: the caller's frame pointer
605 // o rsp: stack pointer (pointing to return address) 605 // o rsp: stack pointer (pointing to return address)
606 // 606 //
607 // The function builds a JS frame. Please see JavaScriptFrameConstants in 607 // The function builds an interpreter frame. See InterpreterFrameConstants in
608 // frames-x64.h for its layout. 608 // frames.h for its layout.
609 // TODO(rmcilroy): We will need to include the current bytecode pointer in the
610 // frame.
611 void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) { 609 void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
612 // Open a frame scope to indicate that there is a frame on the stack. The 610 // Open a frame scope to indicate that there is a frame on the stack. The
613 // MANUAL indicates that the scope shouldn't actually generate code to set up 611 // MANUAL indicates that the scope shouldn't actually generate code to set up
614 // the frame (that is done below). 612 // the frame (that is done below).
615 FrameScope frame_scope(masm, StackFrame::MANUAL); 613 FrameScope frame_scope(masm, StackFrame::MANUAL);
616 __ pushq(rbp); // Caller's frame pointer. 614 __ pushq(rbp); // Caller's frame pointer.
617 __ movp(rbp, rsp); 615 __ movp(rbp, rsp);
618 __ Push(rsi); // Callee's context. 616 __ Push(rsi); // Callee's context.
619 __ Push(rdi); // Callee's JS function. 617 __ Push(rdi); // Callee's JS function.
620 __ Push(rdx); // Callee's new target. 618 __ Push(rdx); // Callee's new target.
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 696
699 // Dispatch to the first bytecode handler for the function. 697 // Dispatch to the first bytecode handler for the function.
700 __ movzxbp(rbx, Operand(kInterpreterBytecodeArrayRegister, 698 __ movzxbp(rbx, Operand(kInterpreterBytecodeArrayRegister,
701 kInterpreterBytecodeOffsetRegister, times_1, 0)); 699 kInterpreterBytecodeOffsetRegister, times_1, 0));
702 __ movp(rbx, Operand(kInterpreterDispatchTableRegister, rbx, 700 __ movp(rbx, Operand(kInterpreterDispatchTableRegister, rbx,
703 times_pointer_size, 0)); 701 times_pointer_size, 0));
704 // TODO(rmcilroy): Make dispatch table point to code entrys to avoid untagging 702 // TODO(rmcilroy): Make dispatch table point to code entrys to avoid untagging
705 // and header removal. 703 // and header removal.
706 __ addp(rbx, Immediate(Code::kHeaderSize - kHeapObjectTag)); 704 __ addp(rbx, Immediate(Code::kHeaderSize - kHeapObjectTag));
707 __ call(rbx); 705 __ call(rbx);
706
707 // Even though the first bytecode handler was called, we will never return.
708 __ Abort(kUnexpectedReturnFromBytecodeHandler);
708 } 709 }
709 710
710 711
711 void Builtins::Generate_InterpreterExitTrampoline(MacroAssembler* masm) { 712 void Builtins::Generate_InterpreterExitTrampoline(MacroAssembler* masm) {
712 // TODO(rmcilroy): List of things not currently dealt with here but done in 713 // TODO(rmcilroy): List of things not currently dealt with here but done in
713 // fullcodegen's EmitReturnSequence. 714 // fullcodegen's EmitReturnSequence.
714 // - Supporting FLAG_trace for Runtime::TraceExit. 715 // - Supporting FLAG_trace for Runtime::TraceExit.
715 // - Support profiler (specifically decrementing profiling_counter 716 // - Support profiler (specifically decrementing profiling_counter
716 // appropriately and calling out to HandleInterrupts if necessary). 717 // appropriately and calling out to HandleInterrupts if necessary).
717 718
(...skipping 2034 matching lines...) Expand 10 before | Expand all | Expand 10 after
2752 __ ret(0); 2753 __ ret(0);
2753 } 2754 }
2754 2755
2755 2756
2756 #undef __ 2757 #undef __
2757 2758
2758 } // namespace internal 2759 } // namespace internal
2759 } // namespace v8 2760 } // namespace v8
2760 2761
2761 #endif // V8_TARGET_ARCH_X64 2762 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/ppc/builtins-ppc.cc ('k') | src/x87/builtins-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698