| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/arm/lithium-codegen-arm.h" | 5 #include "src/crankshaft/arm/lithium-codegen-arm.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/arm/lithium-gap-resolver-arm.h" | 10 #include "src/crankshaft/arm/lithium-gap-resolver-arm.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 // the frame (that is done in GeneratePrologue). | 52 // the frame (that is done in GeneratePrologue). |
| 53 FrameScope frame_scope(masm_, StackFrame::NONE); | 53 FrameScope frame_scope(masm_, StackFrame::NONE); |
| 54 | 54 |
| 55 return GeneratePrologue() && GenerateBody() && GenerateDeferredCode() && | 55 return GeneratePrologue() && GenerateBody() && GenerateDeferredCode() && |
| 56 GenerateJumpTable() && GenerateSafepointTable(); | 56 GenerateJumpTable() && GenerateSafepointTable(); |
| 57 } | 57 } |
| 58 | 58 |
| 59 | 59 |
| 60 void LCodeGen::FinishCode(Handle<Code> code) { | 60 void LCodeGen::FinishCode(Handle<Code> code) { |
| 61 DCHECK(is_done()); | 61 DCHECK(is_done()); |
| 62 code->set_stack_slots(GetStackSlotCount()); | 62 code->set_stack_slots(GetTotalFrameSlotCount()); |
| 63 code->set_safepoint_table_offset(safepoints_.GetCodeOffset()); | 63 code->set_safepoint_table_offset(safepoints_.GetCodeOffset()); |
| 64 PopulateDeoptimizationData(code); | 64 PopulateDeoptimizationData(code); |
| 65 } | 65 } |
| 66 | 66 |
| 67 | 67 |
| 68 void LCodeGen::SaveCallerDoubles() { | 68 void LCodeGen::SaveCallerDoubles() { |
| 69 DCHECK(info()->saves_caller_doubles()); | 69 DCHECK(info()->saves_caller_doubles()); |
| 70 DCHECK(NeedsEagerFrame()); | 70 DCHECK(NeedsEagerFrame()); |
| 71 Comment(";;; Save clobbered callee double registers"); | 71 Comment(";;; Save clobbered callee double registers"); |
| 72 int count = 0; | 72 int count = 0; |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 | 368 |
| 369 // The deoptimization jump table is the last part of the instruction | 369 // The deoptimization jump table is the last part of the instruction |
| 370 // sequence. Mark the generated code as done unless we bailed out. | 370 // sequence. Mark the generated code as done unless we bailed out. |
| 371 if (!is_aborted()) status_ = DONE; | 371 if (!is_aborted()) status_ = DONE; |
| 372 return !is_aborted(); | 372 return !is_aborted(); |
| 373 } | 373 } |
| 374 | 374 |
| 375 | 375 |
| 376 bool LCodeGen::GenerateSafepointTable() { | 376 bool LCodeGen::GenerateSafepointTable() { |
| 377 DCHECK(is_done()); | 377 DCHECK(is_done()); |
| 378 safepoints_.Emit(masm(), GetStackSlotCount()); | 378 safepoints_.Emit(masm(), GetTotalFrameSlotCount()); |
| 379 return !is_aborted(); | 379 return !is_aborted(); |
| 380 } | 380 } |
| 381 | 381 |
| 382 | 382 |
| 383 Register LCodeGen::ToRegister(int code) const { | 383 Register LCodeGen::ToRegister(int code) const { |
| 384 return Register::from_code(code); | 384 return Register::from_code(code); |
| 385 } | 385 } |
| 386 | 386 |
| 387 | 387 |
| 388 DwVfpRegister LCodeGen::ToDoubleRegister(int code) const { | 388 DwVfpRegister LCodeGen::ToDoubleRegister(int code) const { |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 540 DCHECK(index < 0); | 540 DCHECK(index < 0); |
| 541 return -(index + 1) * kPointerSize; | 541 return -(index + 1) * kPointerSize; |
| 542 } | 542 } |
| 543 | 543 |
| 544 | 544 |
| 545 MemOperand LCodeGen::ToMemOperand(LOperand* op) const { | 545 MemOperand LCodeGen::ToMemOperand(LOperand* op) const { |
| 546 DCHECK(!op->IsRegister()); | 546 DCHECK(!op->IsRegister()); |
| 547 DCHECK(!op->IsDoubleRegister()); | 547 DCHECK(!op->IsDoubleRegister()); |
| 548 DCHECK(op->IsStackSlot() || op->IsDoubleStackSlot()); | 548 DCHECK(op->IsStackSlot() || op->IsDoubleStackSlot()); |
| 549 if (NeedsEagerFrame()) { | 549 if (NeedsEagerFrame()) { |
| 550 return MemOperand(fp, StackSlotOffset(op->index())); | 550 return MemOperand(fp, FrameSlotToFPOffset(op->index())); |
| 551 } else { | 551 } else { |
| 552 // Retrieve parameter without eager stack-frame relative to the | 552 // Retrieve parameter without eager stack-frame relative to the |
| 553 // stack-pointer. | 553 // stack-pointer. |
| 554 return MemOperand(sp, ArgumentsOffsetWithoutFrame(op->index())); | 554 return MemOperand(sp, ArgumentsOffsetWithoutFrame(op->index())); |
| 555 } | 555 } |
| 556 } | 556 } |
| 557 | 557 |
| 558 | 558 |
| 559 MemOperand LCodeGen::ToHighMemOperand(LOperand* op) const { | 559 MemOperand LCodeGen::ToHighMemOperand(LOperand* op) const { |
| 560 DCHECK(op->IsDoubleStackSlot()); | 560 DCHECK(op->IsDoubleStackSlot()); |
| 561 if (NeedsEagerFrame()) { | 561 if (NeedsEagerFrame()) { |
| 562 return MemOperand(fp, StackSlotOffset(op->index()) + kPointerSize); | 562 return MemOperand(fp, FrameSlotToFPOffset(op->index()) + kPointerSize); |
| 563 } else { | 563 } else { |
| 564 // Retrieve parameter without eager stack-frame relative to the | 564 // Retrieve parameter without eager stack-frame relative to the |
| 565 // stack-pointer. | 565 // stack-pointer. |
| 566 return MemOperand( | 566 return MemOperand( |
| 567 sp, ArgumentsOffsetWithoutFrame(op->index()) + kPointerSize); | 567 sp, ArgumentsOffsetWithoutFrame(op->index()) + kPointerSize); |
| 568 } | 568 } |
| 569 } | 569 } |
| 570 | 570 |
| 571 | 571 |
| 572 void LCodeGen::WriteTranslation(LEnvironment* environment, | 572 void LCodeGen::WriteTranslation(LEnvironment* environment, |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 621 environment->HasTaggedValueAt(env_offset + i), | 621 environment->HasTaggedValueAt(env_offset + i), |
| 622 environment->HasUint32ValueAt(env_offset + i), | 622 environment->HasUint32ValueAt(env_offset + i), |
| 623 object_index_pointer, | 623 object_index_pointer, |
| 624 dematerialized_index_pointer); | 624 dematerialized_index_pointer); |
| 625 } | 625 } |
| 626 return; | 626 return; |
| 627 } | 627 } |
| 628 | 628 |
| 629 if (op->IsStackSlot()) { | 629 if (op->IsStackSlot()) { |
| 630 int index = op->index(); | 630 int index = op->index(); |
| 631 if (index >= 0) { | |
| 632 index += StandardFrameConstants::kFixedFrameSize / kPointerSize; | |
| 633 } | |
| 634 if (is_tagged) { | 631 if (is_tagged) { |
| 635 translation->StoreStackSlot(index); | 632 translation->StoreStackSlot(index); |
| 636 } else if (is_uint32) { | 633 } else if (is_uint32) { |
| 637 translation->StoreUint32StackSlot(index); | 634 translation->StoreUint32StackSlot(index); |
| 638 } else { | 635 } else { |
| 639 translation->StoreInt32StackSlot(index); | 636 translation->StoreInt32StackSlot(index); |
| 640 } | 637 } |
| 641 } else if (op->IsDoubleStackSlot()) { | 638 } else if (op->IsDoubleStackSlot()) { |
| 642 int index = op->index(); | 639 int index = op->index(); |
| 643 if (index >= 0) { | |
| 644 index += StandardFrameConstants::kFixedFrameSize / kPointerSize; | |
| 645 } | |
| 646 translation->StoreDoubleStackSlot(index); | 640 translation->StoreDoubleStackSlot(index); |
| 647 } else if (op->IsRegister()) { | 641 } else if (op->IsRegister()) { |
| 648 Register reg = ToRegister(op); | 642 Register reg = ToRegister(op); |
| 649 if (is_tagged) { | 643 if (is_tagged) { |
| 650 translation->StoreRegister(reg); | 644 translation->StoreRegister(reg); |
| 651 } else if (is_uint32) { | 645 } else if (is_uint32) { |
| 652 translation->StoreUint32Register(reg); | 646 translation->StoreUint32Register(reg); |
| 653 } else { | 647 } else { |
| 654 translation->StoreInt32Register(reg); | 648 translation->StoreInt32Register(reg); |
| 655 } | 649 } |
| (...skipping 4899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5555 __ push(ToRegister(instr->function())); | 5549 __ push(ToRegister(instr->function())); |
| 5556 CallRuntime(Runtime::kPushBlockContext, instr); | 5550 CallRuntime(Runtime::kPushBlockContext, instr); |
| 5557 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5551 RecordSafepoint(Safepoint::kNoLazyDeopt); |
| 5558 } | 5552 } |
| 5559 | 5553 |
| 5560 | 5554 |
| 5561 #undef __ | 5555 #undef __ |
| 5562 | 5556 |
| 5563 } // namespace internal | 5557 } // namespace internal |
| 5564 } // namespace v8 | 5558 } // namespace v8 |
| OLD | NEW |