| 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 "lib/error.h" | 10 #include "lib/error.h" |
| (...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 712 if (operands_class_id() == kDoubleCid) { | 712 if (operands_class_id() == kDoubleCid) { |
| 713 EmitDoubleComparisonOp(compiler, *locs(), kind(), NULL); | 713 EmitDoubleComparisonOp(compiler, *locs(), kind(), NULL); |
| 714 return; | 714 return; |
| 715 } | 715 } |
| 716 | 716 |
| 717 // Push arguments for the call. | 717 // Push arguments for the call. |
| 718 // TODO(fschneider): Split this instruction into different types to avoid | 718 // TODO(fschneider): Split this instruction into different types to avoid |
| 719 // explicitly pushing arguments to the call here. | 719 // explicitly pushing arguments to the call here. |
| 720 Register left = locs()->in(0).reg(); | 720 Register left = locs()->in(0).reg(); |
| 721 Register right = locs()->in(1).reg(); | 721 Register right = locs()->in(1).reg(); |
| 722 __ Push(left); | 722 __ addiu(SP, SP, Immediate(-2 * kWordSize)); |
| 723 __ Push(right); | 723 __ sw(left, Address(SP, 1 * kWordSize)); |
| 724 __ sw(right, Address(SP, 0 * kWordSize)); |
| 724 if (HasICData() && (ic_data()->NumberOfChecks() > 0)) { | 725 if (HasICData() && (ic_data()->NumberOfChecks() > 0)) { |
| 725 Label* deopt = compiler->AddDeoptStub(deopt_id(), kDeoptRelationalOp); | 726 Label* deopt = compiler->AddDeoptStub(deopt_id(), kDeoptRelationalOp); |
| 726 // Load class into A2. | 727 // Load class into A2. |
| 727 const intptr_t kNumArguments = 2; | 728 const intptr_t kNumArguments = 2; |
| 728 LoadValueCid(compiler, A2, left); | 729 LoadValueCid(compiler, A2, left); |
| 729 compiler->EmitTestAndCall(ICData::Handle(ic_data()->AsUnaryClassChecks()), | 730 compiler->EmitTestAndCall(ICData::Handle(ic_data()->AsUnaryClassChecks()), |
| 730 A2, // Class id register. | 731 A2, // Class id register. |
| 731 kNumArguments, | 732 kNumArguments, |
| 732 Array::Handle(), // No named arguments. | 733 Array::Handle(), // No named arguments. |
| 733 deopt, // Deoptimize target. | 734 deopt, // Deoptimize target. |
| (...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1143 } | 1144 } |
| 1144 } | 1145 } |
| 1145 | 1146 |
| 1146 if (deopt == NULL) { | 1147 if (deopt == NULL) { |
| 1147 ASSERT(!compiler->is_optimizing()); | 1148 ASSERT(!compiler->is_optimizing()); |
| 1148 __ Bind(fail); | 1149 __ Bind(fail); |
| 1149 | 1150 |
| 1150 __ lw(TMP1, FieldAddress(field_reg, Field::guarded_cid_offset())); | 1151 __ lw(TMP1, FieldAddress(field_reg, Field::guarded_cid_offset())); |
| 1151 __ BranchEqual(TMP1, kDynamicCid, &ok); | 1152 __ BranchEqual(TMP1, kDynamicCid, &ok); |
| 1152 | 1153 |
| 1153 __ Push(field_reg); | 1154 __ addiu(SP, SP, Immediate(-2 * kWordSize)); |
| 1154 __ Push(value_reg); | 1155 __ sw(field_reg, Address(SP, 1 * kWordSize)); |
| 1156 __ sw(value_reg, Address(SP, 0 * kWordSize)); |
| 1155 __ CallRuntime(kUpdateFieldCidRuntimeEntry); | 1157 __ CallRuntime(kUpdateFieldCidRuntimeEntry); |
| 1156 __ Drop(2); // Drop the field and the value. | 1158 __ Drop(2); // Drop the field and the value. |
| 1157 } | 1159 } |
| 1158 | 1160 |
| 1159 __ Bind(&ok); | 1161 __ Bind(&ok); |
| 1160 } | 1162 } |
| 1161 | 1163 |
| 1162 | 1164 |
| 1163 LocationSummary* StoreInstanceFieldInstr::MakeLocationSummary() const { | 1165 LocationSummary* StoreInstanceFieldInstr::MakeLocationSummary() const { |
| 1164 const intptr_t kNumInputs = 2; | 1166 const intptr_t kNumInputs = 2; |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1337 // because a null instantiator will have the wrong class (Null instead of | 1339 // because a null instantiator will have the wrong class (Null instead of |
| 1338 // TypeArguments). | 1340 // TypeArguments). |
| 1339 Label type_arguments_uninstantiated; | 1341 Label type_arguments_uninstantiated; |
| 1340 __ LoadClassId(temp, instantiator_reg); | 1342 __ LoadClassId(temp, instantiator_reg); |
| 1341 __ BranchNotEqual(temp, kTypeArgumentsCid, &type_arguments_uninstantiated); | 1343 __ BranchNotEqual(temp, kTypeArgumentsCid, &type_arguments_uninstantiated); |
| 1342 __ lw(temp, FieldAddress(instantiator_reg, TypeArguments::length_offset())); | 1344 __ lw(temp, FieldAddress(instantiator_reg, TypeArguments::length_offset())); |
| 1343 __ BranchEqual(temp, Smi::RawValue(len), &type_arguments_instantiated); | 1345 __ BranchEqual(temp, Smi::RawValue(len), &type_arguments_instantiated); |
| 1344 __ Bind(&type_arguments_uninstantiated); | 1346 __ Bind(&type_arguments_uninstantiated); |
| 1345 } | 1347 } |
| 1346 // A runtime call to instantiate the type arguments is required. | 1348 // A runtime call to instantiate the type arguments is required. |
| 1347 __ PushObject(Object::ZoneHandle()); // Make room for the result. | 1349 __ addiu(SP, SP, Immediate(-3 * kWordSize)); |
| 1348 __ PushObject(type_arguments()); | 1350 __ LoadObject(TMP1, Object::ZoneHandle()); |
| 1349 __ Push(instantiator_reg); // Push instantiator type arguments. | 1351 __ LoadObject(TMP2, type_arguments()); |
| 1352 __ sw(TMP1, Address(SP, 2 * kWordSize)); // Make room for the result. |
| 1353 __ sw(TMP2, Address(SP, 1 * kWordSize)); |
| 1354 // Push instantiator type arguments. |
| 1355 __ sw(instantiator_reg, Address(SP, 0 * kWordSize)); |
| 1356 |
| 1350 compiler->GenerateCallRuntime(token_pos(), | 1357 compiler->GenerateCallRuntime(token_pos(), |
| 1351 deopt_id(), | 1358 deopt_id(), |
| 1352 kInstantiateTypeArgumentsRuntimeEntry, | 1359 kInstantiateTypeArgumentsRuntimeEntry, |
| 1353 locs()); | 1360 locs()); |
| 1354 __ Drop(2); // Drop instantiator and uninstantiated type arguments. | 1361 // Pop instantiated type arguments. |
| 1355 __ Pop(result_reg); // Pop instantiated type arguments. | 1362 __ lw(result_reg, Address(SP, 2 * kWordSize)); |
| 1363 // Drop instantiator and uninstantiated type arguments. |
| 1364 __ addiu(SP, SP, Immediate(3 * kWordSize)); |
| 1356 __ Bind(&type_arguments_instantiated); | 1365 __ Bind(&type_arguments_instantiated); |
| 1357 ASSERT(instantiator_reg == result_reg); | 1366 ASSERT(instantiator_reg == result_reg); |
| 1358 // 'result_reg': Instantiated type arguments. | 1367 // 'result_reg': Instantiated type arguments. |
| 1359 } | 1368 } |
| 1360 | 1369 |
| 1361 | 1370 |
| 1362 LocationSummary* | 1371 LocationSummary* |
| 1363 ExtractConstructorTypeArgumentsInstr::MakeLocationSummary() const { | 1372 ExtractConstructorTypeArgumentsInstr::MakeLocationSummary() const { |
| 1364 const intptr_t kNumInputs = 1; | 1373 const intptr_t kNumInputs = 1; |
| 1365 const intptr_t kNumTemps = 1; | 1374 const intptr_t kNumTemps = 1; |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1474 // instantiated type arguments, no proper instantiator needed. | 1483 // instantiated type arguments, no proper instantiator needed. |
| 1475 __ LoadImmediate(instantiator_reg, | 1484 __ LoadImmediate(instantiator_reg, |
| 1476 Smi::RawValue(StubCode::kNoInstantiator)); | 1485 Smi::RawValue(StubCode::kNoInstantiator)); |
| 1477 } | 1486 } |
| 1478 __ Bind(&done); | 1487 __ Bind(&done); |
| 1479 // instantiator_reg: instantiator or kNoInstantiator. | 1488 // instantiator_reg: instantiator or kNoInstantiator. |
| 1480 } | 1489 } |
| 1481 | 1490 |
| 1482 | 1491 |
| 1483 LocationSummary* AllocateContextInstr::MakeLocationSummary() const { | 1492 LocationSummary* AllocateContextInstr::MakeLocationSummary() const { |
| 1484 UNIMPLEMENTED(); | 1493 const intptr_t kNumInputs = 0; |
| 1485 return NULL; | 1494 const intptr_t kNumTemps = 1; |
| 1495 LocationSummary* locs = |
| 1496 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); |
| 1497 locs->set_temp(0, Location::RegisterLocation(T1)); |
| 1498 locs->set_out(Location::RegisterLocation(V0)); |
| 1499 return locs; |
| 1486 } | 1500 } |
| 1487 | 1501 |
| 1488 | 1502 |
| 1489 void AllocateContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 1503 void AllocateContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1490 UNIMPLEMENTED(); | 1504 Register temp = T1; |
| 1505 ASSERT(locs()->temp(0).reg() == temp); |
| 1506 ASSERT(locs()->out().reg() == V0); |
| 1507 |
| 1508 __ TraceSimMsg("AllocateContextInstr"); |
| 1509 __ LoadImmediate(temp, num_context_variables()); |
| 1510 const ExternalLabel label("alloc_context", |
| 1511 StubCode::AllocateContextEntryPoint()); |
| 1512 compiler->GenerateCall(token_pos(), |
| 1513 &label, |
| 1514 PcDescriptors::kOther, |
| 1515 locs()); |
| 1491 } | 1516 } |
| 1492 | 1517 |
| 1493 | 1518 |
| 1494 LocationSummary* CloneContextInstr::MakeLocationSummary() const { | 1519 LocationSummary* CloneContextInstr::MakeLocationSummary() const { |
| 1495 UNIMPLEMENTED(); | 1520 UNIMPLEMENTED(); |
| 1496 return NULL; | 1521 return NULL; |
| 1497 } | 1522 } |
| 1498 | 1523 |
| 1499 | 1524 |
| 1500 void CloneContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 1525 void CloneContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| (...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2356 &label, | 2381 &label, |
| 2357 PcDescriptors::kOther, | 2382 PcDescriptors::kOther, |
| 2358 locs()); | 2383 locs()); |
| 2359 __ Drop(2); // Discard type arguments and receiver. | 2384 __ Drop(2); // Discard type arguments and receiver. |
| 2360 } | 2385 } |
| 2361 | 2386 |
| 2362 } // namespace dart | 2387 } // namespace dart |
| 2363 | 2388 |
| 2364 #endif // defined TARGET_ARCH_MIPS | 2389 #endif // defined TARGET_ARCH_MIPS |
| 2365 | 2390 |
| OLD | NEW |