| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS. |
| 6 #if defined(TARGET_ARCH_MIPS) | 6 #if defined(TARGET_ARCH_MIPS) |
| 7 | 7 |
| 8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
| 9 | 9 |
| 10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 } | 81 } |
| 82 | 82 |
| 83 | 83 |
| 84 // Attempt optimized compilation at return instruction instead of at the entry. | 84 // Attempt optimized compilation at return instruction instead of at the entry. |
| 85 // The entry needs to be patchable, no inlined objects are allowed in the area | 85 // The entry needs to be patchable, no inlined objects are allowed in the area |
| 86 // that will be overwritten by the patch instructions: a branch macro sequence. | 86 // that will be overwritten by the patch instructions: a branch macro sequence. |
| 87 void ReturnInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 87 void ReturnInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 88 __ TraceSimMsg("ReturnInstr"); | 88 __ TraceSimMsg("ReturnInstr"); |
| 89 Register result = locs()->in(0).reg(); | 89 Register result = locs()->in(0).reg(); |
| 90 ASSERT(result == V0); | 90 ASSERT(result == V0); |
| 91 |
| 92 if (compiler->intrinsic_mode()) { |
| 93 // Intrinsics don't have a frame. |
| 94 __ Ret(); |
| 95 return; |
| 96 } |
| 97 |
| 91 #if defined(DEBUG) | 98 #if defined(DEBUG) |
| 92 Label stack_ok; | 99 Label stack_ok; |
| 93 __ Comment("Stack Check"); | 100 __ Comment("Stack Check"); |
| 94 __ TraceSimMsg("Stack Check"); | 101 __ TraceSimMsg("Stack Check"); |
| 95 const intptr_t fp_sp_dist = | 102 const intptr_t fp_sp_dist = |
| 96 (kFirstLocalSlotFromFp + 1 - compiler->StackSize()) * kWordSize; | 103 (kFirstLocalSlotFromFp + 1 - compiler->StackSize()) * kWordSize; |
| 97 ASSERT(fp_sp_dist <= 0); | 104 ASSERT(fp_sp_dist <= 0); |
| 98 __ subu(CMPRES1, SP, FP); | 105 __ subu(CMPRES1, SP, FP); |
| 99 | 106 |
| 100 __ BranchEqual(CMPRES1, fp_sp_dist, &stack_ok); | 107 __ BranchEqual(CMPRES1, fp_sp_dist, &stack_ok); |
| (...skipping 1567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1668 __ LoadImmediate(TMP, Smi::RawValue(field().guarded_list_length())); | 1675 __ LoadImmediate(TMP, Smi::RawValue(field().guarded_list_length())); |
| 1669 __ bne(CMPRES1, TMP, deopt); | 1676 __ bne(CMPRES1, TMP, deopt); |
| 1670 } | 1677 } |
| 1671 } | 1678 } |
| 1672 | 1679 |
| 1673 | 1680 |
| 1674 class BoxAllocationSlowPath : public SlowPathCode { | 1681 class BoxAllocationSlowPath : public SlowPathCode { |
| 1675 public: | 1682 public: |
| 1676 BoxAllocationSlowPath(Instruction* instruction, | 1683 BoxAllocationSlowPath(Instruction* instruction, |
| 1677 const Class& cls, | 1684 const Class& cls, |
| 1678 Register result) | 1685 Register result, |
| 1686 bool is_intrinsic) |
| 1679 : instruction_(instruction), | 1687 : instruction_(instruction), |
| 1680 cls_(cls), | 1688 cls_(cls), |
| 1681 result_(result) { } | 1689 result_(result), |
| 1690 is_intrinsic_(is_intrinsic) { } |
| 1682 | 1691 |
| 1683 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { | 1692 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1684 Isolate* isolate = compiler->isolate(); | 1693 Isolate* isolate = compiler->isolate(); |
| 1685 StubCode* stub_code = isolate->stub_code(); | 1694 StubCode* stub_code = isolate->stub_code(); |
| 1686 | 1695 |
| 1687 if (Assembler::EmittingComments()) { | 1696 if (Assembler::EmittingComments()) { |
| 1688 __ Comment("%s slow path allocation of %s", | 1697 __ Comment("%s slow path allocation of %s", |
| 1689 instruction_->DebugName(), | 1698 instruction_->DebugName(), |
| 1690 String::Handle(cls_.PrettyName()).ToCString()); | 1699 String::Handle(cls_.PrettyName()).ToCString()); |
| 1691 } | 1700 } |
| 1692 __ Bind(entry_label()); | 1701 __ Bind(entry_label()); |
| 1702 |
| 1703 if (is_intrinsic_) { |
| 1704 __ EnterStubFrame(true); |
| 1705 } |
| 1706 |
| 1693 const Code& stub = | 1707 const Code& stub = |
| 1694 Code::Handle(isolate, stub_code->GetAllocationStubForClass(cls_)); | 1708 Code::Handle(isolate, stub_code->GetAllocationStubForClass(cls_)); |
| 1695 const ExternalLabel label(stub.EntryPoint()); | 1709 const ExternalLabel label(stub.EntryPoint()); |
| 1696 | 1710 |
| 1697 LocationSummary* locs = instruction_->locs(); | 1711 LocationSummary* locs = instruction_->locs(); |
| 1698 locs->live_registers()->Remove(Location::RegisterLocation(result_)); | 1712 locs->live_registers()->Remove(Location::RegisterLocation(result_)); |
| 1699 | 1713 |
| 1700 compiler->SaveLiveRegisters(locs); | 1714 compiler->SaveLiveRegisters(locs); |
| 1701 compiler->GenerateCall(Scanner::kNoSourcePos, // No token position. | 1715 compiler->GenerateCall(Scanner::kNoSourcePos, // No token position. |
| 1702 &label, | 1716 &label, |
| 1703 RawPcDescriptors::kOther, | 1717 RawPcDescriptors::kOther, |
| 1704 locs); | 1718 locs); |
| 1705 if (result_ != V0) { | 1719 if (result_ != V0) { |
| 1706 __ mov(result_, V0); | 1720 __ mov(result_, V0); |
| 1707 } | 1721 } |
| 1708 compiler->RestoreLiveRegisters(locs); | 1722 compiler->RestoreLiveRegisters(locs); |
| 1709 | 1723 |
| 1724 if (is_intrinsic_) { |
| 1725 __ LeaveStubFrame(); |
| 1726 } |
| 1710 __ b(exit_label()); | 1727 __ b(exit_label()); |
| 1711 } | 1728 } |
| 1712 | 1729 |
| 1713 static void Allocate(FlowGraphCompiler* compiler, | 1730 static void Allocate(FlowGraphCompiler* compiler, |
| 1714 Instruction* instruction, | 1731 Instruction* instruction, |
| 1715 const Class& cls, | 1732 const Class& cls, |
| 1716 Register result, | 1733 Register result, |
| 1717 Register temp) { | 1734 Register temp) { |
| 1718 BoxAllocationSlowPath* slow_path = | 1735 BoxAllocationSlowPath* slow_path = |
| 1719 new BoxAllocationSlowPath(instruction, cls, result); | 1736 new BoxAllocationSlowPath(instruction, cls, result, |
| 1737 compiler->intrinsic_mode()); |
| 1720 compiler->AddSlowPathCode(slow_path); | 1738 compiler->AddSlowPathCode(slow_path); |
| 1721 | 1739 |
| 1722 __ TryAllocate(cls, | 1740 __ TryAllocate(cls, |
| 1723 slow_path->entry_label(), | 1741 slow_path->entry_label(), |
| 1724 result, | 1742 result, |
| 1725 temp); | 1743 temp); |
| 1726 __ Bind(slow_path->exit_label()); | 1744 __ Bind(slow_path->exit_label()); |
| 1727 } | 1745 } |
| 1728 | 1746 |
| 1729 private: | 1747 private: |
| 1730 Instruction* instruction_; | 1748 Instruction* instruction_; |
| 1731 const Class& cls_; | 1749 const Class& cls_; |
| 1732 Register result_; | 1750 const Register result_; |
| 1751 const bool is_intrinsic_; |
| 1733 }; | 1752 }; |
| 1734 | 1753 |
| 1735 | 1754 |
| 1736 LocationSummary* StoreInstanceFieldInstr::MakeLocationSummary(Isolate* isolate, | 1755 LocationSummary* StoreInstanceFieldInstr::MakeLocationSummary(Isolate* isolate, |
| 1737 bool opt) const { | 1756 bool opt) const { |
| 1738 const intptr_t kNumInputs = 2; | 1757 const intptr_t kNumInputs = 2; |
| 1739 const intptr_t kNumTemps = | 1758 const intptr_t kNumTemps = |
| 1740 (IsUnboxedStore() && opt) ? 2 : | 1759 (IsUnboxedStore() && opt) ? 2 : |
| 1741 ((IsPotentialUnboxedStore()) ? 3 : 0); | 1760 ((IsPotentialUnboxedStore()) ? 3 : 0); |
| 1742 LocationSummary* summary = new(isolate) LocationSummary( | 1761 LocationSummary* summary = new(isolate) LocationSummary( |
| (...skipping 3073 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4816 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); | 4835 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); |
| 4817 #if defined(DEBUG) | 4836 #if defined(DEBUG) |
| 4818 __ LoadImmediate(S4, kInvalidObjectPointer); | 4837 __ LoadImmediate(S4, kInvalidObjectPointer); |
| 4819 __ LoadImmediate(S5, kInvalidObjectPointer); | 4838 __ LoadImmediate(S5, kInvalidObjectPointer); |
| 4820 #endif | 4839 #endif |
| 4821 } | 4840 } |
| 4822 | 4841 |
| 4823 } // namespace dart | 4842 } // namespace dart |
| 4824 | 4843 |
| 4825 #endif // defined TARGET_ARCH_MIPS | 4844 #endif // defined TARGET_ARCH_MIPS |
| OLD | NEW |