OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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_ARM64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM64. |
6 #if defined(TARGET_ARCH_ARM64) | 6 #if defined(TARGET_ARCH_ARM64) |
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 R0. | 29 // on the stack and return the result in a fixed register R0. |
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(R0)); | 33 result->set_out(0, Location::RegisterLocation(R0)); |
33 return result; | 34 return result; |
(...skipping 1426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1460 locs()->temp(locs()->temp_count() - 1).reg() : kNoRegister; | 1461 locs()->temp(locs()->temp_count() - 1).reg() : kNoRegister; |
1461 | 1462 |
1462 Label ok, fail_label; | 1463 Label ok, fail_label; |
1463 | 1464 |
1464 Label* deopt = compiler->is_optimizing() ? | 1465 Label* deopt = compiler->is_optimizing() ? |
1465 compiler->AddDeoptStub(deopt_id(), ICData::kDeoptGuardField) : NULL; | 1466 compiler->AddDeoptStub(deopt_id(), ICData::kDeoptGuardField) : NULL; |
1466 | 1467 |
1467 Label* fail = (deopt != NULL) ? deopt : &fail_label; | 1468 Label* fail = (deopt != NULL) ? deopt : &fail_label; |
1468 | 1469 |
1469 if (emit_full_guard) { | 1470 if (emit_full_guard) { |
1470 __ LoadObject(field_reg, Field::ZoneHandle(field().raw())); | 1471 __ LoadObject(field_reg, Field::ZoneHandle(field().Original())); |
1471 | 1472 |
1472 FieldAddress field_cid_operand( | 1473 FieldAddress field_cid_operand( |
1473 field_reg, Field::guarded_cid_offset(), kUnsignedWord); | 1474 field_reg, Field::guarded_cid_offset(), kUnsignedWord); |
1474 FieldAddress field_nullability_operand( | 1475 FieldAddress field_nullability_operand( |
1475 field_reg, Field::is_nullable_offset(), kUnsignedWord); | 1476 field_reg, Field::is_nullable_offset(), kUnsignedWord); |
1476 | 1477 |
1477 if (value_cid == kDynamicCid) { | 1478 if (value_cid == kDynamicCid) { |
1478 LoadValueCid(compiler, value_cid_reg, value_reg); | 1479 LoadValueCid(compiler, value_cid_reg, value_reg); |
1479 Label skip_length_check; | 1480 Label skip_length_check; |
1480 __ ldr(TMP, field_cid_operand, kUnsignedWord); | 1481 __ ldr(TMP, field_cid_operand, kUnsignedWord); |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1604 const Register value_reg = locs()->in(0).reg(); | 1605 const Register value_reg = locs()->in(0).reg(); |
1605 | 1606 |
1606 if (!compiler->is_optimizing() || | 1607 if (!compiler->is_optimizing() || |
1607 (field().guarded_list_length() == Field::kUnknownFixedLength)) { | 1608 (field().guarded_list_length() == Field::kUnknownFixedLength)) { |
1608 const Register field_reg = locs()->temp(0).reg(); | 1609 const Register field_reg = locs()->temp(0).reg(); |
1609 const Register offset_reg = locs()->temp(1).reg(); | 1610 const Register offset_reg = locs()->temp(1).reg(); |
1610 const Register length_reg = locs()->temp(2).reg(); | 1611 const Register length_reg = locs()->temp(2).reg(); |
1611 | 1612 |
1612 Label ok; | 1613 Label ok; |
1613 | 1614 |
1614 __ LoadObject(field_reg, Field::ZoneHandle(field().raw())); | 1615 __ LoadObject(field_reg, Field::ZoneHandle(field().Original())); |
1615 | 1616 |
1616 __ ldr(offset_reg, | 1617 __ ldr(offset_reg, |
1617 FieldAddress(field_reg, | 1618 FieldAddress(field_reg, |
1618 Field::guarded_list_length_in_object_offset_offset()), | 1619 Field::guarded_list_length_in_object_offset_offset()), |
1619 kByte); | 1620 kByte); |
1620 __ ldr(length_reg, FieldAddress(field_reg, | 1621 __ ldr(length_reg, FieldAddress(field_reg, |
1621 Field::guarded_list_length_offset())); | 1622 Field::guarded_list_length_offset())); |
1622 | 1623 |
1623 __ tst(offset_reg, Operand(offset_reg)); | 1624 __ tst(offset_reg, Operand(offset_reg)); |
1624 __ b(&ok, MI); | 1625 __ b(&ok, MI); |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1830 // Value input is a writable register and should be manually preserved | 1831 // Value input is a writable register and should be manually preserved |
1831 // across allocation slow-path. | 1832 // across allocation slow-path. |
1832 locs()->live_registers()->Add(locs()->in(1), kTagged); | 1833 locs()->live_registers()->Add(locs()->in(1), kTagged); |
1833 } | 1834 } |
1834 | 1835 |
1835 Label store_pointer; | 1836 Label store_pointer; |
1836 Label store_double; | 1837 Label store_double; |
1837 Label store_float32x4; | 1838 Label store_float32x4; |
1838 Label store_float64x2; | 1839 Label store_float64x2; |
1839 | 1840 |
1840 __ LoadObject(temp, Field::ZoneHandle(field().raw())); | 1841 __ LoadObject(temp, Field::ZoneHandle(Z, field().Original())); |
1841 | 1842 |
1842 __ LoadFieldFromOffset(temp2, temp, Field::is_nullable_offset(), | 1843 __ LoadFieldFromOffset(temp2, temp, Field::is_nullable_offset(), |
1843 kUnsignedWord); | 1844 kUnsignedWord); |
1844 __ CompareImmediate(temp2, kNullCid); | 1845 __ CompareImmediate(temp2, kNullCid); |
1845 __ b(&store_pointer, EQ); | 1846 __ b(&store_pointer, EQ); |
1846 | 1847 |
1847 __ LoadFromOffset( | 1848 __ LoadFromOffset( |
1848 temp2, temp, Field::kind_bits_offset() - kHeapObjectTag, | 1849 temp2, temp, Field::kind_bits_offset() - kHeapObjectTag, |
1849 kUnsignedByte); | 1850 kUnsignedByte); |
1850 __ tsti(temp2, Immediate(1 << Field::kUnboxingCandidateBit)); | 1851 __ tsti(temp2, Immediate(1 << Field::kUnboxingCandidateBit)); |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1968 : Location::RequiresRegister()); | 1969 : Location::RequiresRegister()); |
1969 locs->set_temp(0, Location::RequiresRegister()); | 1970 locs->set_temp(0, Location::RequiresRegister()); |
1970 return locs; | 1971 return locs; |
1971 } | 1972 } |
1972 | 1973 |
1973 | 1974 |
1974 void StoreStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 1975 void StoreStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
1975 const Register value = locs()->in(0).reg(); | 1976 const Register value = locs()->in(0).reg(); |
1976 const Register temp = locs()->temp(0).reg(); | 1977 const Register temp = locs()->temp(0).reg(); |
1977 | 1978 |
1978 __ LoadObject(temp, field()); | 1979 __ LoadObject(temp, Field::ZoneHandle(Z, field().Original())); |
1979 if (this->value()->NeedsStoreBuffer()) { | 1980 if (this->value()->NeedsStoreBuffer()) { |
1980 __ StoreIntoObjectOffset( | 1981 __ StoreIntoObjectOffset( |
1981 temp, Field::static_value_offset(), value, CanValueBeSmi()); | 1982 temp, Field::static_value_offset(), value, CanValueBeSmi()); |
1982 } else { | 1983 } else { |
1983 __ StoreIntoObjectOffsetNoBarrier(temp, | 1984 __ StoreIntoObjectOffsetNoBarrier(temp, |
1984 Field::static_value_offset(), | 1985 Field::static_value_offset(), |
1985 value); | 1986 value); |
1986 } | 1987 } |
1987 } | 1988 } |
1988 | 1989 |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2180 Label done; | 2181 Label done; |
2181 const Register result_reg = locs()->out(0).reg(); | 2182 const Register result_reg = locs()->out(0).reg(); |
2182 if (IsPotentialUnboxedLoad()) { | 2183 if (IsPotentialUnboxedLoad()) { |
2183 const Register temp = locs()->temp(0).reg(); | 2184 const Register temp = locs()->temp(0).reg(); |
2184 | 2185 |
2185 Label load_pointer; | 2186 Label load_pointer; |
2186 Label load_double; | 2187 Label load_double; |
2187 Label load_float32x4; | 2188 Label load_float32x4; |
2188 Label load_float64x2; | 2189 Label load_float64x2; |
2189 | 2190 |
2190 __ LoadObject(result_reg, Field::ZoneHandle(field()->raw())); | 2191 __ LoadObject(result_reg, Field::ZoneHandle(field()->Original())); |
2191 | 2192 |
2192 FieldAddress field_cid_operand( | 2193 FieldAddress field_cid_operand( |
2193 result_reg, Field::guarded_cid_offset(), kUnsignedWord); | 2194 result_reg, Field::guarded_cid_offset(), kUnsignedWord); |
2194 FieldAddress field_nullability_operand( | 2195 FieldAddress field_nullability_operand( |
2195 result_reg, Field::is_nullable_offset(), kUnsignedWord); | 2196 result_reg, Field::is_nullable_offset(), kUnsignedWord); |
2196 | 2197 |
2197 __ ldr(temp, field_nullability_operand, kUnsignedWord); | 2198 __ ldr(temp, field_nullability_operand, kUnsignedWord); |
2198 __ CompareImmediate(temp, kNullCid); | 2199 __ CompareImmediate(temp, kNullCid); |
2199 __ b(&load_pointer, EQ); | 2200 __ b(&load_pointer, EQ); |
2200 | 2201 |
(...skipping 3380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5581 1, | 5582 1, |
5582 locs()); | 5583 locs()); |
5583 __ Drop(1); | 5584 __ Drop(1); |
5584 __ Pop(result); | 5585 __ Pop(result); |
5585 } | 5586 } |
5586 | 5587 |
5587 | 5588 |
5588 } // namespace dart | 5589 } // namespace dart |
5589 | 5590 |
5590 #endif // defined TARGET_ARCH_ARM64 | 5591 #endif // defined TARGET_ARCH_ARM64 |
OLD | NEW |