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_IA32. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. |
6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
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/stack_frame.h" | 18 #include "vm/stack_frame.h" |
19 #include "vm/stub_code.h" | 19 #include "vm/stub_code.h" |
20 #include "vm/symbols.h" | 20 #include "vm/symbols.h" |
21 | 21 |
22 #define __ compiler->assembler()-> | 22 #define __ compiler->assembler()-> |
| 23 #define Z (compiler->zone()) |
23 | 24 |
24 namespace dart { | 25 namespace dart { |
25 | 26 |
26 // Generic summary for call instructions that have all arguments pushed | 27 // Generic summary for call instructions that have all arguments pushed |
27 // on the stack and return the result in a fixed register EAX. | 28 // on the stack and return the result in a fixed register EAX. |
28 LocationSummary* Instruction::MakeCallSummary(Zone* zone) { | 29 LocationSummary* Instruction::MakeCallSummary(Zone* zone) { |
29 const intptr_t kNumInputs = 0; | 30 const intptr_t kNumInputs = 0; |
30 const intptr_t kNumTemps = 0; | 31 const intptr_t kNumTemps = 0; |
31 LocationSummary* result = new(zone) LocationSummary( | 32 LocationSummary* result = new(zone) LocationSummary( |
32 zone, kNumInputs, kNumTemps, LocationSummary::kCall); | 33 zone, kNumInputs, kNumTemps, LocationSummary::kCall); |
(...skipping 1401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1434 locs()->temp(locs()->temp_count() - 1).reg() : kNoRegister; | 1435 locs()->temp(locs()->temp_count() - 1).reg() : kNoRegister; |
1435 | 1436 |
1436 Label ok, fail_label; | 1437 Label ok, fail_label; |
1437 | 1438 |
1438 Label* deopt = compiler->is_optimizing() ? | 1439 Label* deopt = compiler->is_optimizing() ? |
1439 compiler->AddDeoptStub(deopt_id(), ICData::kDeoptGuardField) : NULL; | 1440 compiler->AddDeoptStub(deopt_id(), ICData::kDeoptGuardField) : NULL; |
1440 | 1441 |
1441 Label* fail = (deopt != NULL) ? deopt : &fail_label; | 1442 Label* fail = (deopt != NULL) ? deopt : &fail_label; |
1442 | 1443 |
1443 if (emit_full_guard) { | 1444 if (emit_full_guard) { |
1444 __ LoadObject(field_reg, Field::ZoneHandle(field().raw())); | 1445 __ LoadObject(field_reg, Field::ZoneHandle(field().Original())); |
1445 | 1446 |
1446 FieldAddress field_cid_operand(field_reg, Field::guarded_cid_offset()); | 1447 FieldAddress field_cid_operand(field_reg, Field::guarded_cid_offset()); |
1447 FieldAddress field_nullability_operand( | 1448 FieldAddress field_nullability_operand( |
1448 field_reg, Field::is_nullable_offset()); | 1449 field_reg, Field::is_nullable_offset()); |
1449 | 1450 |
1450 if (value_cid == kDynamicCid) { | 1451 if (value_cid == kDynamicCid) { |
1451 LoadValueCid(compiler, value_cid_reg, value_reg); | 1452 LoadValueCid(compiler, value_cid_reg, value_reg); |
1452 __ cmpw(value_cid_reg, field_cid_operand); | 1453 __ cmpw(value_cid_reg, field_cid_operand); |
1453 __ j(EQUAL, &ok); | 1454 __ j(EQUAL, &ok); |
1454 __ cmpw(value_cid_reg, field_nullability_operand); | 1455 __ cmpw(value_cid_reg, field_nullability_operand); |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1582 const Register value_reg = locs()->in(0).reg(); | 1583 const Register value_reg = locs()->in(0).reg(); |
1583 | 1584 |
1584 if (!compiler->is_optimizing() || | 1585 if (!compiler->is_optimizing() || |
1585 (field().guarded_list_length() == Field::kUnknownFixedLength)) { | 1586 (field().guarded_list_length() == Field::kUnknownFixedLength)) { |
1586 const Register field_reg = locs()->temp(0).reg(); | 1587 const Register field_reg = locs()->temp(0).reg(); |
1587 const Register offset_reg = locs()->temp(1).reg(); | 1588 const Register offset_reg = locs()->temp(1).reg(); |
1588 const Register length_reg = locs()->temp(2).reg(); | 1589 const Register length_reg = locs()->temp(2).reg(); |
1589 | 1590 |
1590 Label ok; | 1591 Label ok; |
1591 | 1592 |
1592 __ LoadObject(field_reg, Field::ZoneHandle(field().raw())); | 1593 __ LoadObject(field_reg, Field::ZoneHandle(field().Original())); |
1593 | 1594 |
1594 __ movsxb(offset_reg, FieldAddress(field_reg, | 1595 __ movsxb(offset_reg, FieldAddress(field_reg, |
1595 Field::guarded_list_length_in_object_offset_offset())); | 1596 Field::guarded_list_length_in_object_offset_offset())); |
1596 __ movl(length_reg, FieldAddress(field_reg, | 1597 __ movl(length_reg, FieldAddress(field_reg, |
1597 Field::guarded_list_length_offset())); | 1598 Field::guarded_list_length_offset())); |
1598 | 1599 |
1599 __ cmpl(offset_reg, Immediate(0)); | 1600 __ cmpl(offset_reg, Immediate(0)); |
1600 __ j(NEGATIVE, &ok); | 1601 __ j(NEGATIVE, &ok); |
1601 | 1602 |
1602 // Load the length from the value. GuardFieldClass already verified that | 1603 // Load the length from the value. GuardFieldClass already verified that |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1822 // Value input is a writable register and should be manually preserved | 1823 // Value input is a writable register and should be manually preserved |
1823 // across allocation slow-path. | 1824 // across allocation slow-path. |
1824 locs()->live_registers()->Add(locs()->in(1), kTagged); | 1825 locs()->live_registers()->Add(locs()->in(1), kTagged); |
1825 } | 1826 } |
1826 | 1827 |
1827 Label store_pointer; | 1828 Label store_pointer; |
1828 Label store_double; | 1829 Label store_double; |
1829 Label store_float32x4; | 1830 Label store_float32x4; |
1830 Label store_float64x2; | 1831 Label store_float64x2; |
1831 | 1832 |
1832 __ LoadObject(temp, Field::ZoneHandle(field().raw())); | 1833 __ LoadObject(temp, Field::ZoneHandle(Z, field().Original())); |
1833 | 1834 |
1834 __ cmpw(FieldAddress(temp, Field::is_nullable_offset()), | 1835 __ cmpw(FieldAddress(temp, Field::is_nullable_offset()), |
1835 Immediate(kNullCid)); | 1836 Immediate(kNullCid)); |
1836 __ j(EQUAL, &store_pointer); | 1837 __ j(EQUAL, &store_pointer); |
1837 | 1838 |
1838 __ movzxb(temp2, FieldAddress(temp, Field::kind_bits_offset())); | 1839 __ movzxb(temp2, FieldAddress(temp, Field::kind_bits_offset())); |
1839 __ testl(temp2, Immediate(1 << Field::kUnboxingCandidateBit)); | 1840 __ testl(temp2, Immediate(1 << Field::kUnboxingCandidateBit)); |
1840 __ j(ZERO, &store_pointer); | 1841 __ j(ZERO, &store_pointer); |
1841 | 1842 |
1842 __ cmpw(FieldAddress(temp, Field::guarded_cid_offset()), | 1843 __ cmpw(FieldAddress(temp, Field::guarded_cid_offset()), |
(...skipping 125 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 Register value = locs()->in(0).reg(); | 1976 Register value = locs()->in(0).reg(); |
1976 Register temp = locs()->temp(0).reg(); | 1977 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 __ StoreIntoObject(temp, | 1981 __ StoreIntoObject(temp, |
1981 FieldAddress(temp, Field::static_value_offset()), | 1982 FieldAddress(temp, Field::static_value_offset()), |
1982 value, | 1983 value, |
1983 CanValueBeSmi()); | 1984 CanValueBeSmi()); |
1984 } else { | 1985 } else { |
1985 __ StoreIntoObjectNoBarrier( | 1986 __ StoreIntoObjectNoBarrier( |
1986 temp, FieldAddress(temp, Field::static_value_offset()), value); | 1987 temp, FieldAddress(temp, Field::static_value_offset()), value); |
1987 } | 1988 } |
1988 } | 1989 } |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2191 if (IsPotentialUnboxedLoad()) { | 2192 if (IsPotentialUnboxedLoad()) { |
2192 Register temp = locs()->temp(1).reg(); | 2193 Register temp = locs()->temp(1).reg(); |
2193 XmmRegister value = locs()->temp(0).fpu_reg(); | 2194 XmmRegister value = locs()->temp(0).fpu_reg(); |
2194 | 2195 |
2195 | 2196 |
2196 Label load_pointer; | 2197 Label load_pointer; |
2197 Label load_double; | 2198 Label load_double; |
2198 Label load_float32x4; | 2199 Label load_float32x4; |
2199 Label load_float64x2; | 2200 Label load_float64x2; |
2200 | 2201 |
2201 __ LoadObject(result, Field::ZoneHandle(field()->raw())); | 2202 __ LoadObject(result, Field::ZoneHandle(field()->Original())); |
2202 | 2203 |
2203 FieldAddress field_cid_operand(result, Field::guarded_cid_offset()); | 2204 FieldAddress field_cid_operand(result, Field::guarded_cid_offset()); |
2204 FieldAddress field_nullability_operand(result, Field::is_nullable_offset()); | 2205 FieldAddress field_nullability_operand(result, Field::is_nullable_offset()); |
2205 | 2206 |
2206 __ cmpw(field_nullability_operand, Immediate(kNullCid)); | 2207 __ cmpw(field_nullability_operand, Immediate(kNullCid)); |
2207 __ j(EQUAL, &load_pointer); | 2208 __ j(EQUAL, &load_pointer); |
2208 | 2209 |
2209 __ cmpw(field_cid_operand, Immediate(kDoubleCid)); | 2210 __ cmpw(field_cid_operand, Immediate(kDoubleCid)); |
2210 __ j(EQUAL, &load_double); | 2211 __ j(EQUAL, &load_double); |
2211 | 2212 |
(...skipping 4620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6832 __ Drop(1); | 6833 __ Drop(1); |
6833 __ popl(result); | 6834 __ popl(result); |
6834 } | 6835 } |
6835 | 6836 |
6836 | 6837 |
6837 } // namespace dart | 6838 } // namespace dart |
6838 | 6839 |
6839 #undef __ | 6840 #undef __ |
6840 | 6841 |
6841 #endif // defined TARGET_ARCH_IA32 | 6842 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |