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 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1079 __ LoadP( | 1079 __ LoadP( |
1080 optimized_code_entry, | 1080 optimized_code_entry, |
1081 FieldMemOperand(r3, FeedbackVector::kOptimizedCodeIndex * kPointerSize + | 1081 FieldMemOperand(r3, FeedbackVector::kOptimizedCodeIndex * kPointerSize + |
1082 FeedbackVector::kHeaderSize)); | 1082 FeedbackVector::kHeaderSize)); |
1083 __ LoadP(optimized_code_entry, | 1083 __ LoadP(optimized_code_entry, |
1084 FieldMemOperand(optimized_code_entry, WeakCell::kValueOffset)); | 1084 FieldMemOperand(optimized_code_entry, WeakCell::kValueOffset)); |
1085 __ JumpIfNotSmi(optimized_code_entry, &switch_to_optimized_code); | 1085 __ JumpIfNotSmi(optimized_code_entry, &switch_to_optimized_code); |
1086 | 1086 |
1087 // Get the bytecode array from the function object (or from the DebugInfo if | 1087 // Get the bytecode array from the function object (or from the DebugInfo if |
1088 // it is present) and load it into kInterpreterBytecodeArrayRegister. | 1088 // it is present) and load it into kInterpreterBytecodeArrayRegister. |
| 1089 Label maybe_load_debug_bytecode_array, bytecode_array_loaded; |
1089 __ LoadP(r3, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); | 1090 __ LoadP(r3, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); |
1090 Label array_done; | |
1091 Register debug_info = r5; | |
1092 DCHECK(!debug_info.is(r3)); | |
1093 __ LoadP(debug_info, | |
1094 FieldMemOperand(r3, SharedFunctionInfo::kDebugInfoOffset)); | |
1095 // Load original bytecode array or the debug copy. | 1091 // Load original bytecode array or the debug copy. |
1096 __ LoadP(kInterpreterBytecodeArrayRegister, | 1092 __ LoadP(kInterpreterBytecodeArrayRegister, |
1097 FieldMemOperand(r3, SharedFunctionInfo::kFunctionDataOffset)); | 1093 FieldMemOperand(r3, SharedFunctionInfo::kFunctionDataOffset)); |
1098 __ TestIfSmi(debug_info, r0); | 1094 __ LoadP(r5, FieldMemOperand(r3, SharedFunctionInfo::kDebugInfoOffset)); |
1099 __ beq(&array_done, cr0); | 1095 __ TestIfSmi(r5, r0); |
1100 __ LoadP(kInterpreterBytecodeArrayRegister, | 1096 __ bne(&maybe_load_debug_bytecode_array, cr0); |
1101 FieldMemOperand(debug_info, DebugInfo::kDebugBytecodeArrayOffset)); | 1097 __ bind(&bytecode_array_loaded); |
1102 __ bind(&array_done); | |
1103 | 1098 |
1104 // Check whether we should continue to use the interpreter. | 1099 // Check whether we should continue to use the interpreter. |
1105 // TODO(rmcilroy) Remove self healing once liveedit only has to deal with | 1100 // TODO(rmcilroy) Remove self healing once liveedit only has to deal with |
1106 // Ignition bytecode. | 1101 // Ignition bytecode. |
1107 Label switch_to_different_code_kind; | 1102 Label switch_to_different_code_kind; |
1108 __ LoadP(r3, FieldMemOperand(r3, SharedFunctionInfo::kCodeOffset)); | 1103 __ LoadP(r3, FieldMemOperand(r3, SharedFunctionInfo::kCodeOffset)); |
1109 __ mov(ip, Operand(masm->CodeObject())); // Self-reference to this code. | 1104 __ mov(ip, Operand(masm->CodeObject())); // Self-reference to this code. |
1110 __ cmp(r3, ip); | 1105 __ cmp(r3, ip); |
1111 __ bne(&switch_to_different_code_kind); | 1106 __ bne(&switch_to_different_code_kind); |
1112 | 1107 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1186 __ ShiftLeftImm(ip, r4, Operand(kPointerSizeLog2)); | 1181 __ ShiftLeftImm(ip, r4, Operand(kPointerSizeLog2)); |
1187 __ LoadPX(ip, MemOperand(kInterpreterDispatchTableRegister, ip)); | 1182 __ LoadPX(ip, MemOperand(kInterpreterDispatchTableRegister, ip)); |
1188 __ Call(ip); | 1183 __ Call(ip); |
1189 | 1184 |
1190 masm->isolate()->heap()->SetInterpreterEntryReturnPCOffset(masm->pc_offset()); | 1185 masm->isolate()->heap()->SetInterpreterEntryReturnPCOffset(masm->pc_offset()); |
1191 | 1186 |
1192 // The return value is in r3. | 1187 // The return value is in r3. |
1193 LeaveInterpreterFrame(masm, r5); | 1188 LeaveInterpreterFrame(masm, r5); |
1194 __ blr(); | 1189 __ blr(); |
1195 | 1190 |
| 1191 // Load debug copy of the bytecode array if it exists. |
| 1192 // kInterpreterBytecodeArrayRegister is already loaded with |
| 1193 // SharedFunctionInfo::kFunctionDataOffset. |
| 1194 Label done; |
| 1195 __ bind(&maybe_load_debug_bytecode_array); |
| 1196 __ LoadP(ip, FieldMemOperand(r5, DebugInfo::kFlagsOffset)); |
| 1197 __ SmiUntag(ip); |
| 1198 __ andi(r0, ip, Operand(DebugInfo::kHasBreakInfo)); |
| 1199 __ beq(&done, cr0); |
| 1200 __ LoadP(kInterpreterBytecodeArrayRegister, |
| 1201 FieldMemOperand(r5, DebugInfo::kDebugBytecodeArrayOffset)); |
| 1202 __ bind(&done); |
| 1203 __ b(&bytecode_array_loaded); |
| 1204 |
1196 // If the shared code is no longer this entry trampoline, then the underlying | 1205 // If the shared code is no longer this entry trampoline, then the underlying |
1197 // function has been switched to a different kind of code and we heal the | 1206 // function has been switched to a different kind of code and we heal the |
1198 // closure by switching the code entry field over to the new code as well. | 1207 // closure by switching the code entry field over to the new code as well. |
1199 __ bind(&switch_to_different_code_kind); | 1208 __ bind(&switch_to_different_code_kind); |
1200 __ LeaveFrame(StackFrame::JAVA_SCRIPT); | 1209 __ LeaveFrame(StackFrame::JAVA_SCRIPT); |
1201 __ LoadP(r7, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); | 1210 __ LoadP(r7, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); |
1202 __ LoadP(r7, FieldMemOperand(r7, SharedFunctionInfo::kCodeOffset)); | 1211 __ LoadP(r7, FieldMemOperand(r7, SharedFunctionInfo::kCodeOffset)); |
1203 __ addi(r7, r7, Operand(Code::kHeaderSize - kHeapObjectTag)); | 1212 __ addi(r7, r7, Operand(Code::kHeaderSize - kHeapObjectTag)); |
1204 __ StoreP(r7, FieldMemOperand(r4, JSFunction::kCodeEntryOffset), r0); | 1213 __ StoreP(r7, FieldMemOperand(r4, JSFunction::kCodeEntryOffset), r0); |
1205 __ RecordWriteCodeEntryField(r4, r7, r8); | 1214 __ RecordWriteCodeEntryField(r4, r7, r8); |
(...skipping 1974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3180 } | 3189 } |
3181 // Now jump to the instructions of the returned code object. | 3190 // Now jump to the instructions of the returned code object. |
3182 __ Jump(r11); | 3191 __ Jump(r11); |
3183 } | 3192 } |
3184 | 3193 |
3185 #undef __ | 3194 #undef __ |
3186 } // namespace internal | 3195 } // namespace internal |
3187 } // namespace v8 | 3196 } // namespace v8 |
3188 | 3197 |
3189 #endif // V8_TARGET_ARCH_PPC | 3198 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |