| 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 "lib/error.h" | 10 #include "lib/error.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 Register result = locs()->in(0).reg(); | 77 Register result = locs()->in(0).reg(); |
| 78 ASSERT(result == EAX); | 78 ASSERT(result == EAX); |
| 79 #if defined(DEBUG) | 79 #if defined(DEBUG) |
| 80 // TODO(srdjan): Fix for functions with finally clause. | 80 // TODO(srdjan): Fix for functions with finally clause. |
| 81 // A finally clause may leave a previously pushed return value if it | 81 // A finally clause may leave a previously pushed return value if it |
| 82 // has its own return instruction. Method that have finally are currently | 82 // has its own return instruction. Method that have finally are currently |
| 83 // not optimized. | 83 // not optimized. |
| 84 if (!compiler->HasFinally()) { | 84 if (!compiler->HasFinally()) { |
| 85 __ Comment("Stack Check"); | 85 __ Comment("Stack Check"); |
| 86 Label done; | 86 Label done; |
| 87 const int sp_fp_dist = compiler->StackSize() + (-kFirstLocalSlotIndex - 1); | 87 const intptr_t fp_sp_dist = |
| 88 __ movl(EDI, EBP); | 88 (kFirstLocalSlotIndex + 1 - compiler->StackSize()) * kWordSize; |
| 89 __ subl(EDI, ESP); | 89 ASSERT(fp_sp_dist <= 0); |
| 90 __ cmpl(EDI, Immediate(sp_fp_dist * kWordSize)); | 90 __ movl(EDI, ESP); |
| 91 __ subl(EDI, EBP); |
| 92 __ cmpl(EDI, Immediate(fp_sp_dist)); |
| 91 __ j(EQUAL, &done, Assembler::kNearJump); | 93 __ j(EQUAL, &done, Assembler::kNearJump); |
| 92 __ int3(); | 94 __ int3(); |
| 93 __ Bind(&done); | 95 __ Bind(&done); |
| 94 } | 96 } |
| 95 #endif | 97 #endif |
| 96 __ LeaveFrame(); | 98 __ LeaveFrame(); |
| 97 __ ret(); | 99 __ ret(); |
| 98 | 100 |
| 99 // Generate 1 byte NOP so that the debugger can patch the | 101 // Generate 1 byte NOP so that the debugger can patch the |
| 100 // return pattern with a call to the debug stub. | 102 // return pattern with a call to the debug stub. |
| (...skipping 1995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2096 LocationSummary* CatchEntryInstr::MakeLocationSummary() const { | 2098 LocationSummary* CatchEntryInstr::MakeLocationSummary() const { |
| 2097 return LocationSummary::Make(0, | 2099 return LocationSummary::Make(0, |
| 2098 Location::NoLocation(), | 2100 Location::NoLocation(), |
| 2099 LocationSummary::kNoCall); | 2101 LocationSummary::kNoCall); |
| 2100 } | 2102 } |
| 2101 | 2103 |
| 2102 | 2104 |
| 2103 // Restore stack and initialize the two exception variables: | 2105 // Restore stack and initialize the two exception variables: |
| 2104 // exception and stack trace variables. | 2106 // exception and stack trace variables. |
| 2105 void CatchEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2107 void CatchEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2106 // Restore RSP from RBP as we are coming from a throw and the code for | 2108 // Restore ESP from EBP as we are coming from a throw and the code for |
| 2107 // popping arguments has not been run. | 2109 // popping arguments has not been run. |
| 2108 const intptr_t locals_space_size = compiler->StackSize() * kWordSize; | 2110 const intptr_t fp_sp_dist = |
| 2109 ASSERT(locals_space_size >= 0); | 2111 (kFirstLocalSlotIndex + 1 - compiler->StackSize()) * kWordSize; |
| 2110 const intptr_t offset_size = | 2112 ASSERT(fp_sp_dist <= 0); |
| 2111 -locals_space_size + FlowGraphCompiler::kLocalsOffsetFromFP; | 2113 __ leal(ESP, Address(EBP, fp_sp_dist)); |
| 2112 __ leal(ESP, Address(EBP, offset_size)); | |
| 2113 | 2114 |
| 2114 ASSERT(!exception_var().is_captured()); | 2115 ASSERT(!exception_var().is_captured()); |
| 2115 ASSERT(!stacktrace_var().is_captured()); | 2116 ASSERT(!stacktrace_var().is_captured()); |
| 2116 __ movl(Address(EBP, exception_var().index() * kWordSize), | 2117 __ movl(Address(EBP, exception_var().index() * kWordSize), |
| 2117 kExceptionObjectReg); | 2118 kExceptionObjectReg); |
| 2118 __ movl(Address(EBP, stacktrace_var().index() * kWordSize), | 2119 __ movl(Address(EBP, stacktrace_var().index() * kWordSize), |
| 2119 kStackTraceObjectReg); | 2120 kStackTraceObjectReg); |
| 2120 } | 2121 } |
| 2121 | 2122 |
| 2122 | 2123 |
| (...skipping 1848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3971 PcDescriptors::kOther, | 3972 PcDescriptors::kOther, |
| 3972 locs()); | 3973 locs()); |
| 3973 __ Drop(2); // Discard type arguments and receiver. | 3974 __ Drop(2); // Discard type arguments and receiver. |
| 3974 } | 3975 } |
| 3975 | 3976 |
| 3976 } // namespace dart | 3977 } // namespace dart |
| 3977 | 3978 |
| 3978 #undef __ | 3979 #undef __ |
| 3979 | 3980 |
| 3980 #endif // defined TARGET_ARCH_IA32 | 3981 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |