OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_PPC | 5 #if V8_TARGET_ARCH_PPC |
6 | 6 |
7 #include "src/codegen.h" | 7 #include "src/codegen.h" |
8 #include "src/debug/debug.h" | 8 #include "src/debug/debug.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 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1070 FieldMemOperand(r3, SharedFunctionInfo::kDebugInfoOffset)); | 1070 FieldMemOperand(r3, SharedFunctionInfo::kDebugInfoOffset)); |
1071 // Load original bytecode array or the debug copy. | 1071 // Load original bytecode array or the debug copy. |
1072 __ LoadP(kInterpreterBytecodeArrayRegister, | 1072 __ LoadP(kInterpreterBytecodeArrayRegister, |
1073 FieldMemOperand(r3, SharedFunctionInfo::kFunctionDataOffset)); | 1073 FieldMemOperand(r3, SharedFunctionInfo::kFunctionDataOffset)); |
1074 __ CmpSmiLiteral(debug_info, DebugInfo::uninitialized(), r0); | 1074 __ CmpSmiLiteral(debug_info, DebugInfo::uninitialized(), r0); |
1075 __ beq(&array_done); | 1075 __ beq(&array_done); |
1076 __ LoadP(kInterpreterBytecodeArrayRegister, | 1076 __ LoadP(kInterpreterBytecodeArrayRegister, |
1077 FieldMemOperand(debug_info, DebugInfo::kDebugBytecodeArrayIndex)); | 1077 FieldMemOperand(debug_info, DebugInfo::kDebugBytecodeArrayIndex)); |
1078 __ bind(&array_done); | 1078 __ bind(&array_done); |
1079 | 1079 |
| 1080 // Check whether we should continue to use the interpreter. |
| 1081 Label switch_to_different_code_kind; |
| 1082 __ LoadP(r3, FieldMemOperand(r3, SharedFunctionInfo::kCodeOffset)); |
| 1083 __ mov(ip, Operand(masm->CodeObject())); // Self-reference to this code. |
| 1084 __ cmp(r3, ip); |
| 1085 __ bne(&switch_to_different_code_kind); |
| 1086 |
1080 // Check function data field is actually a BytecodeArray object. | 1087 // Check function data field is actually a BytecodeArray object. |
1081 Label bytecode_array_not_present; | |
1082 __ CompareRoot(kInterpreterBytecodeArrayRegister, | |
1083 Heap::kUndefinedValueRootIndex); | |
1084 __ beq(&bytecode_array_not_present); | |
1085 | 1088 |
1086 if (FLAG_debug_code) { | 1089 if (FLAG_debug_code) { |
1087 __ TestIfSmi(kInterpreterBytecodeArrayRegister, r0); | 1090 __ TestIfSmi(kInterpreterBytecodeArrayRegister, r0); |
1088 __ Assert(ne, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); | 1091 __ Assert(ne, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); |
1089 __ CompareObjectType(kInterpreterBytecodeArrayRegister, r3, no_reg, | 1092 __ CompareObjectType(kInterpreterBytecodeArrayRegister, r3, no_reg, |
1090 BYTECODE_ARRAY_TYPE); | 1093 BYTECODE_ARRAY_TYPE); |
1091 __ Assert(eq, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); | 1094 __ Assert(eq, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); |
1092 } | 1095 } |
1093 | 1096 |
1094 // Load initial bytecode offset. | 1097 // Load initial bytecode offset. |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1139 __ ShiftLeftImm(ip, r4, Operand(kPointerSizeLog2)); | 1142 __ ShiftLeftImm(ip, r4, Operand(kPointerSizeLog2)); |
1140 __ LoadPX(ip, MemOperand(kInterpreterDispatchTableRegister, ip)); | 1143 __ LoadPX(ip, MemOperand(kInterpreterDispatchTableRegister, ip)); |
1141 __ Call(ip); | 1144 __ Call(ip); |
1142 | 1145 |
1143 masm->isolate()->heap()->SetInterpreterEntryReturnPCOffset(masm->pc_offset()); | 1146 masm->isolate()->heap()->SetInterpreterEntryReturnPCOffset(masm->pc_offset()); |
1144 | 1147 |
1145 // The return value is in r3. | 1148 // The return value is in r3. |
1146 LeaveInterpreterFrame(masm, r5); | 1149 LeaveInterpreterFrame(masm, r5); |
1147 __ blr(); | 1150 __ blr(); |
1148 | 1151 |
1149 // If the bytecode array is no longer present, then the underlying function | 1152 // If the shared code is no longer this entry trampoline, then the underlying |
1150 // has been switched to a different kind of code and we heal the closure by | 1153 // function has been switched to a different kind of code and we heal the |
1151 // switching the code entry field over to the new code object as well. | 1154 // closure by switching the code entry field over to the new code as well. |
1152 __ bind(&bytecode_array_not_present); | 1155 __ bind(&switch_to_different_code_kind); |
1153 __ LeaveFrame(StackFrame::JAVA_SCRIPT); | 1156 __ LeaveFrame(StackFrame::JAVA_SCRIPT); |
1154 __ LoadP(r7, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); | 1157 __ LoadP(r7, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); |
1155 __ LoadP(r7, FieldMemOperand(r7, SharedFunctionInfo::kCodeOffset)); | 1158 __ LoadP(r7, FieldMemOperand(r7, SharedFunctionInfo::kCodeOffset)); |
1156 __ addi(r7, r7, Operand(Code::kHeaderSize - kHeapObjectTag)); | 1159 __ addi(r7, r7, Operand(Code::kHeaderSize - kHeapObjectTag)); |
1157 __ StoreP(r7, FieldMemOperand(r4, JSFunction::kCodeEntryOffset), r0); | 1160 __ StoreP(r7, FieldMemOperand(r4, JSFunction::kCodeEntryOffset), r0); |
1158 __ RecordWriteCodeEntryField(r4, r7, r8); | 1161 __ RecordWriteCodeEntryField(r4, r7, r8); |
1159 __ JumpToJSEntry(r7); | 1162 __ JumpToJSEntry(r7); |
1160 } | 1163 } |
1161 | 1164 |
1162 void Builtins::Generate_InterpreterMarkBaselineOnReturn(MacroAssembler* masm) { | 1165 void Builtins::Generate_InterpreterMarkBaselineOnReturn(MacroAssembler* masm) { |
(...skipping 1840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3003 __ CallRuntime(Runtime::kThrowStackOverflow); | 3006 __ CallRuntime(Runtime::kThrowStackOverflow); |
3004 __ bkpt(0); | 3007 __ bkpt(0); |
3005 } | 3008 } |
3006 } | 3009 } |
3007 | 3010 |
3008 #undef __ | 3011 #undef __ |
3009 } // namespace internal | 3012 } // namespace internal |
3010 } // namespace v8 | 3013 } // namespace v8 |
3011 | 3014 |
3012 #endif // V8_TARGET_ARCH_PPC | 3015 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |