| 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_IA32. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. |
| 6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 } | 71 } |
| 72 | 72 |
| 73 | 73 |
| 74 // Attempt optimized compilation at return instruction instead of at the entry. | 74 // Attempt optimized compilation at return instruction instead of at the entry. |
| 75 // The entry needs to be patchable, no inlined objects are allowed in the area | 75 // The entry needs to be patchable, no inlined objects are allowed in the area |
| 76 // that will be overwritten by the patch instruction: a jump). | 76 // that will be overwritten by the patch instruction: a jump). |
| 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 == EAX); | 79 ASSERT(result == EAX); |
| 80 #if defined(DEBUG) | 80 #if defined(DEBUG) |
| 81 // TODO(srdjan): Fix for functions with finally clause. | 81 __ Comment("Stack Check"); |
| 82 // A finally clause may leave a previously pushed return value if it | 82 Label done; |
| 83 // has its own return instruction. Method that have finally are currently | 83 const intptr_t fp_sp_dist = |
| 84 // not optimized. | 84 (kFirstLocalSlotFromFp + 1 - compiler->StackSize()) * kWordSize; |
| 85 if (!compiler->HasFinally()) { | 85 ASSERT(fp_sp_dist <= 0); |
| 86 __ Comment("Stack Check"); | 86 __ movl(EDI, ESP); |
| 87 Label done; | 87 __ subl(EDI, EBP); |
| 88 const intptr_t fp_sp_dist = | 88 __ cmpl(EDI, Immediate(fp_sp_dist)); |
| 89 (kFirstLocalSlotFromFp + 1 - compiler->StackSize()) * kWordSize; | 89 __ j(EQUAL, &done, Assembler::kNearJump); |
| 90 ASSERT(fp_sp_dist <= 0); | 90 __ int3(); |
| 91 __ movl(EDI, ESP); | 91 __ Bind(&done); |
| 92 __ subl(EDI, EBP); | |
| 93 __ cmpl(EDI, Immediate(fp_sp_dist)); | |
| 94 __ j(EQUAL, &done, Assembler::kNearJump); | |
| 95 __ int3(); | |
| 96 __ Bind(&done); | |
| 97 } | |
| 98 #endif | 92 #endif |
| 99 __ LeaveFrame(); | 93 __ LeaveFrame(); |
| 100 __ ret(); | 94 __ ret(); |
| 101 } | 95 } |
| 102 | 96 |
| 103 | 97 |
| 104 LocationSummary* LoadLocalInstr::MakeLocationSummary(bool opt) const { | 98 LocationSummary* LoadLocalInstr::MakeLocationSummary(bool opt) const { |
| 105 const intptr_t kNumInputs = 0; | 99 const intptr_t kNumInputs = 0; |
| 106 const intptr_t stack_index = (local().index() < 0) | 100 const intptr_t stack_index = (local().index() < 0) |
| 107 ? kFirstLocalSlotFromFp - local().index() | 101 ? kFirstLocalSlotFromFp - local().index() |
| (...skipping 5133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5241 PcDescriptors::kOther, | 5235 PcDescriptors::kOther, |
| 5242 locs()); | 5236 locs()); |
| 5243 __ Drop(2); // Discard type arguments and receiver. | 5237 __ Drop(2); // Discard type arguments and receiver. |
| 5244 } | 5238 } |
| 5245 | 5239 |
| 5246 } // namespace dart | 5240 } // namespace dart |
| 5247 | 5241 |
| 5248 #undef __ | 5242 #undef __ |
| 5249 | 5243 |
| 5250 #endif // defined TARGET_ARCH_IA32 | 5244 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |