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 1251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1262 | 1262 |
1263 | 1263 |
1264 void CodeGenerator::AssemblePrologue() { | 1264 void CodeGenerator::AssemblePrologue() { |
1265 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); | 1265 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); |
1266 int stack_slots = frame()->GetSpillSlotCount(); | 1266 int stack_slots = frame()->GetSpillSlotCount(); |
1267 if (descriptor->kind() == CallDescriptor::kCallAddress) { | 1267 if (descriptor->kind() == CallDescriptor::kCallAddress) { |
1268 __ function_descriptor(); | 1268 __ function_descriptor(); |
1269 int register_save_area_size = 0; | 1269 int register_save_area_size = 0; |
1270 RegList frame_saves = fp.bit(); | 1270 RegList frame_saves = fp.bit(); |
1271 __ mflr(r0); | 1271 __ mflr(r0); |
1272 __ Push(r0, fp); | 1272 if (FLAG_enable_embedded_constant_pool) { |
1273 __ mr(fp, sp); | 1273 __ Push(r0, fp, kConstantPoolRegister); |
| 1274 // Adjust FP to point to saved FP. |
| 1275 __ subi(fp, sp, Operand(StandardFrameConstants::kConstantPoolOffset)); |
| 1276 register_save_area_size += kPointerSize; |
| 1277 frame_saves |= kConstantPoolRegister.bit(); |
| 1278 } else { |
| 1279 __ Push(r0, fp); |
| 1280 __ mr(fp, sp); |
| 1281 } |
1274 // Save callee-saved registers. | 1282 // Save callee-saved registers. |
1275 const RegList saves = descriptor->CalleeSavedRegisters() & ~frame_saves; | 1283 const RegList saves = descriptor->CalleeSavedRegisters() & ~frame_saves; |
1276 for (int i = Register::kNumRegisters - 1; i >= 0; i--) { | 1284 for (int i = Register::kNumRegisters - 1; i >= 0; i--) { |
1277 if (!((1 << i) & saves)) continue; | 1285 if (!((1 << i) & saves)) continue; |
1278 register_save_area_size += kPointerSize; | 1286 register_save_area_size += kPointerSize; |
1279 } | 1287 } |
1280 frame()->SetRegisterSaveAreaSize(register_save_area_size); | 1288 frame()->SetRegisterSaveAreaSize(register_save_area_size); |
1281 __ MultiPush(saves); | 1289 __ MultiPush(saves); |
1282 } else if (descriptor->IsJSFunctionCall()) { | 1290 } else if (descriptor->IsJSFunctionCall()) { |
1283 CompilationInfo* info = this->info(); | 1291 CompilationInfo* info = this->info(); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1316 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); | 1324 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); |
1317 int stack_slots = frame()->GetSpillSlotCount(); | 1325 int stack_slots = frame()->GetSpillSlotCount(); |
1318 if (descriptor->kind() == CallDescriptor::kCallAddress) { | 1326 if (descriptor->kind() == CallDescriptor::kCallAddress) { |
1319 if (frame()->GetRegisterSaveAreaSize() > 0) { | 1327 if (frame()->GetRegisterSaveAreaSize() > 0) { |
1320 // Remove this frame's spill slots first. | 1328 // Remove this frame's spill slots first. |
1321 if (stack_slots > 0) { | 1329 if (stack_slots > 0) { |
1322 __ Add(sp, sp, stack_slots * kPointerSize, r0); | 1330 __ Add(sp, sp, stack_slots * kPointerSize, r0); |
1323 } | 1331 } |
1324 // Restore registers. | 1332 // Restore registers. |
1325 RegList frame_saves = fp.bit(); | 1333 RegList frame_saves = fp.bit(); |
| 1334 if (FLAG_enable_embedded_constant_pool) { |
| 1335 frame_saves |= kConstantPoolRegister.bit(); |
| 1336 } |
1326 const RegList saves = descriptor->CalleeSavedRegisters() & ~frame_saves; | 1337 const RegList saves = descriptor->CalleeSavedRegisters() & ~frame_saves; |
1327 if (saves != 0) { | 1338 if (saves != 0) { |
1328 __ MultiPop(saves); | 1339 __ MultiPop(saves); |
1329 } | 1340 } |
1330 } | 1341 } |
1331 __ LeaveFrame(StackFrame::MANUAL); | 1342 __ LeaveFrame(StackFrame::MANUAL); |
1332 __ Ret(); | 1343 __ Ret(); |
1333 } else if (descriptor->IsJSFunctionCall() || stack_slots > 0) { | 1344 } else if (descriptor->IsJSFunctionCall() || stack_slots > 0) { |
1334 int pop_count = descriptor->IsJSFunctionCall() | 1345 int pop_count = descriptor->IsJSFunctionCall() |
1335 ? static_cast<int>(descriptor->JSParameterCount()) | 1346 ? static_cast<int>(descriptor->JSParameterCount()) |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1541 } | 1552 } |
1542 } | 1553 } |
1543 MarkLazyDeoptSite(); | 1554 MarkLazyDeoptSite(); |
1544 } | 1555 } |
1545 | 1556 |
1546 #undef __ | 1557 #undef __ |
1547 | 1558 |
1548 } // namespace compiler | 1559 } // namespace compiler |
1549 } // namespace internal | 1560 } // namespace internal |
1550 } // namespace v8 | 1561 } // namespace v8 |
OLD | NEW |