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 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1041 __ cmpi(r3, Operand::Zero()); | 1041 __ cmpi(r3, Operand::Zero()); |
1042 __ beq(&skip); | 1042 __ beq(&skip); |
1043 Generate_InterpreterPushArgs(masm, r5, r3, r7); | 1043 Generate_InterpreterPushArgs(masm, r5, r3, r7); |
1044 __ bind(&skip); | 1044 __ bind(&skip); |
1045 | 1045 |
1046 // Call the constructor with r3, r4, and r6 unmodified. | 1046 // Call the constructor with r3, r4, and r6 unmodified. |
1047 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); | 1047 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); |
1048 } | 1048 } |
1049 | 1049 |
1050 | 1050 |
1051 static void Generate_InterpreterNotifyDeoptimizedHelper( | 1051 static void Generate_EnterBytecodeDispatch(MacroAssembler* masm) { |
1052 MacroAssembler* masm, Deoptimizer::BailoutType type) { | |
1053 // Enter an internal frame. | |
1054 { | |
1055 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); | |
1056 // Save accumulator register and pass the deoptimization type to | |
1057 // the runtime system. | |
1058 __ LoadSmiLiteral(r4, Smi::FromInt(static_cast<int>(type))); | |
1059 __ Push(kInterpreterAccumulatorRegister, r4); | |
1060 __ CallRuntime(Runtime::kNotifyDeoptimized); | |
1061 __ pop(kInterpreterAccumulatorRegister); // Restore accumulator register. | |
1062 // Tear down internal frame. | |
1063 } | |
1064 | |
1065 // Drop state (we don't use these for interpreter deopts). | |
1066 __ Drop(1); | |
1067 | |
1068 // Initialize register file register and dispatch table register. | 1052 // Initialize register file register and dispatch table register. |
1069 __ addi(kInterpreterRegisterFileRegister, fp, | 1053 __ addi(kInterpreterRegisterFileRegister, fp, |
1070 Operand(InterpreterFrameConstants::kRegisterFilePointerFromFp)); | 1054 Operand(InterpreterFrameConstants::kRegisterFilePointerFromFp)); |
1071 __ LoadRoot(kInterpreterDispatchTableRegister, | 1055 __ LoadRoot(kInterpreterDispatchTableRegister, |
1072 Heap::kInterpreterTableRootIndex); | 1056 Heap::kInterpreterTableRootIndex); |
1073 __ addi(kInterpreterDispatchTableRegister, kInterpreterDispatchTableRegister, | 1057 __ addi(kInterpreterDispatchTableRegister, kInterpreterDispatchTableRegister, |
1074 Operand(FixedArray::kHeaderSize - kHeapObjectTag)); | 1058 Operand(FixedArray::kHeaderSize - kHeapObjectTag)); |
1075 | 1059 |
1076 // Get the context from the frame. | 1060 // Get the context from the frame. |
1077 // TODO(rmcilroy): Update interpreter frame to expect current context at the | 1061 // TODO(rmcilroy): Update interpreter frame to expect current context at the |
(...skipping 29 matching lines...) Expand all Loading... |
1107 // Dispatch to the target bytecode. | 1091 // Dispatch to the target bytecode. |
1108 __ lbzx(r4, MemOperand(kInterpreterBytecodeArrayRegister, | 1092 __ lbzx(r4, MemOperand(kInterpreterBytecodeArrayRegister, |
1109 kInterpreterBytecodeOffsetRegister)); | 1093 kInterpreterBytecodeOffsetRegister)); |
1110 __ ShiftLeftImm(ip, r4, Operand(kPointerSizeLog2)); | 1094 __ ShiftLeftImm(ip, r4, Operand(kPointerSizeLog2)); |
1111 __ LoadPX(ip, MemOperand(kInterpreterDispatchTableRegister, ip)); | 1095 __ LoadPX(ip, MemOperand(kInterpreterDispatchTableRegister, ip)); |
1112 __ addi(ip, ip, Operand(Code::kHeaderSize - kHeapObjectTag)); | 1096 __ addi(ip, ip, Operand(Code::kHeaderSize - kHeapObjectTag)); |
1113 __ Jump(ip); | 1097 __ Jump(ip); |
1114 } | 1098 } |
1115 | 1099 |
1116 | 1100 |
| 1101 static void Generate_InterpreterNotifyDeoptimizedHelper( |
| 1102 MacroAssembler* masm, Deoptimizer::BailoutType type) { |
| 1103 // Enter an internal frame. |
| 1104 { |
| 1105 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
| 1106 // Save accumulator register and pass the deoptimization type to |
| 1107 // the runtime system. |
| 1108 __ LoadSmiLiteral(r4, Smi::FromInt(static_cast<int>(type))); |
| 1109 __ Push(kInterpreterAccumulatorRegister, r4); |
| 1110 __ CallRuntime(Runtime::kNotifyDeoptimized); |
| 1111 __ pop(kInterpreterAccumulatorRegister); // Restore accumulator register. |
| 1112 // Tear down internal frame. |
| 1113 } |
| 1114 |
| 1115 // Drop state (we don't use these for interpreter deopts). |
| 1116 __ Drop(1); |
| 1117 |
| 1118 // Enter the bytecode dispatch. |
| 1119 Generate_EnterBytecodeDispatch(masm); |
| 1120 } |
| 1121 |
| 1122 |
1117 void Builtins::Generate_InterpreterNotifyDeoptimized(MacroAssembler* masm) { | 1123 void Builtins::Generate_InterpreterNotifyDeoptimized(MacroAssembler* masm) { |
1118 Generate_InterpreterNotifyDeoptimizedHelper(masm, Deoptimizer::EAGER); | 1124 Generate_InterpreterNotifyDeoptimizedHelper(masm, Deoptimizer::EAGER); |
1119 } | 1125 } |
1120 | 1126 |
1121 | 1127 |
1122 void Builtins::Generate_InterpreterNotifySoftDeoptimized(MacroAssembler* masm) { | 1128 void Builtins::Generate_InterpreterNotifySoftDeoptimized(MacroAssembler* masm) { |
1123 Generate_InterpreterNotifyDeoptimizedHelper(masm, Deoptimizer::SOFT); | 1129 Generate_InterpreterNotifyDeoptimizedHelper(masm, Deoptimizer::SOFT); |
1124 } | 1130 } |
1125 | 1131 |
1126 | 1132 |
1127 void Builtins::Generate_InterpreterNotifyLazyDeoptimized(MacroAssembler* masm) { | 1133 void Builtins::Generate_InterpreterNotifyLazyDeoptimized(MacroAssembler* masm) { |
1128 Generate_InterpreterNotifyDeoptimizedHelper(masm, Deoptimizer::LAZY); | 1134 Generate_InterpreterNotifyDeoptimizedHelper(masm, Deoptimizer::LAZY); |
1129 } | 1135 } |
1130 | 1136 |
1131 | 1137 |
| 1138 void Builtins::Generate_InterpreterEnterExceptionHandler(MacroAssembler* masm) { |
| 1139 Generate_EnterBytecodeDispatch(masm); |
| 1140 } |
| 1141 |
| 1142 |
1132 void Builtins::Generate_CompileLazy(MacroAssembler* masm) { | 1143 void Builtins::Generate_CompileLazy(MacroAssembler* masm) { |
1133 CallRuntimePassFunction(masm, Runtime::kCompileLazy); | 1144 CallRuntimePassFunction(masm, Runtime::kCompileLazy); |
1134 GenerateTailCallToReturnedCode(masm); | 1145 GenerateTailCallToReturnedCode(masm); |
1135 } | 1146 } |
1136 | 1147 |
1137 | 1148 |
1138 void Builtins::Generate_CompileOptimized(MacroAssembler* masm) { | 1149 void Builtins::Generate_CompileOptimized(MacroAssembler* masm) { |
1139 CallRuntimePassFunction(masm, Runtime::kCompileOptimized_NotConcurrent); | 1150 CallRuntimePassFunction(masm, Runtime::kCompileOptimized_NotConcurrent); |
1140 GenerateTailCallToReturnedCode(masm); | 1151 GenerateTailCallToReturnedCode(masm); |
1141 } | 1152 } |
(...skipping 1377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2519 __ bkpt(0); | 2530 __ bkpt(0); |
2520 } | 2531 } |
2521 } | 2532 } |
2522 | 2533 |
2523 | 2534 |
2524 #undef __ | 2535 #undef __ |
2525 } // namespace internal | 2536 } // namespace internal |
2526 } // namespace v8 | 2537 } // namespace v8 |
2527 | 2538 |
2528 #endif // V8_TARGET_ARCH_PPC | 2539 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |