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_ARM. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM. |
6 #if defined(TARGET_ARCH_ARM) | 6 #if defined(TARGET_ARCH_ARM) |
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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 } | 73 } |
74 | 74 |
75 | 75 |
76 // Attempt optimized compilation at return instruction instead of at the entry. | 76 // Attempt optimized compilation at return instruction instead of at the entry. |
77 // The entry needs to be patchable, no inlined objects are allowed in the area | 77 // The entry needs to be patchable, no inlined objects are allowed in the area |
78 // that will be overwritten by the patch instructions: a branch macro sequence. | 78 // that will be overwritten by the patch instructions: a branch macro sequence. |
79 void ReturnInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 79 void ReturnInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
80 Register result = locs()->in(0).reg(); | 80 Register result = locs()->in(0).reg(); |
81 ASSERT(result == R0); | 81 ASSERT(result == R0); |
82 #if defined(DEBUG) | 82 #if defined(DEBUG) |
83 // TODO(srdjan): Fix for functions with finally clause. | 83 Label stack_ok; |
84 // A finally clause may leave a previously pushed return value if it | 84 __ Comment("Stack Check"); |
85 // has its own return instruction. Method that have finally are currently | 85 const intptr_t fp_sp_dist = |
86 // not optimized. | 86 (kFirstLocalSlotFromFp + 1 - compiler->StackSize()) * kWordSize; |
87 if (!compiler->HasFinally()) { | 87 ASSERT(fp_sp_dist <= 0); |
88 Label stack_ok; | 88 __ sub(R2, SP, ShifterOperand(FP)); |
89 __ Comment("Stack Check"); | 89 __ CompareImmediate(R2, fp_sp_dist); |
90 const intptr_t fp_sp_dist = | 90 __ b(&stack_ok, EQ); |
91 (kFirstLocalSlotFromFp + 1 - compiler->StackSize()) * kWordSize; | 91 __ bkpt(0); |
92 ASSERT(fp_sp_dist <= 0); | 92 __ Bind(&stack_ok); |
93 __ sub(R2, SP, ShifterOperand(FP)); | |
94 __ CompareImmediate(R2, fp_sp_dist); | |
95 __ b(&stack_ok, EQ); | |
96 __ bkpt(0); | |
97 __ Bind(&stack_ok); | |
98 } | |
99 #endif | 93 #endif |
100 __ LeaveDartFrame(); | 94 __ LeaveDartFrame(); |
101 __ Ret(); | 95 __ Ret(); |
102 } | 96 } |
103 | 97 |
104 | 98 |
105 static Condition NegateCondition(Condition condition) { | 99 static Condition NegateCondition(Condition condition) { |
106 switch (condition) { | 100 switch (condition) { |
107 case EQ: return NE; | 101 case EQ: return NE; |
108 case NE: return EQ; | 102 case NE: return EQ; |
(...skipping 4734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4843 compiler->GenerateCall(token_pos(), | 4837 compiler->GenerateCall(token_pos(), |
4844 &label, | 4838 &label, |
4845 PcDescriptors::kOther, | 4839 PcDescriptors::kOther, |
4846 locs()); | 4840 locs()); |
4847 __ Drop(2); // Discard type arguments and receiver. | 4841 __ Drop(2); // Discard type arguments and receiver. |
4848 } | 4842 } |
4849 | 4843 |
4850 } // namespace dart | 4844 } // namespace dart |
4851 | 4845 |
4852 #endif // defined TARGET_ARCH_ARM | 4846 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |