| 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_ARM. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM. |
| 6 #if defined(TARGET_ARCH_ARM) | 6 #if defined(TARGET_ARCH_ARM) |
| 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/cpu.h" | 11 #include "vm/cpu.h" |
| 12 #include "vm/dart_entry.h" | 12 #include "vm/dart_entry.h" |
| 13 #include "vm/flow_graph.h" | 13 #include "vm/flow_graph.h" |
| 14 #include "vm/flow_graph_compiler.h" | 14 #include "vm/flow_graph_compiler.h" |
| 15 #include "vm/flow_graph_range_analysis.h" | 15 #include "vm/flow_graph_range_analysis.h" |
| 16 #include "vm/locations.h" | 16 #include "vm/locations.h" |
| 17 #include "vm/object_store.h" | 17 #include "vm/object_store.h" |
| 18 #include "vm/parser.h" | 18 #include "vm/parser.h" |
| 19 #include "vm/simulator.h" | 19 #include "vm/simulator.h" |
| 20 #include "vm/stack_frame.h" | 20 #include "vm/stack_frame.h" |
| 21 #include "vm/stub_code.h" | 21 #include "vm/stub_code.h" |
| 22 #include "vm/symbols.h" | 22 #include "vm/symbols.h" |
| 23 | 23 |
| 24 #define __ compiler->assembler()-> | 24 #define __ compiler->assembler()-> |
| 25 #define Z (compiler->zone()) |
| 25 | 26 |
| 26 namespace dart { | 27 namespace dart { |
| 27 | 28 |
| 28 // Generic summary for call instructions that have all arguments pushed | 29 // Generic summary for call instructions that have all arguments pushed |
| 29 // on the stack and return the result in a fixed register R0. | 30 // on the stack and return the result in a fixed register R0. |
| 30 LocationSummary* Instruction::MakeCallSummary(Zone* zone) { | 31 LocationSummary* Instruction::MakeCallSummary(Zone* zone) { |
| 31 LocationSummary* result = new(zone) LocationSummary( | 32 LocationSummary* result = new(zone) LocationSummary( |
| 32 zone, 0, 0, LocationSummary::kCall); | 33 zone, 0, 0, LocationSummary::kCall); |
| 33 result->set_out(0, Location::RegisterLocation(R0)); | 34 result->set_out(0, Location::RegisterLocation(R0)); |
| 34 return result; | 35 return result; |
| (...skipping 1568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1603 locs()->temp(locs()->temp_count() - 1).reg() : kNoRegister; | 1604 locs()->temp(locs()->temp_count() - 1).reg() : kNoRegister; |
| 1604 | 1605 |
| 1605 Label ok, fail_label; | 1606 Label ok, fail_label; |
| 1606 | 1607 |
| 1607 Label* deopt = compiler->is_optimizing() ? | 1608 Label* deopt = compiler->is_optimizing() ? |
| 1608 compiler->AddDeoptStub(deopt_id(), ICData::kDeoptGuardField) : NULL; | 1609 compiler->AddDeoptStub(deopt_id(), ICData::kDeoptGuardField) : NULL; |
| 1609 | 1610 |
| 1610 Label* fail = (deopt != NULL) ? deopt : &fail_label; | 1611 Label* fail = (deopt != NULL) ? deopt : &fail_label; |
| 1611 | 1612 |
| 1612 if (emit_full_guard) { | 1613 if (emit_full_guard) { |
| 1613 __ LoadObject(field_reg, Field::ZoneHandle(field().raw())); | 1614 __ LoadObject(field_reg, Field::ZoneHandle(field().Original())); |
| 1614 | 1615 |
| 1615 FieldAddress field_cid_operand(field_reg, Field::guarded_cid_offset()); | 1616 FieldAddress field_cid_operand(field_reg, Field::guarded_cid_offset()); |
| 1616 FieldAddress field_nullability_operand( | 1617 FieldAddress field_nullability_operand( |
| 1617 field_reg, Field::is_nullable_offset()); | 1618 field_reg, Field::is_nullable_offset()); |
| 1618 | 1619 |
| 1619 if (value_cid == kDynamicCid) { | 1620 if (value_cid == kDynamicCid) { |
| 1620 LoadValueCid(compiler, value_cid_reg, value_reg); | 1621 LoadValueCid(compiler, value_cid_reg, value_reg); |
| 1621 __ ldrh(IP, field_cid_operand); | 1622 __ ldrh(IP, field_cid_operand); |
| 1622 __ cmp(value_cid_reg, Operand(IP)); | 1623 __ cmp(value_cid_reg, Operand(IP)); |
| 1623 __ b(&ok, EQ); | 1624 __ b(&ok, EQ); |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1750 const Register value_reg = locs()->in(0).reg(); | 1751 const Register value_reg = locs()->in(0).reg(); |
| 1751 | 1752 |
| 1752 if (!compiler->is_optimizing() || | 1753 if (!compiler->is_optimizing() || |
| 1753 (field().guarded_list_length() == Field::kUnknownFixedLength)) { | 1754 (field().guarded_list_length() == Field::kUnknownFixedLength)) { |
| 1754 const Register field_reg = locs()->temp(0).reg(); | 1755 const Register field_reg = locs()->temp(0).reg(); |
| 1755 const Register offset_reg = locs()->temp(1).reg(); | 1756 const Register offset_reg = locs()->temp(1).reg(); |
| 1756 const Register length_reg = locs()->temp(2).reg(); | 1757 const Register length_reg = locs()->temp(2).reg(); |
| 1757 | 1758 |
| 1758 Label ok; | 1759 Label ok; |
| 1759 | 1760 |
| 1760 __ LoadObject(field_reg, Field::ZoneHandle(field().raw())); | 1761 __ LoadObject(field_reg, Field::ZoneHandle(field().Original())); |
| 1761 | 1762 |
| 1762 __ ldrsb(offset_reg, FieldAddress(field_reg, | 1763 __ ldrsb(offset_reg, FieldAddress(field_reg, |
| 1763 Field::guarded_list_length_in_object_offset_offset())); | 1764 Field::guarded_list_length_in_object_offset_offset())); |
| 1764 __ ldr(length_reg, FieldAddress(field_reg, | 1765 __ ldr(length_reg, FieldAddress(field_reg, |
| 1765 Field::guarded_list_length_offset())); | 1766 Field::guarded_list_length_offset())); |
| 1766 | 1767 |
| 1767 __ tst(offset_reg, Operand(offset_reg)); | 1768 __ tst(offset_reg, Operand(offset_reg)); |
| 1768 __ b(&ok, MI); | 1769 __ b(&ok, MI); |
| 1769 | 1770 |
| 1770 // Load the length from the value. GuardFieldClass already verified that | 1771 // Load the length from the value. GuardFieldClass already verified that |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2107 // Value input is a writable register and should be manually preserved | 2108 // Value input is a writable register and should be manually preserved |
| 2108 // across allocation slow-path. | 2109 // across allocation slow-path. |
| 2109 locs()->live_registers()->Add(locs()->in(1), kTagged); | 2110 locs()->live_registers()->Add(locs()->in(1), kTagged); |
| 2110 } | 2111 } |
| 2111 | 2112 |
| 2112 Label store_pointer; | 2113 Label store_pointer; |
| 2113 Label store_double; | 2114 Label store_double; |
| 2114 Label store_float32x4; | 2115 Label store_float32x4; |
| 2115 Label store_float64x2; | 2116 Label store_float64x2; |
| 2116 | 2117 |
| 2117 __ LoadObject(temp, Field::ZoneHandle(field().raw())); | 2118 __ LoadObject(temp, Field::ZoneHandle(Z, field().Original())); |
| 2118 | 2119 |
| 2119 __ ldrh(temp2, FieldAddress(temp, Field::is_nullable_offset())); | 2120 __ ldrh(temp2, FieldAddress(temp, Field::is_nullable_offset())); |
| 2120 __ CompareImmediate(temp2, kNullCid); | 2121 __ CompareImmediate(temp2, kNullCid); |
| 2121 __ b(&store_pointer, EQ); | 2122 __ b(&store_pointer, EQ); |
| 2122 | 2123 |
| 2123 __ ldrb(temp2, FieldAddress(temp, Field::kind_bits_offset())); | 2124 __ ldrb(temp2, FieldAddress(temp, Field::kind_bits_offset())); |
| 2124 __ tst(temp2, Operand(1 << Field::kUnboxingCandidateBit)); | 2125 __ tst(temp2, Operand(1 << Field::kUnboxingCandidateBit)); |
| 2125 __ b(&store_pointer, EQ); | 2126 __ b(&store_pointer, EQ); |
| 2126 | 2127 |
| 2127 __ ldrh(temp2, FieldAddress(temp, Field::guarded_cid_offset())); | 2128 __ ldrh(temp2, FieldAddress(temp, Field::guarded_cid_offset())); |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2247 : Location::RequiresRegister()); | 2248 : Location::RequiresRegister()); |
| 2248 locs->set_temp(0, Location::RequiresRegister()); | 2249 locs->set_temp(0, Location::RequiresRegister()); |
| 2249 return locs; | 2250 return locs; |
| 2250 } | 2251 } |
| 2251 | 2252 |
| 2252 | 2253 |
| 2253 void StoreStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2254 void StoreStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2254 const Register value = locs()->in(0).reg(); | 2255 const Register value = locs()->in(0).reg(); |
| 2255 const Register temp = locs()->temp(0).reg(); | 2256 const Register temp = locs()->temp(0).reg(); |
| 2256 | 2257 |
| 2257 __ LoadObject(temp, field()); | 2258 __ LoadObject(temp, Field::ZoneHandle(Z, field().Original())); |
| 2258 if (this->value()->NeedsStoreBuffer()) { | 2259 if (this->value()->NeedsStoreBuffer()) { |
| 2259 __ StoreIntoObject(temp, | 2260 __ StoreIntoObject(temp, |
| 2260 FieldAddress(temp, Field::static_value_offset()), | 2261 FieldAddress(temp, Field::static_value_offset()), |
| 2261 value, | 2262 value, |
| 2262 CanValueBeSmi()); | 2263 CanValueBeSmi()); |
| 2263 } else { | 2264 } else { |
| 2264 __ StoreIntoObjectNoBarrier( | 2265 __ StoreIntoObjectNoBarrier( |
| 2265 temp, FieldAddress(temp, Field::static_value_offset()), value); | 2266 temp, FieldAddress(temp, Field::static_value_offset()), value); |
| 2266 } | 2267 } |
| 2267 } | 2268 } |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2469 if (IsPotentialUnboxedLoad()) { | 2470 if (IsPotentialUnboxedLoad()) { |
| 2470 const DRegister value = EvenDRegisterOf(locs()->temp(0).fpu_reg()); | 2471 const DRegister value = EvenDRegisterOf(locs()->temp(0).fpu_reg()); |
| 2471 const Register temp = locs()->temp(1).reg(); | 2472 const Register temp = locs()->temp(1).reg(); |
| 2472 const Register temp2 = locs()->temp(2).reg(); | 2473 const Register temp2 = locs()->temp(2).reg(); |
| 2473 | 2474 |
| 2474 Label load_pointer; | 2475 Label load_pointer; |
| 2475 Label load_double; | 2476 Label load_double; |
| 2476 Label load_float32x4; | 2477 Label load_float32x4; |
| 2477 Label load_float64x2; | 2478 Label load_float64x2; |
| 2478 | 2479 |
| 2479 __ LoadObject(result_reg, Field::ZoneHandle(field()->raw())); | 2480 __ LoadObject(result_reg, Field::ZoneHandle(field()->Original())); |
| 2480 | 2481 |
| 2481 FieldAddress field_cid_operand(result_reg, Field::guarded_cid_offset()); | 2482 FieldAddress field_cid_operand(result_reg, Field::guarded_cid_offset()); |
| 2482 FieldAddress field_nullability_operand(result_reg, | 2483 FieldAddress field_nullability_operand(result_reg, |
| 2483 Field::is_nullable_offset()); | 2484 Field::is_nullable_offset()); |
| 2484 | 2485 |
| 2485 __ ldrh(temp, field_nullability_operand); | 2486 __ ldrh(temp, field_nullability_operand); |
| 2486 __ CompareImmediate(temp, kNullCid); | 2487 __ CompareImmediate(temp, kNullCid); |
| 2487 __ b(&load_pointer, EQ); | 2488 __ b(&load_pointer, EQ); |
| 2488 | 2489 |
| 2489 __ ldrh(temp, field_cid_operand); | 2490 __ ldrh(temp, field_cid_operand); |
| (...skipping 4333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6823 1, | 6824 1, |
| 6824 locs()); | 6825 locs()); |
| 6825 __ Drop(1); | 6826 __ Drop(1); |
| 6826 __ Pop(result); | 6827 __ Pop(result); |
| 6827 } | 6828 } |
| 6828 | 6829 |
| 6829 | 6830 |
| 6830 } // namespace dart | 6831 } // namespace dart |
| 6831 | 6832 |
| 6832 #endif // defined TARGET_ARCH_ARM | 6833 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |