| 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 "lib/error.h" | 10 #include "lib/error.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 // that will be overwritten by the patch instructions: a branch macro sequence. | 76 // that will be overwritten by the patch instructions: a branch macro sequence. |
| 77 void ReturnInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 77 void ReturnInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 78 Register result = locs()->in(0).reg(); | 78 Register result = locs()->in(0).reg(); |
| 79 ASSERT(result == R0); | 79 ASSERT(result == R0); |
| 80 #if defined(DEBUG) | 80 #if defined(DEBUG) |
| 81 // TODO(srdjan): Fix for functions with finally clause. | 81 // TODO(srdjan): Fix for functions with finally clause. |
| 82 // A finally clause may leave a previously pushed return value if it | 82 // A finally clause may leave a previously pushed return value if it |
| 83 // has its own return instruction. Method that have finally are currently | 83 // has its own return instruction. Method that have finally are currently |
| 84 // not optimized. | 84 // not optimized. |
| 85 if (!compiler->HasFinally()) { | 85 if (!compiler->HasFinally()) { |
| 86 Label stack_ok; |
| 86 __ Comment("Stack Check"); | 87 __ Comment("Stack Check"); |
| 87 const intptr_t fp_sp_dist = | 88 const intptr_t fp_sp_dist = |
| 88 (kFirstLocalSlotIndex + 1 - compiler->StackSize()) * kWordSize; | 89 (kFirstLocalSlotIndex + 1 - compiler->StackSize()) * kWordSize; |
| 89 ASSERT(fp_sp_dist <= 0); | 90 ASSERT(fp_sp_dist <= 0); |
| 90 __ sub(R2, SP, ShifterOperand(FP)); | 91 __ sub(R2, SP, ShifterOperand(FP)); |
| 91 __ CompareImmediate(R2, fp_sp_dist); | 92 __ CompareImmediate(R2, fp_sp_dist); |
| 92 __ bkpt(0, NE); | 93 __ b(&stack_ok, EQ); |
| 94 __ bkpt(0); |
| 95 __ Bind(&stack_ok); |
| 93 } | 96 } |
| 94 #endif | 97 #endif |
| 95 __ LeaveDartFrame(); | 98 __ LeaveDartFrame(); |
| 96 __ Ret(); | 99 __ Ret(); |
| 97 | 100 |
| 98 // No need to generate NOP instructions so that the debugger can patch the | 101 // No need to generate NOP instructions so that the debugger can patch the |
| 99 // return pattern (3 instructions) with a call to the debug stub (also 3 | 102 // return pattern (3 instructions) with a call to the debug stub (also 3 |
| 100 // instructions). | 103 // instructions). |
| 101 compiler->AddCurrentDescriptor(PcDescriptors::kReturn, | 104 compiler->AddCurrentDescriptor(PcDescriptors::kReturn, |
| 102 Isolate::kNoDeoptId, | 105 Isolate::kNoDeoptId, |
| (...skipping 2593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2696 &label, | 2699 &label, |
| 2697 PcDescriptors::kOther, | 2700 PcDescriptors::kOther, |
| 2698 locs()); | 2701 locs()); |
| 2699 __ Drop(2); // Discard type arguments and receiver. | 2702 __ Drop(2); // Discard type arguments and receiver. |
| 2700 } | 2703 } |
| 2701 | 2704 |
| 2702 } // namespace dart | 2705 } // namespace dart |
| 2703 | 2706 |
| 2704 #endif // defined TARGET_ARCH_ARM | 2707 #endif // defined TARGET_ARCH_ARM |
| 2705 | 2708 |
| OLD | NEW |