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 #include "src/compiler/code-generator.h" | 5 #include "src/compiler/code-generator.h" |
6 | 6 |
7 #include "src/compiler/code-generator-impl.h" | 7 #include "src/compiler/code-generator-impl.h" |
8 #include "src/compiler/gap-resolver.h" | 8 #include "src/compiler/gap-resolver.h" |
9 #include "src/compiler/node-matchers.h" | 9 #include "src/compiler/node-matchers.h" |
10 #include "src/ppc/macro-assembler-ppc.h" | 10 #include "src/ppc/macro-assembler-ppc.h" |
(...skipping 1172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1183 | 1183 |
1184 | 1184 |
1185 void CodeGenerator::AssemblePrologue() { | 1185 void CodeGenerator::AssemblePrologue() { |
1186 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); | 1186 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); |
1187 int stack_slots = frame()->GetSpillSlotCount(); | 1187 int stack_slots = frame()->GetSpillSlotCount(); |
1188 if (descriptor->kind() == CallDescriptor::kCallAddress) { | 1188 if (descriptor->kind() == CallDescriptor::kCallAddress) { |
1189 __ function_descriptor(); | 1189 __ function_descriptor(); |
1190 int register_save_area_size = 0; | 1190 int register_save_area_size = 0; |
1191 RegList frame_saves = fp.bit(); | 1191 RegList frame_saves = fp.bit(); |
1192 __ mflr(r0); | 1192 __ mflr(r0); |
1193 __ Push(r0, fp); | 1193 if (FLAG_enable_embedded_constant_pool) { |
1194 __ mr(fp, sp); | 1194 __ Push(r0, fp, kConstantPoolRegister); |
| 1195 // Adjust FP to point to saved FP. |
| 1196 __ subi(fp, sp, Operand(StandardFrameConstants::kConstantPoolOffset)); |
| 1197 register_save_area_size += kPointerSize; |
| 1198 frame_saves |= kConstantPoolRegister.bit(); |
| 1199 } else { |
| 1200 __ Push(r0, fp); |
| 1201 __ mr(fp, sp); |
| 1202 } |
1195 // Save callee-saved registers. | 1203 // Save callee-saved registers. |
1196 const RegList saves = descriptor->CalleeSavedRegisters() & ~frame_saves; | 1204 const RegList saves = descriptor->CalleeSavedRegisters() & ~frame_saves; |
1197 for (int i = Register::kNumRegisters - 1; i >= 0; i--) { | 1205 for (int i = Register::kNumRegisters - 1; i >= 0; i--) { |
1198 if (!((1 << i) & saves)) continue; | 1206 if (!((1 << i) & saves)) continue; |
1199 register_save_area_size += kPointerSize; | 1207 register_save_area_size += kPointerSize; |
1200 } | 1208 } |
1201 frame()->SetRegisterSaveAreaSize(register_save_area_size); | 1209 frame()->SetRegisterSaveAreaSize(register_save_area_size); |
1202 __ MultiPush(saves); | 1210 __ MultiPush(saves); |
1203 } else if (descriptor->IsJSFunctionCall()) { | 1211 } else if (descriptor->IsJSFunctionCall()) { |
1204 CompilationInfo* info = this->info(); | 1212 CompilationInfo* info = this->info(); |
(...skipping 30 matching lines...) Expand all Loading... |
1235 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); | 1243 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); |
1236 int stack_slots = frame()->GetSpillSlotCount(); | 1244 int stack_slots = frame()->GetSpillSlotCount(); |
1237 if (descriptor->kind() == CallDescriptor::kCallAddress) { | 1245 if (descriptor->kind() == CallDescriptor::kCallAddress) { |
1238 if (frame()->GetRegisterSaveAreaSize() > 0) { | 1246 if (frame()->GetRegisterSaveAreaSize() > 0) { |
1239 // Remove this frame's spill slots first. | 1247 // Remove this frame's spill slots first. |
1240 if (stack_slots > 0) { | 1248 if (stack_slots > 0) { |
1241 __ Add(sp, sp, stack_slots * kPointerSize, r0); | 1249 __ Add(sp, sp, stack_slots * kPointerSize, r0); |
1242 } | 1250 } |
1243 // Restore registers. | 1251 // Restore registers. |
1244 RegList frame_saves = fp.bit(); | 1252 RegList frame_saves = fp.bit(); |
| 1253 if (FLAG_enable_embedded_constant_pool) { |
| 1254 frame_saves |= kConstantPoolRegister.bit(); |
| 1255 } |
1245 const RegList saves = descriptor->CalleeSavedRegisters() & ~frame_saves; | 1256 const RegList saves = descriptor->CalleeSavedRegisters() & ~frame_saves; |
1246 if (saves != 0) { | 1257 if (saves != 0) { |
1247 __ MultiPop(saves); | 1258 __ MultiPop(saves); |
1248 } | 1259 } |
1249 } | 1260 } |
1250 __ LeaveFrame(StackFrame::MANUAL); | 1261 __ LeaveFrame(StackFrame::MANUAL); |
1251 __ Ret(); | 1262 __ Ret(); |
1252 } else if (descriptor->IsJSFunctionCall() || stack_slots > 0) { | 1263 } else if (descriptor->IsJSFunctionCall() || stack_slots > 0) { |
1253 int pop_count = descriptor->IsJSFunctionCall() | 1264 int pop_count = descriptor->IsJSFunctionCall() |
1254 ? static_cast<int>(descriptor->JSParameterCount()) | 1265 ? static_cast<int>(descriptor->JSParameterCount()) |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1450 } | 1461 } |
1451 } | 1462 } |
1452 MarkLazyDeoptSite(); | 1463 MarkLazyDeoptSite(); |
1453 } | 1464 } |
1454 | 1465 |
1455 #undef __ | 1466 #undef __ |
1456 | 1467 |
1457 } // namespace compiler | 1468 } // namespace compiler |
1458 } // namespace internal | 1469 } // namespace internal |
1459 } // namespace v8 | 1470 } // namespace v8 |
OLD | NEW |