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...) 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...) 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 169 matching lines...) Loading... |
1505 __ lfd(temp_1, dst); | 1516 __ lfd(temp_1, dst); |
1506 __ stfd(temp_0, dst); | 1517 __ stfd(temp_0, dst); |
1507 __ stfd(temp_1, src); | 1518 __ stfd(temp_1, src); |
1508 #endif | 1519 #endif |
1509 } else { | 1520 } else { |
1510 // No other combinations are possible. | 1521 // No other combinations are possible. |
1511 UNREACHABLE(); | 1522 UNREACHABLE(); |
1512 } | 1523 } |
1513 } | 1524 } |
1514 | 1525 |
| 1526 #if V8_EMBEDDED_CONSTANT_POOL |
| 1527 |
| 1528 void CodeGenerator::AssembleConstantPool() { |
| 1529 DCHECK(FLAG_enable_embedded_constant_pool); |
| 1530 __ EmitConstantPool(); |
| 1531 } |
| 1532 |
| 1533 #endif // V8_EMBEDDED_CONSTANT_POOL |
1515 | 1534 |
1516 void CodeGenerator::AssembleJumpTable(Label** targets, size_t target_count) { | 1535 void CodeGenerator::AssembleJumpTable(Label** targets, size_t target_count) { |
1517 for (size_t index = 0; index < target_count; ++index) { | 1536 for (size_t index = 0; index < target_count; ++index) { |
1518 __ emit_label_addr(targets[index]); | 1537 __ emit_label_addr(targets[index]); |
1519 } | 1538 } |
1520 } | 1539 } |
1521 | 1540 |
1522 | 1541 |
1523 void CodeGenerator::AddNopForSmiCodeInlining() { | 1542 void CodeGenerator::AddNopForSmiCodeInlining() { |
1524 // We do not insert nops for inlined Smi code. | 1543 // We do not insert nops for inlined Smi code. |
(...skipping 16 matching lines...) Loading... |
1541 } | 1560 } |
1542 } | 1561 } |
1543 MarkLazyDeoptSite(); | 1562 MarkLazyDeoptSite(); |
1544 } | 1563 } |
1545 | 1564 |
1546 #undef __ | 1565 #undef __ |
1547 | 1566 |
1548 } // namespace compiler | 1567 } // namespace compiler |
1549 } // namespace internal | 1568 } // namespace internal |
1550 } // namespace v8 | 1569 } // namespace v8 |
OLD | NEW |