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/compiler.h" | 10 #include "vm/compiler.h" |
11 #include "vm/dart_entry.h" | 11 #include "vm/dart_entry.h" |
12 #include "vm/flow_graph.h" | 12 #include "vm/flow_graph.h" |
13 #include "vm/flow_graph_compiler.h" | 13 #include "vm/flow_graph_compiler.h" |
14 #include "vm/flow_graph_range_analysis.h" | 14 #include "vm/flow_graph_range_analysis.h" |
15 #include "vm/locations.h" | 15 #include "vm/locations.h" |
16 #include "vm/object_store.h" | 16 #include "vm/object_store.h" |
17 #include "vm/parser.h" | 17 #include "vm/parser.h" |
18 #include "vm/simulator.h" | 18 #include "vm/simulator.h" |
19 #include "vm/stack_frame.h" | 19 #include "vm/stack_frame.h" |
20 #include "vm/stub_code.h" | 20 #include "vm/stub_code.h" |
21 #include "vm/symbols.h" | 21 #include "vm/symbols.h" |
22 | 22 |
23 #define __ compiler->assembler()-> | 23 #define __ compiler->assembler()-> |
| 24 #define Z (compiler->zone()) |
24 | 25 |
25 namespace dart { | 26 namespace dart { |
26 | 27 |
27 // Generic summary for call instructions that have all arguments pushed | 28 // Generic summary for call instructions that have all arguments pushed |
28 // on the stack and return the result in a fixed register V0. | 29 // on the stack and return the result in a fixed register V0. |
29 LocationSummary* Instruction::MakeCallSummary(Zone* zone) { | 30 LocationSummary* Instruction::MakeCallSummary(Zone* zone) { |
30 LocationSummary* result = new(zone) LocationSummary( | 31 LocationSummary* result = new(zone) LocationSummary( |
31 zone, 0, 0, LocationSummary::kCall); | 32 zone, 0, 0, LocationSummary::kCall); |
32 result->set_out(0, Location::RegisterLocation(V0)); | 33 result->set_out(0, Location::RegisterLocation(V0)); |
33 return result; | 34 return result; |
(...skipping 1600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1634 locs()->temp(locs()->temp_count() - 1).reg() : kNoRegister; | 1635 locs()->temp(locs()->temp_count() - 1).reg() : kNoRegister; |
1635 | 1636 |
1636 Label ok, fail_label; | 1637 Label ok, fail_label; |
1637 | 1638 |
1638 Label* deopt = compiler->is_optimizing() ? | 1639 Label* deopt = compiler->is_optimizing() ? |
1639 compiler->AddDeoptStub(deopt_id(), ICData::kDeoptGuardField) : NULL; | 1640 compiler->AddDeoptStub(deopt_id(), ICData::kDeoptGuardField) : NULL; |
1640 | 1641 |
1641 Label* fail = (deopt != NULL) ? deopt : &fail_label; | 1642 Label* fail = (deopt != NULL) ? deopt : &fail_label; |
1642 | 1643 |
1643 if (emit_full_guard) { | 1644 if (emit_full_guard) { |
1644 __ LoadObject(field_reg, Field::ZoneHandle(field().raw())); | 1645 __ LoadObject(field_reg, Field::ZoneHandle(field().Original())); |
1645 | 1646 |
1646 FieldAddress field_cid_operand(field_reg, Field::guarded_cid_offset()); | 1647 FieldAddress field_cid_operand(field_reg, Field::guarded_cid_offset()); |
1647 FieldAddress field_nullability_operand( | 1648 FieldAddress field_nullability_operand( |
1648 field_reg, Field::is_nullable_offset()); | 1649 field_reg, Field::is_nullable_offset()); |
1649 | 1650 |
1650 if (value_cid == kDynamicCid) { | 1651 if (value_cid == kDynamicCid) { |
1651 LoadValueCid(compiler, value_cid_reg, value_reg); | 1652 LoadValueCid(compiler, value_cid_reg, value_reg); |
1652 | 1653 |
1653 __ lhu(CMPRES1, field_cid_operand); | 1654 __ lhu(CMPRES1, field_cid_operand); |
1654 __ beq(value_cid_reg, CMPRES1, &ok); | 1655 __ beq(value_cid_reg, CMPRES1, &ok); |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1779 compiler->AddDeoptStub(deopt_id(), ICData::kDeoptGuardField) : NULL; | 1780 compiler->AddDeoptStub(deopt_id(), ICData::kDeoptGuardField) : NULL; |
1780 | 1781 |
1781 const Register value_reg = locs()->in(0).reg(); | 1782 const Register value_reg = locs()->in(0).reg(); |
1782 | 1783 |
1783 if (!compiler->is_optimizing() || | 1784 if (!compiler->is_optimizing() || |
1784 (field().guarded_list_length() == Field::kUnknownFixedLength)) { | 1785 (field().guarded_list_length() == Field::kUnknownFixedLength)) { |
1785 const Register field_reg = locs()->temp(0).reg(); | 1786 const Register field_reg = locs()->temp(0).reg(); |
1786 | 1787 |
1787 Label ok; | 1788 Label ok; |
1788 | 1789 |
1789 __ LoadObject(field_reg, Field::ZoneHandle(field().raw())); | 1790 __ LoadObject(field_reg, Field::ZoneHandle(field().Original())); |
1790 | 1791 |
1791 __ lb(CMPRES1, FieldAddress(field_reg, | 1792 __ lb(CMPRES1, FieldAddress(field_reg, |
1792 Field::guarded_list_length_in_object_offset_offset())); | 1793 Field::guarded_list_length_in_object_offset_offset())); |
1793 __ blez(CMPRES1, &ok); | 1794 __ blez(CMPRES1, &ok); |
1794 | 1795 |
1795 __ lw(CMPRES2, FieldAddress(field_reg, | 1796 __ lw(CMPRES2, FieldAddress(field_reg, |
1796 Field::guarded_list_length_offset())); | 1797 Field::guarded_list_length_offset())); |
1797 | 1798 |
1798 // Load the length from the value. GuardFieldClass already verified that | 1799 // Load the length from the value. GuardFieldClass already verified that |
1799 // value's class matches guarded class id of the field. | 1800 // value's class matches guarded class id of the field. |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1994 | 1995 |
1995 if (ShouldEmitStoreBarrier()) { | 1996 if (ShouldEmitStoreBarrier()) { |
1996 // Value input is a writable register and should be manually preserved | 1997 // Value input is a writable register and should be manually preserved |
1997 // across allocation slow-path. | 1998 // across allocation slow-path. |
1998 locs()->live_registers()->Add(locs()->in(1), kTagged); | 1999 locs()->live_registers()->Add(locs()->in(1), kTagged); |
1999 } | 2000 } |
2000 | 2001 |
2001 Label store_pointer; | 2002 Label store_pointer; |
2002 Label store_double; | 2003 Label store_double; |
2003 | 2004 |
2004 __ LoadObject(temp, Field::ZoneHandle(field().raw())); | 2005 __ LoadObject(temp, Field::ZoneHandle(Z, field().Original())); |
2005 | 2006 |
2006 __ lhu(temp2, FieldAddress(temp, Field::is_nullable_offset())); | 2007 __ lhu(temp2, FieldAddress(temp, Field::is_nullable_offset())); |
2007 __ BranchEqual(temp2, Immediate(kNullCid), &store_pointer); | 2008 __ BranchEqual(temp2, Immediate(kNullCid), &store_pointer); |
2008 | 2009 |
2009 __ lbu(temp2, FieldAddress(temp, Field::kind_bits_offset())); | 2010 __ lbu(temp2, FieldAddress(temp, Field::kind_bits_offset())); |
2010 __ andi(CMPRES1, temp2, Immediate(1 << Field::kUnboxingCandidateBit)); | 2011 __ andi(CMPRES1, temp2, Immediate(1 << Field::kUnboxingCandidateBit)); |
2011 __ beq(CMPRES1, ZR, &store_pointer); | 2012 __ beq(CMPRES1, ZR, &store_pointer); |
2012 | 2013 |
2013 __ lhu(temp2, FieldAddress(temp, Field::guarded_cid_offset())); | 2014 __ lhu(temp2, FieldAddress(temp, Field::guarded_cid_offset())); |
2014 __ BranchEqual(temp2, Immediate(kDoubleCid), &store_double); | 2015 __ BranchEqual(temp2, Immediate(kDoubleCid), &store_double); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2100 locs->set_temp(0, Location::RequiresRegister()); | 2101 locs->set_temp(0, Location::RequiresRegister()); |
2101 return locs; | 2102 return locs; |
2102 } | 2103 } |
2103 | 2104 |
2104 | 2105 |
2105 void StoreStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2106 void StoreStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
2106 __ Comment("StoreStaticFieldInstr"); | 2107 __ Comment("StoreStaticFieldInstr"); |
2107 Register value = locs()->in(0).reg(); | 2108 Register value = locs()->in(0).reg(); |
2108 Register temp = locs()->temp(0).reg(); | 2109 Register temp = locs()->temp(0).reg(); |
2109 | 2110 |
2110 __ LoadObject(temp, field()); | 2111 __ LoadObject(temp, Field::ZoneHandle(Z, field().Original())); |
2111 if (this->value()->NeedsStoreBuffer()) { | 2112 if (this->value()->NeedsStoreBuffer()) { |
2112 __ StoreIntoObject(temp, | 2113 __ StoreIntoObject(temp, |
2113 FieldAddress(temp, Field::static_value_offset()), | 2114 FieldAddress(temp, Field::static_value_offset()), |
2114 value, | 2115 value, |
2115 CanValueBeSmi()); | 2116 CanValueBeSmi()); |
2116 } else { | 2117 } else { |
2117 __ StoreIntoObjectNoBarrier( | 2118 __ StoreIntoObjectNoBarrier( |
2118 temp, FieldAddress(temp, Field::static_value_offset()), value); | 2119 temp, FieldAddress(temp, Field::static_value_offset()), value); |
2119 } | 2120 } |
2120 } | 2121 } |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2310 | 2311 |
2311 Label done; | 2312 Label done; |
2312 Register result_reg = locs()->out(0).reg(); | 2313 Register result_reg = locs()->out(0).reg(); |
2313 if (IsPotentialUnboxedLoad()) { | 2314 if (IsPotentialUnboxedLoad()) { |
2314 Register temp = locs()->temp(1).reg(); | 2315 Register temp = locs()->temp(1).reg(); |
2315 DRegister value = locs()->temp(0).fpu_reg(); | 2316 DRegister value = locs()->temp(0).fpu_reg(); |
2316 | 2317 |
2317 Label load_pointer; | 2318 Label load_pointer; |
2318 Label load_double; | 2319 Label load_double; |
2319 | 2320 |
2320 __ LoadObject(result_reg, Field::ZoneHandle(field()->raw())); | 2321 __ LoadObject(result_reg, Field::ZoneHandle(field()->Original())); |
2321 | 2322 |
2322 FieldAddress field_cid_operand(result_reg, Field::guarded_cid_offset()); | 2323 FieldAddress field_cid_operand(result_reg, Field::guarded_cid_offset()); |
2323 FieldAddress field_nullability_operand(result_reg, | 2324 FieldAddress field_nullability_operand(result_reg, |
2324 Field::is_nullable_offset()); | 2325 Field::is_nullable_offset()); |
2325 | 2326 |
2326 __ lhu(temp, field_nullability_operand); | 2327 __ lhu(temp, field_nullability_operand); |
2327 __ BranchEqual(temp, Immediate(kNullCid), &load_pointer); | 2328 __ BranchEqual(temp, Immediate(kNullCid), &load_pointer); |
2328 | 2329 |
2329 __ lhu(temp, field_cid_operand); | 2330 __ lhu(temp, field_cid_operand); |
2330 __ BranchEqual(temp, Immediate(kDoubleCid), &load_double); | 2331 __ BranchEqual(temp, Immediate(kDoubleCid), &load_double); |
(...skipping 3266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5597 1, | 5598 1, |
5598 locs()); | 5599 locs()); |
5599 __ lw(result, Address(SP, 1 * kWordSize)); | 5600 __ lw(result, Address(SP, 1 * kWordSize)); |
5600 __ addiu(SP, SP, Immediate(2 * kWordSize)); | 5601 __ addiu(SP, SP, Immediate(2 * kWordSize)); |
5601 } | 5602 } |
5602 | 5603 |
5603 | 5604 |
5604 } // namespace dart | 5605 } // namespace dart |
5605 | 5606 |
5606 #endif // defined TARGET_ARCH_MIPS | 5607 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |