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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 intptr_t fp_sp_dist = | 87 const intptr_t fp_sp_dist = |
88 (kFirstLocalSlotIndex + 1 - compiler->StackSize()) * kWordSize; | 88 (kFirstLocalSlotFromFp + 1 - compiler->StackSize()) * kWordSize; |
89 ASSERT(fp_sp_dist <= 0); | 89 ASSERT(fp_sp_dist <= 0); |
90 __ movl(EDI, ESP); | 90 __ movl(EDI, ESP); |
91 __ subl(EDI, EBP); | 91 __ subl(EDI, EBP); |
92 __ cmpl(EDI, Immediate(fp_sp_dist)); | 92 __ cmpl(EDI, Immediate(fp_sp_dist)); |
93 __ j(EQUAL, &done, Assembler::kNearJump); | 93 __ j(EQUAL, &done, Assembler::kNearJump); |
94 __ int3(); | 94 __ int3(); |
95 __ Bind(&done); | 95 __ Bind(&done); |
96 } | 96 } |
97 #endif | 97 #endif |
98 __ LeaveFrame(); | 98 __ LeaveFrame(); |
(...skipping 942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1041 void NativeCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 1041 void NativeCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
1042 ASSERT(locs()->temp(0).reg() == EAX); | 1042 ASSERT(locs()->temp(0).reg() == EAX); |
1043 ASSERT(locs()->temp(1).reg() == ECX); | 1043 ASSERT(locs()->temp(1).reg() == ECX); |
1044 ASSERT(locs()->temp(2).reg() == EDX); | 1044 ASSERT(locs()->temp(2).reg() == EDX); |
1045 Register result = locs()->out().reg(); | 1045 Register result = locs()->out().reg(); |
1046 | 1046 |
1047 // Push the result place holder initialized to NULL. | 1047 // Push the result place holder initialized to NULL. |
1048 __ PushObject(Object::ZoneHandle()); | 1048 __ PushObject(Object::ZoneHandle()); |
1049 // Pass a pointer to the first argument in EAX. | 1049 // Pass a pointer to the first argument in EAX. |
1050 if (!function().HasOptionalParameters()) { | 1050 if (!function().HasOptionalParameters()) { |
1051 __ leal(EAX, Address(EBP, (kLastParamSlotIndex + | 1051 __ leal(EAX, Address(EBP, (kParamEndSlotFromFp + |
1052 function().NumParameters() - 1) * kWordSize)); | 1052 function().NumParameters()) * kWordSize)); |
1053 } else { | 1053 } else { |
1054 __ leal(EAX, Address(EBP, kFirstLocalSlotIndex * kWordSize)); | 1054 __ leal(EAX, Address(EBP, kFirstLocalSlotFromFp * kWordSize)); |
1055 } | 1055 } |
1056 __ movl(ECX, Immediate(reinterpret_cast<uword>(native_c_function()))); | 1056 __ movl(ECX, Immediate(reinterpret_cast<uword>(native_c_function()))); |
1057 __ movl(EDX, Immediate(NativeArguments::ComputeArgcTag(function()))); | 1057 __ movl(EDX, Immediate(NativeArguments::ComputeArgcTag(function()))); |
1058 compiler->GenerateCall(token_pos(), | 1058 compiler->GenerateCall(token_pos(), |
1059 &StubCode::CallNativeCFunctionLabel(), | 1059 &StubCode::CallNativeCFunctionLabel(), |
1060 PcDescriptors::kOther, | 1060 PcDescriptors::kOther, |
1061 locs()); | 1061 locs()); |
1062 __ popl(result); | 1062 __ popl(result); |
1063 } | 1063 } |
1064 | 1064 |
(...skipping 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2075 LocationSummary::kNoCall); | 2075 LocationSummary::kNoCall); |
2076 } | 2076 } |
2077 | 2077 |
2078 | 2078 |
2079 // Restore stack and initialize the two exception variables: | 2079 // Restore stack and initialize the two exception variables: |
2080 // exception and stack trace variables. | 2080 // exception and stack trace variables. |
2081 void CatchEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2081 void CatchEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
2082 // Restore ESP from EBP as we are coming from a throw and the code for | 2082 // Restore ESP from EBP as we are coming from a throw and the code for |
2083 // popping arguments has not been run. | 2083 // popping arguments has not been run. |
2084 const intptr_t fp_sp_dist = | 2084 const intptr_t fp_sp_dist = |
2085 (kFirstLocalSlotIndex + 1 - compiler->StackSize()) * kWordSize; | 2085 (kFirstLocalSlotFromFp + 1 - compiler->StackSize()) * kWordSize; |
2086 ASSERT(fp_sp_dist <= 0); | 2086 ASSERT(fp_sp_dist <= 0); |
2087 __ leal(ESP, Address(EBP, fp_sp_dist)); | 2087 __ leal(ESP, Address(EBP, fp_sp_dist)); |
2088 | 2088 |
2089 ASSERT(!exception_var().is_captured()); | 2089 ASSERT(!exception_var().is_captured()); |
2090 ASSERT(!stacktrace_var().is_captured()); | 2090 ASSERT(!stacktrace_var().is_captured()); |
2091 __ movl(Address(EBP, exception_var().index() * kWordSize), | 2091 __ movl(Address(EBP, exception_var().index() * kWordSize), |
2092 kExceptionObjectReg); | 2092 kExceptionObjectReg); |
2093 __ movl(Address(EBP, stacktrace_var().index() * kWordSize), | 2093 __ movl(Address(EBP, stacktrace_var().index() * kWordSize), |
2094 kStackTraceObjectReg); | 2094 kStackTraceObjectReg); |
2095 } | 2095 } |
(...skipping 2327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4423 PcDescriptors::kOther, | 4423 PcDescriptors::kOther, |
4424 locs()); | 4424 locs()); |
4425 __ Drop(2); // Discard type arguments and receiver. | 4425 __ Drop(2); // Discard type arguments and receiver. |
4426 } | 4426 } |
4427 | 4427 |
4428 } // namespace dart | 4428 } // namespace dart |
4429 | 4429 |
4430 #undef __ | 4430 #undef __ |
4431 | 4431 |
4432 #endif // defined TARGET_ARCH_IA32 | 4432 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |