Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(913)

Side by Side Diff: runtime/vm/intermediate_language_mips.cc

Issue 513213002: Generate some intrinsics using our IR. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
98
91 #if defined(DEBUG) 99 #if defined(DEBUG)
92 Label stack_ok; 100 Label stack_ok;
93 __ Comment("Stack Check"); 101 __ Comment("Stack Check");
94 __ TraceSimMsg("Stack Check"); 102 __ TraceSimMsg("Stack Check");
95 const intptr_t fp_sp_dist = 103 const intptr_t fp_sp_dist =
96 (kFirstLocalSlotFromFp + 1 - compiler->StackSize()) * kWordSize; 104 (kFirstLocalSlotFromFp + 1 - compiler->StackSize()) * kWordSize;
97 ASSERT(fp_sp_dist <= 0); 105 ASSERT(fp_sp_dist <= 0);
98 __ subu(CMPRES1, SP, FP); 106 __ subu(CMPRES1, SP, FP);
99 107
100 __ BranchEqual(CMPRES1, fp_sp_dist, &stack_ok); 108 __ BranchEqual(CMPRES1, fp_sp_dist, &stack_ok);
(...skipping 1567 matching lines...) Expand 10 before | Expand all | Expand 10 after
1668 __ LoadImmediate(TMP, Smi::RawValue(field().guarded_list_length())); 1676 __ LoadImmediate(TMP, Smi::RawValue(field().guarded_list_length()));
1669 __ bne(CMPRES1, TMP, deopt); 1677 __ bne(CMPRES1, TMP, deopt);
1670 } 1678 }
1671 } 1679 }
1672 1680
1673 1681
1674 class BoxAllocationSlowPath : public SlowPathCode { 1682 class BoxAllocationSlowPath : public SlowPathCode {
1675 public: 1683 public:
1676 BoxAllocationSlowPath(Instruction* instruction, 1684 BoxAllocationSlowPath(Instruction* instruction,
1677 const Class& cls, 1685 const Class& cls,
1678 Register result) 1686 Register result,
1687 bool is_intrinsic)
1679 : instruction_(instruction), 1688 : instruction_(instruction),
1680 cls_(cls), 1689 cls_(cls),
1681 result_(result) { } 1690 result_(result),
1691 is_intrinsic_(is_intrinsic) { }
1682 1692
1683 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { 1693 virtual void EmitNativeCode(FlowGraphCompiler* compiler) {
1684 Isolate* isolate = compiler->isolate(); 1694 Isolate* isolate = compiler->isolate();
1685 StubCode* stub_code = isolate->stub_code(); 1695 StubCode* stub_code = isolate->stub_code();
1686 1696
1687 if (Assembler::EmittingComments()) { 1697 if (Assembler::EmittingComments()) {
1688 __ Comment("%s slow path allocation of %s", 1698 __ Comment("%s slow path allocation of %s",
1689 instruction_->DebugName(), 1699 instruction_->DebugName(),
1690 String::Handle(cls_.PrettyName()).ToCString()); 1700 String::Handle(cls_.PrettyName()).ToCString());
1691 } 1701 }
1692 __ Bind(entry_label()); 1702 __ Bind(entry_label());
1703
1704 if (is_intrinsic_) {
1705 __ EnterStubFrame(true);
1706 }
1707
1693 const Code& stub = 1708 const Code& stub =
1694 Code::Handle(isolate, stub_code->GetAllocationStubForClass(cls_)); 1709 Code::Handle(isolate, stub_code->GetAllocationStubForClass(cls_));
1695 const ExternalLabel label(stub.EntryPoint()); 1710 const ExternalLabel label(stub.EntryPoint());
1696 1711
1697 LocationSummary* locs = instruction_->locs(); 1712 LocationSummary* locs = instruction_->locs();
1698 locs->live_registers()->Remove(Location::RegisterLocation(result_)); 1713 locs->live_registers()->Remove(Location::RegisterLocation(result_));
1699 1714
1700 compiler->SaveLiveRegisters(locs); 1715 compiler->SaveLiveRegisters(locs);
1701 compiler->GenerateCall(Scanner::kNoSourcePos, // No token position. 1716 compiler->GenerateCall(Scanner::kNoSourcePos, // No token position.
1702 &label, 1717 &label,
1703 RawPcDescriptors::kOther, 1718 RawPcDescriptors::kOther,
1704 locs); 1719 locs);
1705 if (result_ != V0) { 1720 if (result_ != V0) {
1706 __ mov(result_, V0); 1721 __ mov(result_, V0);
1707 } 1722 }
1708 compiler->RestoreLiveRegisters(locs); 1723 compiler->RestoreLiveRegisters(locs);
1709 1724
1725 if (is_intrinsic_) {
1726 __ LeaveStubFrame();
1727 }
1710 __ b(exit_label()); 1728 __ b(exit_label());
1711 } 1729 }
1712 1730
1713 static void Allocate(FlowGraphCompiler* compiler, 1731 static void Allocate(FlowGraphCompiler* compiler,
1714 Instruction* instruction, 1732 Instruction* instruction,
1715 const Class& cls, 1733 const Class& cls,
1716 Register result, 1734 Register result,
1717 Register temp) { 1735 Register temp) {
1718 BoxAllocationSlowPath* slow_path = 1736 BoxAllocationSlowPath* slow_path =
1719 new BoxAllocationSlowPath(instruction, cls, result); 1737 new BoxAllocationSlowPath(instruction, cls, result,
1738 compiler->intrinsic_mode());
1720 compiler->AddSlowPathCode(slow_path); 1739 compiler->AddSlowPathCode(slow_path);
1721 1740
1722 __ TryAllocate(cls, 1741 __ TryAllocate(cls,
1723 slow_path->entry_label(), 1742 slow_path->entry_label(),
1724 result, 1743 result,
1725 temp); 1744 temp);
1726 __ Bind(slow_path->exit_label()); 1745 __ Bind(slow_path->exit_label());
1727 } 1746 }
1728 1747
1729 private: 1748 private:
1730 Instruction* instruction_; 1749 Instruction* instruction_;
1731 const Class& cls_; 1750 const Class& cls_;
1732 Register result_; 1751 Register result_;
1752 bool is_intrinsic_;
1733 }; 1753 };
1734 1754
1735 1755
1736 LocationSummary* StoreInstanceFieldInstr::MakeLocationSummary(Isolate* isolate, 1756 LocationSummary* StoreInstanceFieldInstr::MakeLocationSummary(Isolate* isolate,
1737 bool opt) const { 1757 bool opt) const {
1738 const intptr_t kNumInputs = 2; 1758 const intptr_t kNumInputs = 2;
1739 const intptr_t kNumTemps = 1759 const intptr_t kNumTemps =
1740 (IsUnboxedStore() && opt) ? 2 : 1760 (IsUnboxedStore() && opt) ? 2 :
1741 ((IsPotentialUnboxedStore()) ? 3 : 0); 1761 ((IsPotentialUnboxedStore()) ? 3 : 0);
1742 LocationSummary* summary = new(isolate) LocationSummary( 1762 LocationSummary* summary = new(isolate) LocationSummary(
(...skipping 3073 matching lines...) Expand 10 before | Expand all | Expand 10 after
4816 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); 4836 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs());
4817 #if defined(DEBUG) 4837 #if defined(DEBUG)
4818 __ LoadImmediate(S4, kInvalidObjectPointer); 4838 __ LoadImmediate(S4, kInvalidObjectPointer);
4819 __ LoadImmediate(S5, kInvalidObjectPointer); 4839 __ LoadImmediate(S5, kInvalidObjectPointer);
4820 #endif 4840 #endif
4821 } 4841 }
4822 4842
4823 } // namespace dart 4843 } // namespace dart
4824 4844
4825 #endif // defined TARGET_ARCH_MIPS 4845 #endif // defined TARGET_ARCH_MIPS
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698