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 938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
949 | 949 |
950 // Throw stack overflow exception. | 950 // Throw stack overflow exception. |
951 __ bind(&stack_overflow); | 951 __ bind(&stack_overflow); |
952 { | 952 { |
953 __ TailCallRuntime(Runtime::kThrowStackOverflow); | 953 __ TailCallRuntime(Runtime::kThrowStackOverflow); |
954 // This should be unreachable. | 954 // This should be unreachable. |
955 __ int3(); | 955 __ int3(); |
956 } | 956 } |
957 } | 957 } |
958 | 958 |
959 void Builtins::Generate_InterpreterEnterBytecodeDispatch(MacroAssembler* masm) { | 959 static void Generate_InterpreterEnterBytecode(MacroAssembler* masm) { |
960 // Set the return address to the correct point in the interpreter entry | 960 // Set the return address to the correct point in the interpreter entry |
961 // trampoline. | 961 // trampoline. |
962 Smi* interpreter_entry_return_pc_offset( | 962 Smi* interpreter_entry_return_pc_offset( |
963 masm->isolate()->heap()->interpreter_entry_return_pc_offset()); | 963 masm->isolate()->heap()->interpreter_entry_return_pc_offset()); |
964 DCHECK_NE(interpreter_entry_return_pc_offset, Smi::kZero); | 964 DCHECK_NE(interpreter_entry_return_pc_offset, Smi::kZero); |
965 __ Move(rbx, masm->isolate()->builtins()->InterpreterEntryTrampoline()); | 965 __ Move(rbx, masm->isolate()->builtins()->InterpreterEntryTrampoline()); |
966 __ addp(rbx, Immediate(interpreter_entry_return_pc_offset->value() + | 966 __ addp(rbx, Immediate(interpreter_entry_return_pc_offset->value() + |
967 Code::kHeaderSize - kHeapObjectTag)); | 967 Code::kHeaderSize - kHeapObjectTag)); |
968 __ Push(rbx); | 968 __ Push(rbx); |
969 | 969 |
(...skipping 21 matching lines...) Expand all Loading... |
991 kInterpreterBytecodeOffsetRegister); | 991 kInterpreterBytecodeOffsetRegister); |
992 | 992 |
993 // Dispatch to the target bytecode. | 993 // Dispatch to the target bytecode. |
994 __ movzxbp(rbx, Operand(kInterpreterBytecodeArrayRegister, | 994 __ movzxbp(rbx, Operand(kInterpreterBytecodeArrayRegister, |
995 kInterpreterBytecodeOffsetRegister, times_1, 0)); | 995 kInterpreterBytecodeOffsetRegister, times_1, 0)); |
996 __ movp(rbx, Operand(kInterpreterDispatchTableRegister, rbx, | 996 __ movp(rbx, Operand(kInterpreterDispatchTableRegister, rbx, |
997 times_pointer_size, 0)); | 997 times_pointer_size, 0)); |
998 __ jmp(rbx); | 998 __ jmp(rbx); |
999 } | 999 } |
1000 | 1000 |
| 1001 void Builtins::Generate_InterpreterEnterBytecodeAdvance(MacroAssembler* masm) { |
| 1002 // Advance the current bytecode offset stored within the given interpreter |
| 1003 // stack frame. This simulates what all bytecode handlers do upon completion |
| 1004 // of the underlying operation. |
| 1005 __ movp(rbx, Operand(rbp, InterpreterFrameConstants::kBytecodeArrayFromFp)); |
| 1006 __ movp(rdx, Operand(rbp, InterpreterFrameConstants::kBytecodeOffsetFromFp)); |
| 1007 __ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); |
| 1008 { |
| 1009 FrameScope scope(masm, StackFrame::INTERNAL); |
| 1010 __ Push(kInterpreterAccumulatorRegister); |
| 1011 __ Push(rbx); // First argument is the bytecode array. |
| 1012 __ Push(rdx); // Second argument is the bytecode offset. |
| 1013 __ CallRuntime(Runtime::kInterpreterAdvanceBytecodeOffset); |
| 1014 __ Move(rdx, rax); // Result is the new bytecode offset. |
| 1015 __ Pop(kInterpreterAccumulatorRegister); |
| 1016 } |
| 1017 __ movp(Operand(rbp, InterpreterFrameConstants::kBytecodeOffsetFromFp), rdx); |
| 1018 |
| 1019 Generate_InterpreterEnterBytecode(masm); |
| 1020 } |
| 1021 |
| 1022 void Builtins::Generate_InterpreterEnterBytecodeDispatch(MacroAssembler* masm) { |
| 1023 Generate_InterpreterEnterBytecode(masm); |
| 1024 } |
| 1025 |
1001 void Builtins::Generate_CompileLazy(MacroAssembler* masm) { | 1026 void Builtins::Generate_CompileLazy(MacroAssembler* masm) { |
1002 // ----------- S t a t e ------------- | 1027 // ----------- S t a t e ------------- |
1003 // -- rax : argument count (preserved for callee) | 1028 // -- rax : argument count (preserved for callee) |
1004 // -- rdx : new target (preserved for callee) | 1029 // -- rdx : new target (preserved for callee) |
1005 // -- rdi : target function (preserved for callee) | 1030 // -- rdi : target function (preserved for callee) |
1006 // ----------------------------------- | 1031 // ----------------------------------- |
1007 // First lookup code, maybe we don't need to compile! | 1032 // First lookup code, maybe we don't need to compile! |
1008 Label gotta_call_runtime; | 1033 Label gotta_call_runtime; |
1009 Label try_shared; | 1034 Label try_shared; |
1010 Label loop_top, loop_bottom; | 1035 Label loop_top, loop_bottom; |
(...skipping 2041 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3052 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { | 3077 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { |
3053 Generate_OnStackReplacementHelper(masm, true); | 3078 Generate_OnStackReplacementHelper(masm, true); |
3054 } | 3079 } |
3055 | 3080 |
3056 #undef __ | 3081 #undef __ |
3057 | 3082 |
3058 } // namespace internal | 3083 } // namespace internal |
3059 } // namespace v8 | 3084 } // namespace v8 |
3060 | 3085 |
3061 #endif // V8_TARGET_ARCH_X64 | 3086 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |