OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_ARM64 | 5 #if V8_TARGET_ARCH_ARM64 |
6 | 6 |
7 #include "src/arm64/frames-arm64.h" | 7 #include "src/arm64/frames-arm64.h" |
8 #include "src/codegen.h" | 8 #include "src/codegen.h" |
9 #include "src/debug/debug.h" | 9 #include "src/debug/debug.h" |
10 #include "src/deoptimizer.h" | 10 #include "src/deoptimizer.h" |
(...skipping 978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
989 void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) { | 989 void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) { |
990 ProfileEntryHookStub::MaybeCallEntryHook(masm); | 990 ProfileEntryHookStub::MaybeCallEntryHook(masm); |
991 | 991 |
992 // Open a frame scope to indicate that there is a frame on the stack. The | 992 // Open a frame scope to indicate that there is a frame on the stack. The |
993 // MANUAL indicates that the scope shouldn't actually generate code to set up | 993 // MANUAL indicates that the scope shouldn't actually generate code to set up |
994 // the frame (that is done below). | 994 // the frame (that is done below). |
995 FrameScope frame_scope(masm, StackFrame::MANUAL); | 995 FrameScope frame_scope(masm, StackFrame::MANUAL); |
996 __ Push(lr, fp, cp, x1); | 996 __ Push(lr, fp, cp, x1); |
997 __ Add(fp, jssp, StandardFrameConstants::kFixedFrameSizeFromFp); | 997 __ Add(fp, jssp, StandardFrameConstants::kFixedFrameSizeFromFp); |
998 | 998 |
999 // Get the bytecode array from the function object and load the pointer to the | 999 // Get the bytecode array from the function object (or from the DebugInfo if |
1000 // first entry into kInterpreterBytecodeRegister. | 1000 // it is present) and load it into kInterpreterBytecodeArrayRegister. |
1001 __ Ldr(x0, FieldMemOperand(x1, JSFunction::kSharedFunctionInfoOffset)); | 1001 __ Ldr(x0, FieldMemOperand(x1, JSFunction::kSharedFunctionInfoOffset)); |
1002 Register debug_info = kInterpreterBytecodeArrayRegister; | 1002 Register debug_info = kInterpreterBytecodeArrayRegister; |
1003 Label load_debug_bytecode_array, bytecode_array_loaded; | 1003 Label load_debug_bytecode_array, bytecode_array_loaded; |
1004 DCHECK(!debug_info.is(x0)); | 1004 DCHECK(!debug_info.is(x0)); |
1005 __ Ldr(debug_info, FieldMemOperand(x0, SharedFunctionInfo::kDebugInfoOffset)); | 1005 __ Ldr(debug_info, FieldMemOperand(x0, SharedFunctionInfo::kDebugInfoOffset)); |
1006 __ Cmp(debug_info, Operand(DebugInfo::uninitialized())); | 1006 __ Cmp(debug_info, Operand(DebugInfo::uninitialized())); |
1007 __ B(ne, &load_debug_bytecode_array); | 1007 __ B(ne, &load_debug_bytecode_array); |
1008 __ Ldr(kInterpreterBytecodeArrayRegister, | 1008 __ Ldr(kInterpreterBytecodeArrayRegister, |
1009 FieldMemOperand(x0, SharedFunctionInfo::kFunctionDataOffset)); | 1009 FieldMemOperand(x0, SharedFunctionInfo::kFunctionDataOffset)); |
1010 __ Bind(&bytecode_array_loaded); | 1010 __ Bind(&bytecode_array_loaded); |
1011 | 1011 |
| 1012 // Check function data field is actually a BytecodeArray object. |
| 1013 Label bytecode_array_not_present; |
| 1014 __ CompareRoot(kInterpreterBytecodeArrayRegister, |
| 1015 Heap::kUndefinedValueRootIndex); |
| 1016 __ B(eq, &bytecode_array_not_present); |
1012 if (FLAG_debug_code) { | 1017 if (FLAG_debug_code) { |
1013 // Check function data field is actually a BytecodeArray object. | |
1014 __ AssertNotSmi(kInterpreterBytecodeArrayRegister, | 1018 __ AssertNotSmi(kInterpreterBytecodeArrayRegister, |
1015 kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); | 1019 kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); |
1016 __ CompareObjectType(kInterpreterBytecodeArrayRegister, x0, x0, | 1020 __ CompareObjectType(kInterpreterBytecodeArrayRegister, x0, x0, |
1017 BYTECODE_ARRAY_TYPE); | 1021 BYTECODE_ARRAY_TYPE); |
1018 __ Assert(eq, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); | 1022 __ Assert(eq, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); |
1019 } | 1023 } |
1020 | 1024 |
1021 // Push new.target, bytecode array and zero for bytecode array offset. | 1025 // Push new.target, bytecode array and zero for bytecode array offset. |
1022 __ Mov(x0, Operand(0)); | 1026 __ Mov(x0, Operand(0)); |
1023 __ Push(x3, kInterpreterBytecodeArrayRegister, x0); | 1027 __ Push(x3, kInterpreterBytecodeArrayRegister, x0); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1067 __ Call(ip0); | 1071 __ Call(ip0); |
1068 | 1072 |
1069 // Even though the first bytecode handler was called, we will never return. | 1073 // Even though the first bytecode handler was called, we will never return. |
1070 __ Abort(kUnexpectedReturnFromBytecodeHandler); | 1074 __ Abort(kUnexpectedReturnFromBytecodeHandler); |
1071 | 1075 |
1072 // Load debug copy of the bytecode array. | 1076 // Load debug copy of the bytecode array. |
1073 __ Bind(&load_debug_bytecode_array); | 1077 __ Bind(&load_debug_bytecode_array); |
1074 __ Ldr(kInterpreterBytecodeArrayRegister, | 1078 __ Ldr(kInterpreterBytecodeArrayRegister, |
1075 FieldMemOperand(debug_info, DebugInfo::kAbstractCodeIndex)); | 1079 FieldMemOperand(debug_info, DebugInfo::kAbstractCodeIndex)); |
1076 __ B(&bytecode_array_loaded); | 1080 __ B(&bytecode_array_loaded); |
| 1081 |
| 1082 // If the bytecode array is no longer present, then the underlying function |
| 1083 // has been switched to a different kind of code and we heal the closure by |
| 1084 // switching the code entry field over to the new code object as well. |
| 1085 __ Bind(&bytecode_array_not_present); |
| 1086 __ LeaveFrame(StackFrame::JAVA_SCRIPT); |
| 1087 __ Ldr(x7, FieldMemOperand(x1, JSFunction::kSharedFunctionInfoOffset)); |
| 1088 __ Ldr(x7, FieldMemOperand(x7, SharedFunctionInfo::kCodeOffset)); |
| 1089 __ Add(x7, x7, Operand(Code::kHeaderSize - kHeapObjectTag)); |
| 1090 __ Str(x7, FieldMemOperand(x1, JSFunction::kCodeEntryOffset)); |
| 1091 __ RecordWriteCodeEntryField(x1, x7, x5); |
| 1092 __ Jump(x7); |
1077 } | 1093 } |
1078 | 1094 |
1079 | 1095 |
1080 void Builtins::Generate_InterpreterExitTrampoline(MacroAssembler* masm) { | 1096 void Builtins::Generate_InterpreterExitTrampoline(MacroAssembler* masm) { |
1081 // The return value is in accumulator, which is already in x0. | 1097 // The return value is in accumulator, which is already in x0. |
1082 | 1098 |
1083 // Leave the frame (also dropping the register file). | 1099 // Leave the frame (also dropping the register file). |
1084 __ LeaveFrame(StackFrame::JAVA_SCRIPT); | 1100 __ LeaveFrame(StackFrame::JAVA_SCRIPT); |
1085 | 1101 |
1086 // Drop receiver + arguments and return. | 1102 // Drop receiver + arguments and return. |
(...skipping 1799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2886 } | 2902 } |
2887 } | 2903 } |
2888 | 2904 |
2889 | 2905 |
2890 #undef __ | 2906 #undef __ |
2891 | 2907 |
2892 } // namespace internal | 2908 } // namespace internal |
2893 } // namespace v8 | 2909 } // namespace v8 |
2894 | 2910 |
2895 #endif // V8_TARGET_ARCH_ARM | 2911 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |