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