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" |
(...skipping 1707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1718 | 1718 |
1719 | 1719 |
1720 LocationSummary* StoreInstanceFieldInstr::MakeLocationSummary(Zone* zone, | 1720 LocationSummary* StoreInstanceFieldInstr::MakeLocationSummary(Zone* zone, |
1721 bool opt) const { | 1721 bool opt) const { |
1722 const intptr_t kNumInputs = 2; | 1722 const intptr_t kNumInputs = 2; |
1723 const intptr_t kNumTemps = | 1723 const intptr_t kNumTemps = |
1724 (IsUnboxedStore() && opt) ? 2 : | 1724 (IsUnboxedStore() && opt) ? 2 : |
1725 ((IsPotentialUnboxedStore()) ? 3 : 0); | 1725 ((IsPotentialUnboxedStore()) ? 3 : 0); |
1726 LocationSummary* summary = new(zone) LocationSummary( | 1726 LocationSummary* summary = new(zone) LocationSummary( |
1727 zone, kNumInputs, kNumTemps, | 1727 zone, kNumInputs, kNumTemps, |
1728 ((IsUnboxedStore() && opt && is_potential_unboxed_initialization_) || | 1728 ((IsUnboxedStore() && opt && is_initialization()) || |
1729 IsPotentialUnboxedStore()) | 1729 IsPotentialUnboxedStore()) |
1730 ? LocationSummary::kCallOnSlowPath | 1730 ? LocationSummary::kCallOnSlowPath |
1731 : LocationSummary::kNoCall); | 1731 : LocationSummary::kNoCall); |
1732 | 1732 |
1733 summary->set_in(0, Location::RequiresRegister()); | 1733 summary->set_in(0, Location::RequiresRegister()); |
1734 if (IsUnboxedStore() && opt) { | 1734 if (IsUnboxedStore() && opt) { |
1735 summary->set_in(1, Location::RequiresFpuRegister()); | 1735 summary->set_in(1, Location::RequiresFpuRegister()); |
1736 summary->set_temp(0, Location::RequiresRegister()); | 1736 summary->set_temp(0, Location::RequiresRegister()); |
1737 summary->set_temp(1, Location::RequiresRegister()); | 1737 summary->set_temp(1, Location::RequiresRegister()); |
1738 } else if (IsPotentialUnboxedStore()) { | 1738 } else if (IsPotentialUnboxedStore()) { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1780 Label skip_store; | 1780 Label skip_store; |
1781 | 1781 |
1782 Register instance_reg = locs()->in(0).reg(); | 1782 Register instance_reg = locs()->in(0).reg(); |
1783 | 1783 |
1784 if (IsUnboxedStore() && compiler->is_optimizing()) { | 1784 if (IsUnboxedStore() && compiler->is_optimizing()) { |
1785 XmmRegister value = locs()->in(1).fpu_reg(); | 1785 XmmRegister value = locs()->in(1).fpu_reg(); |
1786 Register temp = locs()->temp(0).reg(); | 1786 Register temp = locs()->temp(0).reg(); |
1787 Register temp2 = locs()->temp(1).reg(); | 1787 Register temp2 = locs()->temp(1).reg(); |
1788 const intptr_t cid = field().UnboxedFieldCid(); | 1788 const intptr_t cid = field().UnboxedFieldCid(); |
1789 | 1789 |
1790 if (is_potential_unboxed_initialization_) { | 1790 if (is_initialization()) { |
1791 const Class* cls = NULL; | 1791 const Class* cls = NULL; |
1792 switch (cid) { | 1792 switch (cid) { |
1793 case kDoubleCid: | 1793 case kDoubleCid: |
1794 cls = &compiler->double_class(); | 1794 cls = &compiler->double_class(); |
1795 break; | 1795 break; |
1796 case kFloat32x4Cid: | 1796 case kFloat32x4Cid: |
1797 cls = &compiler->float32x4_class(); | 1797 cls = &compiler->float32x4_class(); |
1798 break; | 1798 break; |
1799 case kFloat64x2Cid: | 1799 case kFloat64x2Cid: |
1800 cls = &compiler->float64x2_class(); | 1800 cls = &compiler->float64x2_class(); |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1928 Register value_reg = locs()->in(1).reg(); | 1928 Register value_reg = locs()->in(1).reg(); |
1929 __ StoreIntoObject(instance_reg, | 1929 __ StoreIntoObject(instance_reg, |
1930 FieldAddress(instance_reg, offset_in_bytes_), | 1930 FieldAddress(instance_reg, offset_in_bytes_), |
1931 value_reg, | 1931 value_reg, |
1932 CanValueBeSmi()); | 1932 CanValueBeSmi()); |
1933 } else { | 1933 } else { |
1934 if (locs()->in(1).IsConstant()) { | 1934 if (locs()->in(1).IsConstant()) { |
1935 __ StoreIntoObjectNoBarrier( | 1935 __ StoreIntoObjectNoBarrier( |
1936 instance_reg, | 1936 instance_reg, |
1937 FieldAddress(instance_reg, offset_in_bytes_), | 1937 FieldAddress(instance_reg, offset_in_bytes_), |
1938 locs()->in(1).constant(), | 1938 locs()->in(1).constant()); |
1939 is_object_reference_initialization_ ? | |
1940 Assembler::kEmptyOrSmiOrNull : | |
1941 Assembler::kHeapObjectOrSmi); | |
1942 } else { | 1939 } else { |
1943 Register value_reg = locs()->in(1).reg(); | 1940 Register value_reg = locs()->in(1).reg(); |
1944 __ StoreIntoObjectNoBarrier(instance_reg, | 1941 __ StoreIntoObjectNoBarrier(instance_reg, |
1945 FieldAddress(instance_reg, offset_in_bytes_), | 1942 FieldAddress(instance_reg, offset_in_bytes_), |
1946 value_reg, | 1943 value_reg); |
1947 is_object_reference_initialization_ ? | |
1948 Assembler::kEmptyOrSmiOrNull : | |
1949 Assembler::kHeapObjectOrSmi); | |
1950 } | 1944 } |
1951 } | 1945 } |
1952 __ Bind(&skip_store); | 1946 __ Bind(&skip_store); |
1953 } | 1947 } |
1954 | 1948 |
1955 | 1949 |
1956 LocationSummary* LoadStaticFieldInstr::MakeLocationSummary(Zone* zone, | 1950 LocationSummary* LoadStaticFieldInstr::MakeLocationSummary(Zone* zone, |
1957 bool opt) const { | 1951 bool opt) const { |
1958 const intptr_t kNumInputs = 1; | 1952 const intptr_t kNumInputs = 1; |
1959 const intptr_t kNumTemps = 0; | 1953 const intptr_t kNumTemps = 0; |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2059 const intptr_t instance_size = Array::InstanceSize(num_elements); | 2053 const intptr_t instance_size = Array::InstanceSize(num_elements); |
2060 | 2054 |
2061 // Instance in EAX. | 2055 // Instance in EAX. |
2062 // Object end address in EBX. | 2056 // Object end address in EBX. |
2063 __ TryAllocateArray(kArrayCid, instance_size, slow_path, Assembler::kFarJump, | 2057 __ TryAllocateArray(kArrayCid, instance_size, slow_path, Assembler::kFarJump, |
2064 EAX, // instance | 2058 EAX, // instance |
2065 EBX, // end address | 2059 EBX, // end address |
2066 EDI); // temp | 2060 EDI); // temp |
2067 | 2061 |
2068 // Store the type argument field. | 2062 // Store the type argument field. |
2069 __ InitializeFieldNoBarrier(EAX, | 2063 __ StoreIntoObjectNoBarrier(EAX, |
2070 FieldAddress(EAX, Array::type_arguments_offset()), | 2064 FieldAddress(EAX, Array::type_arguments_offset()), |
2071 kElemTypeReg); | 2065 kElemTypeReg); |
2072 | 2066 |
2073 // Set the length field. | 2067 // Set the length field. |
2074 __ InitializeFieldNoBarrier(EAX, | 2068 __ StoreIntoObjectNoBarrier(EAX, |
2075 FieldAddress(EAX, Array::length_offset()), | 2069 FieldAddress(EAX, Array::length_offset()), |
2076 kLengthReg); | 2070 kLengthReg); |
2077 | 2071 |
2078 // Initialize all array elements to raw_null. | 2072 // Initialize all array elements to raw_null. |
2079 // EAX: new object start as a tagged pointer. | 2073 // EAX: new object start as a tagged pointer. |
2080 // EBX: new object end address. | 2074 // EBX: new object end address. |
2081 // EDI: iterator which initially points to the start of the variable | 2075 // EDI: iterator which initially points to the start of the variable |
2082 // data area to be initialized. | 2076 // data area to be initialized. |
2083 if (num_elements > 0) { | 2077 if (num_elements > 0) { |
2084 const intptr_t array_size = instance_size - sizeof(RawArray); | 2078 const intptr_t array_size = instance_size - sizeof(RawArray); |
2085 const Immediate& raw_null = | 2079 const Immediate& raw_null = |
2086 Immediate(reinterpret_cast<intptr_t>(Object::null())); | 2080 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
2087 __ leal(EDI, FieldAddress(EAX, sizeof(RawArray))); | 2081 __ leal(EDI, FieldAddress(EAX, sizeof(RawArray))); |
2088 if (array_size < (kInlineArraySize * kWordSize)) { | 2082 if (array_size < (kInlineArraySize * kWordSize)) { |
2089 intptr_t current_offset = 0; | 2083 intptr_t current_offset = 0; |
2090 __ movl(EBX, raw_null); | 2084 __ movl(EBX, raw_null); |
2091 while (current_offset < array_size) { | 2085 while (current_offset < array_size) { |
2092 __ InitializeFieldNoBarrier(EAX, Address(EDI, current_offset), EBX); | 2086 __ StoreIntoObjectNoBarrier(EAX, Address(EDI, current_offset), EBX); |
2093 current_offset += kWordSize; | 2087 current_offset += kWordSize; |
2094 } | 2088 } |
2095 } else { | 2089 } else { |
2096 Label init_loop; | 2090 Label init_loop; |
2097 __ Bind(&init_loop); | 2091 __ Bind(&init_loop); |
2098 __ InitializeFieldNoBarrier(EAX, Address(EDI, 0), Object::null_object()); | 2092 __ StoreIntoObjectNoBarrier(EAX, Address(EDI, 0), Object::null_object()); |
2099 __ addl(EDI, Immediate(kWordSize)); | 2093 __ addl(EDI, Immediate(kWordSize)); |
2100 __ cmpl(EDI, EBX); | 2094 __ cmpl(EDI, EBX); |
2101 __ j(BELOW, &init_loop, Assembler::kNearJump); | 2095 __ j(BELOW, &init_loop, Assembler::kNearJump); |
2102 } | 2096 } |
2103 } | 2097 } |
2104 __ jmp(done, Assembler::kNearJump); | 2098 __ jmp(done, Assembler::kNearJump); |
2105 } | 2099 } |
2106 | 2100 |
2107 | 2101 |
2108 void CreateArrayInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2102 void CreateArrayInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
(...skipping 4767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6876 __ Drop(1); | 6870 __ Drop(1); |
6877 __ popl(result); | 6871 __ popl(result); |
6878 } | 6872 } |
6879 | 6873 |
6880 | 6874 |
6881 } // namespace dart | 6875 } // namespace dart |
6882 | 6876 |
6883 #undef __ | 6877 #undef __ |
6884 | 6878 |
6885 #endif // defined TARGET_ARCH_IA32 | 6879 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |