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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 | 75 |
76 | 76 |
77 // Attempt optimized compilation at return instruction instead of at the entry. | 77 // Attempt optimized compilation at return instruction instead of at the entry. |
78 // The entry needs to be patchable, no inlined objects are allowed in the area | 78 // The entry needs to be patchable, no inlined objects are allowed in the area |
79 // that will be overwritten by the patch instructions: a branch macro sequence. | 79 // that will be overwritten by the patch instructions: a branch macro sequence. |
80 void ReturnInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 80 void ReturnInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
81 __ TraceSimMsg("ReturnInstr"); | 81 __ TraceSimMsg("ReturnInstr"); |
82 Register result = locs()->in(0).reg(); | 82 Register result = locs()->in(0).reg(); |
83 ASSERT(result == V0); | 83 ASSERT(result == V0); |
84 #if defined(DEBUG) | 84 #if defined(DEBUG) |
85 // TODO(srdjan): Fix for functions with finally clause. | 85 Label stack_ok; |
86 // A finally clause may leave a previously pushed return value if it | 86 __ Comment("Stack Check"); |
87 // has its own return instruction. Method that have finally are currently | 87 __ TraceSimMsg("Stack Check"); |
88 // not optimized. | 88 const intptr_t fp_sp_dist = |
89 if (!compiler->HasFinally()) { | 89 (kFirstLocalSlotFromFp + 1 - compiler->StackSize()) * kWordSize; |
90 Label stack_ok; | 90 ASSERT(fp_sp_dist <= 0); |
91 __ Comment("Stack Check"); | 91 __ subu(CMPRES1, SP, FP); |
92 __ TraceSimMsg("Stack Check"); | |
93 const intptr_t fp_sp_dist = | |
94 (kFirstLocalSlotFromFp + 1 - compiler->StackSize()) * kWordSize; | |
95 ASSERT(fp_sp_dist <= 0); | |
96 __ subu(CMPRES1, SP, FP); | |
97 | 92 |
98 __ BranchEqual(CMPRES1, fp_sp_dist, &stack_ok); | 93 __ BranchEqual(CMPRES1, fp_sp_dist, &stack_ok); |
99 __ break_(0); | 94 __ break_(0); |
100 | 95 |
101 __ Bind(&stack_ok); | 96 __ Bind(&stack_ok); |
102 } | |
103 #endif | 97 #endif |
104 __ LeaveDartFrameAndReturn(); | 98 __ LeaveDartFrameAndReturn(); |
105 } | 99 } |
106 | 100 |
107 | 101 |
108 static Condition NegateCondition(Condition condition) { | 102 static Condition NegateCondition(Condition condition) { |
109 switch (condition) { | 103 switch (condition) { |
110 case EQ: return NE; | 104 case EQ: return NE; |
111 case NE: return EQ; | 105 case NE: return EQ; |
112 case LT: return GE; | 106 case LT: return GE; |
(...skipping 4094 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4207 compiler->GenerateCall(token_pos(), | 4201 compiler->GenerateCall(token_pos(), |
4208 &label, | 4202 &label, |
4209 PcDescriptors::kOther, | 4203 PcDescriptors::kOther, |
4210 locs()); | 4204 locs()); |
4211 __ Drop(2); // Discard type arguments and receiver. | 4205 __ Drop(2); // Discard type arguments and receiver. |
4212 } | 4206 } |
4213 | 4207 |
4214 } // namespace dart | 4208 } // namespace dart |
4215 | 4209 |
4216 #endif // defined TARGET_ARCH_MIPS | 4210 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |