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

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: addressed Slava's feedback 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
« no previous file with comments | « runtime/vm/intermediate_language_ia32.cc ('k') | runtime/vm/intermediate_language_x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
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
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) { }
1682 1690
1683 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { 1691 virtual void EmitNativeCode(FlowGraphCompiler* compiler) {
1684 Isolate* isolate = compiler->isolate(); 1692 Isolate* isolate = compiler->isolate();
1685 StubCode* stub_code = isolate->stub_code(); 1693 StubCode* stub_code = isolate->stub_code();
1686 1694
1687 if (Assembler::EmittingComments()) { 1695 if (Assembler::EmittingComments()) {
1688 __ Comment("%s slow path allocation of %s", 1696 __ Comment("%s slow path allocation of %s",
(...skipping 10 matching lines...) Expand all
1699 1707
1700 compiler->SaveLiveRegisters(locs); 1708 compiler->SaveLiveRegisters(locs);
1701 compiler->GenerateCall(Scanner::kNoSourcePos, // No token position. 1709 compiler->GenerateCall(Scanner::kNoSourcePos, // No token position.
1702 &label, 1710 &label,
1703 RawPcDescriptors::kOther, 1711 RawPcDescriptors::kOther,
1704 locs); 1712 locs);
1705 if (result_ != V0) { 1713 if (result_ != V0) {
1706 __ mov(result_, V0); 1714 __ mov(result_, V0);
1707 } 1715 }
1708 compiler->RestoreLiveRegisters(locs); 1716 compiler->RestoreLiveRegisters(locs);
1709
1710 __ b(exit_label()); 1717 __ b(exit_label());
1711 } 1718 }
1712 1719
1713 static void Allocate(FlowGraphCompiler* compiler, 1720 static void Allocate(FlowGraphCompiler* compiler,
1714 Instruction* instruction, 1721 Instruction* instruction,
1715 const Class& cls, 1722 const Class& cls,
1716 Register result, 1723 Register result,
1717 Register temp) { 1724 Register temp) {
1718 BoxAllocationSlowPath* slow_path = 1725 if (compiler->intrinsic_mode()) {
1719 new BoxAllocationSlowPath(instruction, cls, result); 1726 __ TryAllocate(cls,
1720 compiler->AddSlowPathCode(slow_path); 1727 compiler->intrinsic_slow_path_label(),
1728 result,
1729 temp);
1730 } else {
1731 BoxAllocationSlowPath* slow_path =
1732 new BoxAllocationSlowPath(instruction, cls, result);
1733 compiler->AddSlowPathCode(slow_path);
1721 1734
1722 __ TryAllocate(cls, 1735 __ TryAllocate(cls,
1723 slow_path->entry_label(), 1736 slow_path->entry_label(),
1724 result, 1737 result,
1725 temp); 1738 temp);
1726 __ Bind(slow_path->exit_label()); 1739 __ Bind(slow_path->exit_label());
1740 }
1727 } 1741 }
1728 1742
1729 private: 1743 private:
1730 Instruction* instruction_; 1744 Instruction* instruction_;
1731 const Class& cls_; 1745 const Class& cls_;
1732 Register result_; 1746 const Register result_;
1733 }; 1747 };
1734 1748
1735 1749
1736 LocationSummary* StoreInstanceFieldInstr::MakeLocationSummary(Isolate* isolate, 1750 LocationSummary* StoreInstanceFieldInstr::MakeLocationSummary(Isolate* isolate,
1737 bool opt) const { 1751 bool opt) const {
1738 const intptr_t kNumInputs = 2; 1752 const intptr_t kNumInputs = 2;
1739 const intptr_t kNumTemps = 1753 const intptr_t kNumTemps =
1740 (IsUnboxedStore() && opt) ? 2 : 1754 (IsUnboxedStore() && opt) ? 2 :
1741 ((IsPotentialUnboxedStore()) ? 3 : 0); 1755 ((IsPotentialUnboxedStore()) ? 3 : 0);
1742 LocationSummary* summary = new(isolate) LocationSummary( 1756 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()); 4830 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs());
4817 #if defined(DEBUG) 4831 #if defined(DEBUG)
4818 __ LoadImmediate(S4, kInvalidObjectPointer); 4832 __ LoadImmediate(S4, kInvalidObjectPointer);
4819 __ LoadImmediate(S5, kInvalidObjectPointer); 4833 __ LoadImmediate(S5, kInvalidObjectPointer);
4820 #endif 4834 #endif
4821 } 4835 }
4822 4836
4823 } // namespace dart 4837 } // namespace dart
4824 4838
4825 #endif // defined TARGET_ARCH_MIPS 4839 #endif // defined TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_ia32.cc ('k') | runtime/vm/intermediate_language_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698