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_MIPS. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS. |
6 #if defined(TARGET_ARCH_MIPS) | 6 #if defined(TARGET_ARCH_MIPS) |
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 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 // Call the runtime if the object is not bool::true or bool::false. | 245 // Call the runtime if the object is not bool::true or bool::false. |
246 ASSERT(locs->always_calls()); | 246 ASSERT(locs->always_calls()); |
247 Label done; | 247 Label done; |
248 __ BranchEqual(reg, Bool::True(), &done); | 248 __ BranchEqual(reg, Bool::True(), &done); |
249 __ BranchEqual(reg, Bool::False(), &done); | 249 __ BranchEqual(reg, Bool::False(), &done); |
250 | 250 |
251 __ Push(reg); // Push the source object. | 251 __ Push(reg); // Push the source object. |
252 compiler->GenerateCallRuntime(token_pos, | 252 compiler->GenerateCallRuntime(token_pos, |
253 deopt_id, | 253 deopt_id, |
254 kConditionTypeErrorRuntimeEntry, | 254 kConditionTypeErrorRuntimeEntry, |
| 255 1, |
255 locs); | 256 locs); |
256 // We should never return here. | 257 // We should never return here. |
257 __ break_(0); | 258 __ break_(0); |
258 __ Bind(&done); | 259 __ Bind(&done); |
259 } | 260 } |
260 | 261 |
261 | 262 |
262 void AssertBooleanInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 263 void AssertBooleanInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
263 Register obj = locs()->in(0).reg(); | 264 Register obj = locs()->in(0).reg(); |
264 Register result = locs()->out().reg(); | 265 Register result = locs()->out().reg(); |
(...skipping 1597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1862 if (deopt == NULL) { | 1863 if (deopt == NULL) { |
1863 ASSERT(!compiler->is_optimizing()); | 1864 ASSERT(!compiler->is_optimizing()); |
1864 __ Bind(fail); | 1865 __ Bind(fail); |
1865 | 1866 |
1866 __ lw(CMPRES1, FieldAddress(field_reg, Field::guarded_cid_offset())); | 1867 __ lw(CMPRES1, FieldAddress(field_reg, Field::guarded_cid_offset())); |
1867 __ BranchEqual(CMPRES1, kDynamicCid, &ok); | 1868 __ BranchEqual(CMPRES1, kDynamicCid, &ok); |
1868 | 1869 |
1869 __ addiu(SP, SP, Immediate(-2 * kWordSize)); | 1870 __ addiu(SP, SP, Immediate(-2 * kWordSize)); |
1870 __ sw(field_reg, Address(SP, 1 * kWordSize)); | 1871 __ sw(field_reg, Address(SP, 1 * kWordSize)); |
1871 __ sw(value_reg, Address(SP, 0 * kWordSize)); | 1872 __ sw(value_reg, Address(SP, 0 * kWordSize)); |
1872 __ CallRuntime(kUpdateFieldCidRuntimeEntry); | 1873 __ CallRuntime(kUpdateFieldCidRuntimeEntry, 2); |
1873 __ Drop(2); // Drop the field and the value. | 1874 __ Drop(2); // Drop the field and the value. |
1874 } | 1875 } |
1875 | 1876 |
1876 __ Bind(&ok); | 1877 __ Bind(&ok); |
1877 } | 1878 } |
1878 | 1879 |
1879 | 1880 |
1880 LocationSummary* StoreInstanceFieldInstr::MakeLocationSummary() const { | 1881 LocationSummary* StoreInstanceFieldInstr::MakeLocationSummary() const { |
1881 const intptr_t kNumInputs = 2; | 1882 const intptr_t kNumInputs = 2; |
1882 const intptr_t kNumTemps = 0; | 1883 const intptr_t kNumTemps = 0; |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2018 AllocateObjectWithBoundsCheckInstr::MakeLocationSummary() const { | 2019 AllocateObjectWithBoundsCheckInstr::MakeLocationSummary() const { |
2019 return MakeCallSummary(); | 2020 return MakeCallSummary(); |
2020 } | 2021 } |
2021 | 2022 |
2022 | 2023 |
2023 void AllocateObjectWithBoundsCheckInstr::EmitNativeCode( | 2024 void AllocateObjectWithBoundsCheckInstr::EmitNativeCode( |
2024 FlowGraphCompiler* compiler) { | 2025 FlowGraphCompiler* compiler) { |
2025 compiler->GenerateCallRuntime(token_pos(), | 2026 compiler->GenerateCallRuntime(token_pos(), |
2026 deopt_id(), | 2027 deopt_id(), |
2027 kAllocateObjectWithBoundsCheckRuntimeEntry, | 2028 kAllocateObjectWithBoundsCheckRuntimeEntry, |
| 2029 3, |
2028 locs()); | 2030 locs()); |
2029 __ Drop(3); | 2031 __ Drop(3); |
2030 ASSERT(locs()->out().reg() == V0); | 2032 ASSERT(locs()->out().reg() == V0); |
2031 __ Pop(V0); // Pop new instance. | 2033 __ Pop(V0); // Pop new instance. |
2032 } | 2034 } |
2033 | 2035 |
2034 | 2036 |
2035 LocationSummary* LoadFieldInstr::MakeLocationSummary() const { | 2037 LocationSummary* LoadFieldInstr::MakeLocationSummary() const { |
2036 return LocationSummary::Make(1, | 2038 return LocationSummary::Make(1, |
2037 Location::RequiresRegister(), | 2039 Location::RequiresRegister(), |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2070 __ LoadObject(TMP1, Object::ZoneHandle()); | 2072 __ LoadObject(TMP1, Object::ZoneHandle()); |
2071 __ sw(TMP1, Address(SP, 2 * kWordSize)); // Make room for the result. | 2073 __ sw(TMP1, Address(SP, 2 * kWordSize)); // Make room for the result. |
2072 __ LoadObject(TMP1, type()); | 2074 __ LoadObject(TMP1, type()); |
2073 __ sw(TMP1, Address(SP, 1 * kWordSize)); | 2075 __ sw(TMP1, Address(SP, 1 * kWordSize)); |
2074 // Push instantiator type arguments. | 2076 // Push instantiator type arguments. |
2075 __ sw(instantiator_reg, Address(SP, 0 * kWordSize)); | 2077 __ sw(instantiator_reg, Address(SP, 0 * kWordSize)); |
2076 | 2078 |
2077 compiler->GenerateCallRuntime(token_pos(), | 2079 compiler->GenerateCallRuntime(token_pos(), |
2078 deopt_id(), | 2080 deopt_id(), |
2079 kInstantiateTypeRuntimeEntry, | 2081 kInstantiateTypeRuntimeEntry, |
| 2082 2, |
2080 locs()); | 2083 locs()); |
2081 // Pop instantiated type. | 2084 // Pop instantiated type. |
2082 __ lw(result_reg, Address(SP, 2 * kWordSize)); | 2085 __ lw(result_reg, Address(SP, 2 * kWordSize)); |
2083 // Drop instantiator and uninstantiated type. | 2086 // Drop instantiator and uninstantiated type. |
2084 __ addiu(SP, SP, Immediate(3 * kWordSize)); | 2087 __ addiu(SP, SP, Immediate(3 * kWordSize)); |
2085 ASSERT(instantiator_reg == result_reg); | 2088 ASSERT(instantiator_reg == result_reg); |
2086 } | 2089 } |
2087 | 2090 |
2088 | 2091 |
2089 LocationSummary* InstantiateTypeArgumentsInstr::MakeLocationSummary() const { | 2092 LocationSummary* InstantiateTypeArgumentsInstr::MakeLocationSummary() const { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2123 __ LoadObject(TMP1, Object::ZoneHandle()); | 2126 __ LoadObject(TMP1, Object::ZoneHandle()); |
2124 __ sw(TMP1, Address(SP, 2 * kWordSize)); // Make room for the result. | 2127 __ sw(TMP1, Address(SP, 2 * kWordSize)); // Make room for the result. |
2125 __ LoadObject(TMP1, type_arguments()); | 2128 __ LoadObject(TMP1, type_arguments()); |
2126 __ sw(TMP1, Address(SP, 1 * kWordSize)); | 2129 __ sw(TMP1, Address(SP, 1 * kWordSize)); |
2127 // Push instantiator type arguments. | 2130 // Push instantiator type arguments. |
2128 __ sw(instantiator_reg, Address(SP, 0 * kWordSize)); | 2131 __ sw(instantiator_reg, Address(SP, 0 * kWordSize)); |
2129 | 2132 |
2130 compiler->GenerateCallRuntime(token_pos(), | 2133 compiler->GenerateCallRuntime(token_pos(), |
2131 deopt_id(), | 2134 deopt_id(), |
2132 kInstantiateTypeArgumentsRuntimeEntry, | 2135 kInstantiateTypeArgumentsRuntimeEntry, |
| 2136 2, |
2133 locs()); | 2137 locs()); |
2134 // Pop instantiated type arguments. | 2138 // Pop instantiated type arguments. |
2135 __ lw(result_reg, Address(SP, 2 * kWordSize)); | 2139 __ lw(result_reg, Address(SP, 2 * kWordSize)); |
2136 // Drop instantiator and uninstantiated type arguments. | 2140 // Drop instantiator and uninstantiated type arguments. |
2137 __ addiu(SP, SP, Immediate(3 * kWordSize)); | 2141 __ addiu(SP, SP, Immediate(3 * kWordSize)); |
2138 __ Bind(&type_arguments_instantiated); | 2142 __ Bind(&type_arguments_instantiated); |
2139 ASSERT(instantiator_reg == result_reg); | 2143 ASSERT(instantiator_reg == result_reg); |
2140 } | 2144 } |
2141 | 2145 |
2142 | 2146 |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2265 __ TraceSimMsg("CloneContextInstr"); | 2269 __ TraceSimMsg("CloneContextInstr"); |
2266 | 2270 |
2267 __ addiu(SP, SP, Immediate(-2 * kWordSize)); | 2271 __ addiu(SP, SP, Immediate(-2 * kWordSize)); |
2268 __ LoadObject(TMP1, Object::ZoneHandle()); // Make room for the result. | 2272 __ LoadObject(TMP1, Object::ZoneHandle()); // Make room for the result. |
2269 __ sw(TMP1, Address(SP, 1 * kWordSize)); | 2273 __ sw(TMP1, Address(SP, 1 * kWordSize)); |
2270 __ sw(context_value, Address(SP, 0 * kWordSize)); | 2274 __ sw(context_value, Address(SP, 0 * kWordSize)); |
2271 | 2275 |
2272 compiler->GenerateCallRuntime(token_pos(), | 2276 compiler->GenerateCallRuntime(token_pos(), |
2273 deopt_id(), | 2277 deopt_id(), |
2274 kCloneContextRuntimeEntry, | 2278 kCloneContextRuntimeEntry, |
| 2279 1, |
2275 locs()); | 2280 locs()); |
2276 __ lw(result, Address(SP, 1 * kWordSize)); // Get result (cloned context). | 2281 __ lw(result, Address(SP, 1 * kWordSize)); // Get result (cloned context). |
2277 __ addiu(SP, SP, Immediate(2 * kWordSize)); | 2282 __ addiu(SP, SP, Immediate(2 * kWordSize)); |
2278 } | 2283 } |
2279 | 2284 |
2280 | 2285 |
2281 LocationSummary* CatchBlockEntryInstr::MakeLocationSummary() const { | 2286 LocationSummary* CatchBlockEntryInstr::MakeLocationSummary() const { |
2282 UNREACHABLE(); | 2287 UNREACHABLE(); |
2283 return NULL; | 2288 return NULL; |
2284 } | 2289 } |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2340 __ Comment("CheckStackOverflowSlowPath"); | 2345 __ Comment("CheckStackOverflowSlowPath"); |
2341 __ Bind(entry_label()); | 2346 __ Bind(entry_label()); |
2342 compiler->SaveLiveRegisters(instruction_->locs()); | 2347 compiler->SaveLiveRegisters(instruction_->locs()); |
2343 // pending_deoptimization_env_ is needed to generate a runtime call that | 2348 // pending_deoptimization_env_ is needed to generate a runtime call that |
2344 // may throw an exception. | 2349 // may throw an exception. |
2345 ASSERT(compiler->pending_deoptimization_env_ == NULL); | 2350 ASSERT(compiler->pending_deoptimization_env_ == NULL); |
2346 compiler->pending_deoptimization_env_ = instruction_->env(); | 2351 compiler->pending_deoptimization_env_ = instruction_->env(); |
2347 compiler->GenerateCallRuntime(instruction_->token_pos(), | 2352 compiler->GenerateCallRuntime(instruction_->token_pos(), |
2348 instruction_->deopt_id(), | 2353 instruction_->deopt_id(), |
2349 kStackOverflowRuntimeEntry, | 2354 kStackOverflowRuntimeEntry, |
| 2355 0, |
2350 instruction_->locs()); | 2356 instruction_->locs()); |
2351 | 2357 |
2352 if (FLAG_use_osr && !compiler->is_optimizing() && instruction_->in_loop()) { | 2358 if (FLAG_use_osr && !compiler->is_optimizing() && instruction_->in_loop()) { |
2353 // In unoptimized code, record loop stack checks as possible OSR entries. | 2359 // In unoptimized code, record loop stack checks as possible OSR entries. |
2354 compiler->AddCurrentDescriptor(PcDescriptors::kOsrEntry, | 2360 compiler->AddCurrentDescriptor(PcDescriptors::kOsrEntry, |
2355 instruction_->deopt_id(), | 2361 instruction_->deopt_id(), |
2356 0); // No token position. | 2362 0); // No token position. |
2357 } | 2363 } |
2358 compiler->pending_deoptimization_env_ = NULL; | 2364 compiler->pending_deoptimization_env_ = NULL; |
2359 compiler->RestoreLiveRegisters(instruction_->locs()); | 2365 compiler->RestoreLiveRegisters(instruction_->locs()); |
(...skipping 1212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3572 __ ceqd(base, result); | 3578 __ ceqd(base, result); |
3573 __ bc1t(&skip_call); // base and result are 1.0. | 3579 __ bc1t(&skip_call); // base and result are 1.0. |
3574 __ b(&do_call); | 3580 __ b(&do_call); |
3575 | 3581 |
3576 __ Bind(&base_is_nan); | 3582 __ Bind(&base_is_nan); |
3577 __ movd(result, base); // base is NaN, return NaN. | 3583 __ movd(result, base); // base is NaN, return NaN. |
3578 __ b(&skip_call); | 3584 __ b(&skip_call); |
3579 } | 3585 } |
3580 __ Bind(&do_call); | 3586 __ Bind(&do_call); |
3581 // double values are passed and returned in vfp registers. | 3587 // double values are passed and returned in vfp registers. |
3582 __ CallRuntime(TargetFunction()); | 3588 __ CallRuntime(TargetFunction(), InputCount()); |
3583 __ Bind(&skip_call); | 3589 __ Bind(&skip_call); |
3584 } | 3590 } |
3585 | 3591 |
3586 | 3592 |
3587 LocationSummary* PolymorphicInstanceCallInstr::MakeLocationSummary() const { | 3593 LocationSummary* PolymorphicInstanceCallInstr::MakeLocationSummary() const { |
3588 return MakeCallSummary(); | 3594 return MakeCallSummary(); |
3589 } | 3595 } |
3590 | 3596 |
3591 | 3597 |
3592 void PolymorphicInstanceCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 3598 void PolymorphicInstanceCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3823 LocationSummary* ThrowInstr::MakeLocationSummary() const { | 3829 LocationSummary* ThrowInstr::MakeLocationSummary() const { |
3824 return new LocationSummary(0, 0, LocationSummary::kCall); | 3830 return new LocationSummary(0, 0, LocationSummary::kCall); |
3825 } | 3831 } |
3826 | 3832 |
3827 | 3833 |
3828 | 3834 |
3829 void ThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 3835 void ThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
3830 compiler->GenerateCallRuntime(token_pos(), | 3836 compiler->GenerateCallRuntime(token_pos(), |
3831 deopt_id(), | 3837 deopt_id(), |
3832 kThrowRuntimeEntry, | 3838 kThrowRuntimeEntry, |
| 3839 1, |
3833 locs()); | 3840 locs()); |
3834 __ break_(0); | 3841 __ break_(0); |
3835 } | 3842 } |
3836 | 3843 |
3837 | 3844 |
3838 LocationSummary* ReThrowInstr::MakeLocationSummary() const { | 3845 LocationSummary* ReThrowInstr::MakeLocationSummary() const { |
3839 return new LocationSummary(0, 0, LocationSummary::kCall); | 3846 return new LocationSummary(0, 0, LocationSummary::kCall); |
3840 } | 3847 } |
3841 | 3848 |
3842 | 3849 |
3843 void ReThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 3850 void ReThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
3844 compiler->GenerateCallRuntime(token_pos(), | 3851 compiler->GenerateCallRuntime(token_pos(), |
3845 deopt_id(), | 3852 deopt_id(), |
3846 kReThrowRuntimeEntry, | 3853 kReThrowRuntimeEntry, |
| 3854 2, |
3847 locs()); | 3855 locs()); |
3848 __ break_(0); | 3856 __ break_(0); |
3849 } | 3857 } |
3850 | 3858 |
3851 | 3859 |
3852 void TargetEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 3860 void TargetEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
3853 __ Bind(compiler->GetJumpLabel(this)); | 3861 __ Bind(compiler->GetJumpLabel(this)); |
3854 if (!compiler->is_optimizing()) { | 3862 if (!compiler->is_optimizing()) { |
3855 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, | 3863 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, |
3856 deopt_id_, | 3864 deopt_id_, |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4128 compiler->GenerateCall(token_pos(), | 4136 compiler->GenerateCall(token_pos(), |
4129 &label, | 4137 &label, |
4130 PcDescriptors::kOther, | 4138 PcDescriptors::kOther, |
4131 locs()); | 4139 locs()); |
4132 __ Drop(2); // Discard type arguments and receiver. | 4140 __ Drop(2); // Discard type arguments and receiver. |
4133 } | 4141 } |
4134 | 4142 |
4135 } // namespace dart | 4143 } // namespace dart |
4136 | 4144 |
4137 #endif // defined TARGET_ARCH_MIPS | 4145 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |