| 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/crankshaft/ppc/lithium-codegen-ppc.h" | 5 #include "src/crankshaft/ppc/lithium-codegen-ppc.h" |
| 6 | 6 |
| 7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
| 8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
| 9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
| 10 #include "src/crankshaft/hydrogen-osr.h" | 10 #include "src/crankshaft/hydrogen-osr.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 GenerateJumpTable() && GenerateSafepointTable(); | 53 GenerateJumpTable() && GenerateSafepointTable(); |
| 54 if (FLAG_enable_embedded_constant_pool && !rc) { | 54 if (FLAG_enable_embedded_constant_pool && !rc) { |
| 55 masm()->AbortConstantPoolBuilding(); | 55 masm()->AbortConstantPoolBuilding(); |
| 56 } | 56 } |
| 57 return rc; | 57 return rc; |
| 58 } | 58 } |
| 59 | 59 |
| 60 | 60 |
| 61 void LCodeGen::FinishCode(Handle<Code> code) { | 61 void LCodeGen::FinishCode(Handle<Code> code) { |
| 62 DCHECK(is_done()); | 62 DCHECK(is_done()); |
| 63 code->set_stack_slots(GetStackSlotCount()); | 63 code->set_stack_slots(GetTotalFrameSlotCount()); |
| 64 code->set_safepoint_table_offset(safepoints_.GetCodeOffset()); | 64 code->set_safepoint_table_offset(safepoints_.GetCodeOffset()); |
| 65 PopulateDeoptimizationData(code); | 65 PopulateDeoptimizationData(code); |
| 66 } | 66 } |
| 67 | 67 |
| 68 | 68 |
| 69 void LCodeGen::SaveCallerDoubles() { | 69 void LCodeGen::SaveCallerDoubles() { |
| 70 DCHECK(info()->saves_caller_doubles()); | 70 DCHECK(info()->saves_caller_doubles()); |
| 71 DCHECK(NeedsEagerFrame()); | 71 DCHECK(NeedsEagerFrame()); |
| 72 Comment(";;; Save clobbered callee double registers"); | 72 Comment(";;; Save clobbered callee double registers"); |
| 73 int count = 0; | 73 int count = 0; |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 | 358 |
| 359 // The deoptimization jump table is the last part of the instruction | 359 // The deoptimization jump table is the last part of the instruction |
| 360 // sequence. Mark the generated code as done unless we bailed out. | 360 // sequence. Mark the generated code as done unless we bailed out. |
| 361 if (!is_aborted()) status_ = DONE; | 361 if (!is_aborted()) status_ = DONE; |
| 362 return !is_aborted(); | 362 return !is_aborted(); |
| 363 } | 363 } |
| 364 | 364 |
| 365 | 365 |
| 366 bool LCodeGen::GenerateSafepointTable() { | 366 bool LCodeGen::GenerateSafepointTable() { |
| 367 DCHECK(is_done()); | 367 DCHECK(is_done()); |
| 368 safepoints_.Emit(masm(), GetStackSlotCount()); | 368 safepoints_.Emit(masm(), GetTotalFrameSlotCount()); |
| 369 return !is_aborted(); | 369 return !is_aborted(); |
| 370 } | 370 } |
| 371 | 371 |
| 372 | 372 |
| 373 Register LCodeGen::ToRegister(int code) const { | 373 Register LCodeGen::ToRegister(int code) const { |
| 374 return Register::from_code(code); | 374 return Register::from_code(code); |
| 375 } | 375 } |
| 376 | 376 |
| 377 | 377 |
| 378 DoubleRegister LCodeGen::ToDoubleRegister(int code) const { | 378 DoubleRegister LCodeGen::ToDoubleRegister(int code) const { |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 DCHECK(index < 0); | 510 DCHECK(index < 0); |
| 511 return -(index + 1) * kPointerSize; | 511 return -(index + 1) * kPointerSize; |
| 512 } | 512 } |
| 513 | 513 |
| 514 | 514 |
| 515 MemOperand LCodeGen::ToMemOperand(LOperand* op) const { | 515 MemOperand LCodeGen::ToMemOperand(LOperand* op) const { |
| 516 DCHECK(!op->IsRegister()); | 516 DCHECK(!op->IsRegister()); |
| 517 DCHECK(!op->IsDoubleRegister()); | 517 DCHECK(!op->IsDoubleRegister()); |
| 518 DCHECK(op->IsStackSlot() || op->IsDoubleStackSlot()); | 518 DCHECK(op->IsStackSlot() || op->IsDoubleStackSlot()); |
| 519 if (NeedsEagerFrame()) { | 519 if (NeedsEagerFrame()) { |
| 520 return MemOperand(fp, StackSlotOffset(op->index())); | 520 return MemOperand(fp, FrameSlotToFPOffset(op->index())); |
| 521 } else { | 521 } else { |
| 522 // Retrieve parameter without eager stack-frame relative to the | 522 // Retrieve parameter without eager stack-frame relative to the |
| 523 // stack-pointer. | 523 // stack-pointer. |
| 524 return MemOperand(sp, ArgumentsOffsetWithoutFrame(op->index())); | 524 return MemOperand(sp, ArgumentsOffsetWithoutFrame(op->index())); |
| 525 } | 525 } |
| 526 } | 526 } |
| 527 | 527 |
| 528 | 528 |
| 529 MemOperand LCodeGen::ToHighMemOperand(LOperand* op) const { | 529 MemOperand LCodeGen::ToHighMemOperand(LOperand* op) const { |
| 530 DCHECK(op->IsDoubleStackSlot()); | 530 DCHECK(op->IsDoubleStackSlot()); |
| 531 if (NeedsEagerFrame()) { | 531 if (NeedsEagerFrame()) { |
| 532 return MemOperand(fp, StackSlotOffset(op->index()) + kPointerSize); | 532 return MemOperand(fp, FrameSlotToFPOffset(op->index()) + kPointerSize); |
| 533 } else { | 533 } else { |
| 534 // Retrieve parameter without eager stack-frame relative to the | 534 // Retrieve parameter without eager stack-frame relative to the |
| 535 // stack-pointer. | 535 // stack-pointer. |
| 536 return MemOperand(sp, | 536 return MemOperand(sp, |
| 537 ArgumentsOffsetWithoutFrame(op->index()) + kPointerSize); | 537 ArgumentsOffsetWithoutFrame(op->index()) + kPointerSize); |
| 538 } | 538 } |
| 539 } | 539 } |
| 540 | 540 |
| 541 | 541 |
| 542 void LCodeGen::WriteTranslation(LEnvironment* environment, | 542 void LCodeGen::WriteTranslation(LEnvironment* environment, |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 AddToTranslation(environment, translation, value, | 586 AddToTranslation(environment, translation, value, |
| 587 environment->HasTaggedValueAt(env_offset + i), | 587 environment->HasTaggedValueAt(env_offset + i), |
| 588 environment->HasUint32ValueAt(env_offset + i), | 588 environment->HasUint32ValueAt(env_offset + i), |
| 589 object_index_pointer, dematerialized_index_pointer); | 589 object_index_pointer, dematerialized_index_pointer); |
| 590 } | 590 } |
| 591 return; | 591 return; |
| 592 } | 592 } |
| 593 | 593 |
| 594 if (op->IsStackSlot()) { | 594 if (op->IsStackSlot()) { |
| 595 int index = op->index(); | 595 int index = op->index(); |
| 596 if (index >= 0) { | |
| 597 index += StandardFrameConstants::kFixedFrameSize / kPointerSize; | |
| 598 } | |
| 599 if (is_tagged) { | 596 if (is_tagged) { |
| 600 translation->StoreStackSlot(index); | 597 translation->StoreStackSlot(index); |
| 601 } else if (is_uint32) { | 598 } else if (is_uint32) { |
| 602 translation->StoreUint32StackSlot(index); | 599 translation->StoreUint32StackSlot(index); |
| 603 } else { | 600 } else { |
| 604 translation->StoreInt32StackSlot(index); | 601 translation->StoreInt32StackSlot(index); |
| 605 } | 602 } |
| 606 } else if (op->IsDoubleStackSlot()) { | 603 } else if (op->IsDoubleStackSlot()) { |
| 607 int index = op->index(); | 604 int index = op->index(); |
| 608 if (index >= 0) { | |
| 609 index += StandardFrameConstants::kFixedFrameSize / kPointerSize; | |
| 610 } | |
| 611 translation->StoreDoubleStackSlot(index); | 605 translation->StoreDoubleStackSlot(index); |
| 612 } else if (op->IsRegister()) { | 606 } else if (op->IsRegister()) { |
| 613 Register reg = ToRegister(op); | 607 Register reg = ToRegister(op); |
| 614 if (is_tagged) { | 608 if (is_tagged) { |
| 615 translation->StoreRegister(reg); | 609 translation->StoreRegister(reg); |
| 616 } else if (is_uint32) { | 610 } else if (is_uint32) { |
| 617 translation->StoreUint32Register(reg); | 611 translation->StoreUint32Register(reg); |
| 618 } else { | 612 } else { |
| 619 translation->StoreInt32Register(reg); | 613 translation->StoreInt32Register(reg); |
| 620 } | 614 } |
| (...skipping 5130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5751 | 5745 |
| 5752 void LCodeGen::DoStoreFrameContext(LStoreFrameContext* instr) { | 5746 void LCodeGen::DoStoreFrameContext(LStoreFrameContext* instr) { |
| 5753 Register context = ToRegister(instr->context()); | 5747 Register context = ToRegister(instr->context()); |
| 5754 __ StoreP(context, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 5748 __ StoreP(context, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 5755 } | 5749 } |
| 5756 | 5750 |
| 5757 | 5751 |
| 5758 #undef __ | 5752 #undef __ |
| 5759 } // namespace internal | 5753 } // namespace internal |
| 5760 } // namespace v8 | 5754 } // namespace v8 |
| OLD | NEW |