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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
93 ASSERT(fp_sp_dist <= 0); | 93 ASSERT(fp_sp_dist <= 0); |
94 __ subu(T2, SP, FP); | 94 __ subu(T2, SP, FP); |
95 | 95 |
96 __ BranchEqual(T2, fp_sp_dist, &stack_ok); | 96 __ BranchEqual(T2, fp_sp_dist, &stack_ok); |
97 __ break_(0); | 97 __ break_(0); |
98 | 98 |
99 __ Bind(&stack_ok); | 99 __ Bind(&stack_ok); |
100 } | 100 } |
101 #endif | 101 #endif |
102 __ LeaveDartFrame(); | 102 __ LeaveDartFrame(); |
103 __ Ret(); | 103 __ Ret(); |
regis
2013/04/25 17:27:15
I would leave a comment here indicating that this
zra
2013/04/25 17:47:35
Done.
| |
104 | |
105 // Generate 2 NOP instructions so that the debugger can patch the return | |
106 // pattern (1 instruction) with a call to the debug stub (3 instructions). | |
107 __ nop(); | |
108 __ nop(); | |
109 compiler->AddCurrentDescriptor(PcDescriptors::kReturn, | 104 compiler->AddCurrentDescriptor(PcDescriptors::kReturn, |
110 Isolate::kNoDeoptId, | 105 Isolate::kNoDeoptId, |
111 token_pos()); | 106 token_pos()); |
112 } | 107 } |
113 | 108 |
114 | 109 |
115 bool IfThenElseInstr::IsSupported() { | 110 bool IfThenElseInstr::IsSupported() { |
116 return false; | 111 return false; |
117 } | 112 } |
118 | 113 |
(...skipping 1556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1675 __ AddImmediate(result, left, imm); | 1670 __ AddImmediate(result, left, imm); |
1676 } else { | 1671 } else { |
1677 __ AddImmediateDetectOverflow(result, left, imm, CMPRES); | 1672 __ AddImmediateDetectOverflow(result, left, imm, CMPRES); |
1678 __ bltz(CMPRES, deopt); | 1673 __ bltz(CMPRES, deopt); |
1679 } | 1674 } |
1680 break; | 1675 break; |
1681 } | 1676 } |
1682 case Token::kMUL: { | 1677 case Token::kMUL: { |
1683 // Keep left value tagged and untag right value. | 1678 // Keep left value tagged and untag right value. |
1684 const intptr_t value = Smi::Cast(constant).Value(); | 1679 const intptr_t value = Smi::Cast(constant).Value(); |
1685 if (value == 2) { | 1680 if (deopt == NULL) { |
1686 __ sll(result, left, 1); | 1681 if (value == 2) { |
1682 __ sll(result, left, 1); | |
1683 } else { | |
1684 __ LoadImmediate(TMP1, value); | |
1685 __ mult(left, TMP1); | |
1686 __ mflo(result); | |
1687 } | |
1687 } else { | 1688 } else { |
1688 __ LoadImmediate(TMP1, value); | 1689 if (value == 2) { |
1689 __ mult(left, TMP1); | 1690 __ sra(TMP1, left, 31); // TMP1 = sign of left. |
1690 __ mflo(result); | 1691 __ sll(result, left, 1); |
1691 } | 1692 } else { |
1692 if (deopt != NULL) { | 1693 __ LoadImmediate(TMP1, value); |
1693 UNIMPLEMENTED(); | 1694 __ mult(left, TMP1); |
1695 __ mflo(result); | |
1696 __ mfhi(TMP1); | |
1697 } | |
1698 __ sra(TMP2, result, 31); | |
1699 __ bne(TMP1, TMP2, deopt); | |
1694 } | 1700 } |
1695 break; | 1701 break; |
1696 } | 1702 } |
1697 case Token::kTRUNCDIV: { | 1703 case Token::kTRUNCDIV: { |
1698 UNIMPLEMENTED(); | 1704 UNIMPLEMENTED(); |
1699 break; | 1705 break; |
1700 } | 1706 } |
1701 case Token::kBIT_AND: { | 1707 case Token::kBIT_AND: { |
1702 // No overflow check. | 1708 // No overflow check. |
1703 if (Utils::IsUint(kImmBits, imm)) { | 1709 if (Utils::IsUint(kImmBits, imm)) { |
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2372 Register result = locs()->out().reg(); | 2378 Register result = locs()->out().reg(); |
2373 | 2379 |
2374 __ LoadObject(result, Bool::True()); | 2380 __ LoadObject(result, Bool::True()); |
2375 __ LoadObject(TMP1, Bool::False()); | 2381 __ LoadObject(TMP1, Bool::False()); |
2376 __ subu(CMPRES, value, result); | 2382 __ subu(CMPRES, value, result); |
2377 __ movz(result, TMP1, CMPRES); // If value is True, move False into result. | 2383 __ movz(result, TMP1, CMPRES); // If value is True, move False into result. |
2378 } | 2384 } |
2379 | 2385 |
2380 | 2386 |
2381 LocationSummary* ChainContextInstr::MakeLocationSummary() const { | 2387 LocationSummary* ChainContextInstr::MakeLocationSummary() const { |
2382 UNIMPLEMENTED(); | 2388 return LocationSummary::Make(1, |
2383 return NULL; | 2389 Location::NoLocation(), |
2390 LocationSummary::kNoCall); | |
2384 } | 2391 } |
2385 | 2392 |
2386 | 2393 |
2387 void ChainContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2394 void ChainContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
2388 UNIMPLEMENTED(); | 2395 Register context_value = locs()->in(0).reg(); |
2396 | |
2397 // Chain the new context in context_value to its parent in CTX. | |
2398 __ StoreIntoObject(context_value, | |
2399 FieldAddress(context_value, Context::parent_offset()), | |
2400 CTX); | |
2401 // Set new context as current context. | |
2402 __ mov(CTX, context_value); | |
2389 } | 2403 } |
2390 | 2404 |
2391 | 2405 |
2392 LocationSummary* StoreVMFieldInstr::MakeLocationSummary() const { | 2406 LocationSummary* StoreVMFieldInstr::MakeLocationSummary() const { |
2393 UNIMPLEMENTED(); | 2407 const intptr_t kNumInputs = 2; |
2394 return NULL; | 2408 const intptr_t kNumTemps = 0; |
2409 LocationSummary* locs = | |
2410 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); | |
2411 locs->set_in(0, value()->NeedsStoreBuffer() ? Location::WritableRegister() | |
2412 : Location::RequiresRegister()); | |
2413 locs->set_in(1, Location::RequiresRegister()); | |
2414 return locs; | |
2395 } | 2415 } |
2396 | 2416 |
2397 | 2417 |
2398 void StoreVMFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2418 void StoreVMFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
2399 UNIMPLEMENTED(); | 2419 Register value_reg = locs()->in(0).reg(); |
2420 Register dest_reg = locs()->in(1).reg(); | |
2421 | |
2422 if (value()->NeedsStoreBuffer()) { | |
2423 __ StoreIntoObject(dest_reg, FieldAddress(dest_reg, offset_in_bytes()), | |
2424 value_reg); | |
2425 } else { | |
2426 __ StoreIntoObjectNoBarrier( | |
2427 dest_reg, FieldAddress(dest_reg, offset_in_bytes()), value_reg); | |
2428 } | |
2400 } | 2429 } |
2401 | 2430 |
2402 | 2431 |
2403 LocationSummary* AllocateObjectInstr::MakeLocationSummary() const { | 2432 LocationSummary* AllocateObjectInstr::MakeLocationSummary() const { |
2404 return MakeCallSummary(); | 2433 return MakeCallSummary(); |
2405 } | 2434 } |
2406 | 2435 |
2407 | 2436 |
2408 void AllocateObjectInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2437 void AllocateObjectInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
2409 __ TraceSimMsg("AllocateObjectInstr"); | 2438 __ TraceSimMsg("AllocateObjectInstr"); |
(...skipping 23 matching lines...) Expand all Loading... | |
2433 &label, | 2462 &label, |
2434 PcDescriptors::kOther, | 2463 PcDescriptors::kOther, |
2435 locs()); | 2464 locs()); |
2436 __ Drop(2); // Discard type arguments and receiver. | 2465 __ Drop(2); // Discard type arguments and receiver. |
2437 } | 2466 } |
2438 | 2467 |
2439 } // namespace dart | 2468 } // namespace dart |
2440 | 2469 |
2441 #endif // defined TARGET_ARCH_MIPS | 2470 #endif // defined TARGET_ARCH_MIPS |
2442 | 2471 |
OLD | NEW |