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 __ Pushad(); |
| 1006 __ movp(arg_reg_1, |
| 1007 Operand(rbp, InterpreterFrameConstants::kBytecodeArrayFromFp)); |
| 1008 __ movp(arg_reg_2, |
| 1009 Operand(rbp, InterpreterFrameConstants::kBytecodeOffsetFromFp)); |
| 1010 __ SmiToInteger32(arg_reg_2, arg_reg_2); |
| 1011 { // NOLINT |
| 1012 FrameScope scope(masm, StackFrame::MANUAL); |
| 1013 __ PrepareCallCFunction(2); |
| 1014 __ CallCFunction( |
| 1015 ExternalReference::interpreter_advance_bytecode_offset(masm->isolate()), |
| 1016 2); |
| 1017 } |
| 1018 __ Integer32ToSmi(rax, rax); |
| 1019 __ movp(Operand(rbp, InterpreterFrameConstants::kBytecodeOffsetFromFp), rax); |
| 1020 __ Popad(); |
| 1021 |
| 1022 Generate_InterpreterEnterBytecode(masm); |
| 1023 } |
| 1024 |
| 1025 void Builtins::Generate_InterpreterEnterBytecodeDispatch(MacroAssembler* masm) { |
| 1026 Generate_InterpreterEnterBytecode(masm); |
| 1027 } |
| 1028 |
1001 void Builtins::Generate_CompileLazy(MacroAssembler* masm) { | 1029 void Builtins::Generate_CompileLazy(MacroAssembler* masm) { |
1002 // ----------- S t a t e ------------- | 1030 // ----------- S t a t e ------------- |
1003 // -- rax : argument count (preserved for callee) | 1031 // -- rax : argument count (preserved for callee) |
1004 // -- rdx : new target (preserved for callee) | 1032 // -- rdx : new target (preserved for callee) |
1005 // -- rdi : target function (preserved for callee) | 1033 // -- rdi : target function (preserved for callee) |
1006 // ----------------------------------- | 1034 // ----------------------------------- |
1007 // First lookup code, maybe we don't need to compile! | 1035 // First lookup code, maybe we don't need to compile! |
1008 Label gotta_call_runtime; | 1036 Label gotta_call_runtime; |
1009 Label try_shared; | 1037 Label try_shared; |
1010 Label loop_top, loop_bottom; | 1038 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) { | 3080 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { |
3053 Generate_OnStackReplacementHelper(masm, true); | 3081 Generate_OnStackReplacementHelper(masm, true); |
3054 } | 3082 } |
3055 | 3083 |
3056 #undef __ | 3084 #undef __ |
3057 | 3085 |
3058 } // namespace internal | 3086 } // namespace internal |
3059 } // namespace v8 | 3087 } // namespace v8 |
3060 | 3088 |
3061 #endif // V8_TARGET_ARCH_X64 | 3089 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |