| 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_X64. | 5 #include "vm/globals.h"  // Needed here to get TARGET_ARCH_X64. | 
| 6 #if defined(TARGET_ARCH_X64) | 6 #if defined(TARGET_ARCH_X64) | 
| 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 1735 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1746 | 1746 | 
| 1747 | 1747 | 
| 1748 LocationSummary* StoreInstanceFieldInstr::MakeLocationSummary(Zone* zone, | 1748 LocationSummary* StoreInstanceFieldInstr::MakeLocationSummary(Zone* zone, | 
| 1749                                                               bool opt) const { | 1749                                                               bool opt) const { | 
| 1750   const intptr_t kNumInputs = 2; | 1750   const intptr_t kNumInputs = 2; | 
| 1751   const intptr_t kNumTemps = | 1751   const intptr_t kNumTemps = | 
| 1752       (IsUnboxedStore() && opt) ? 2 : | 1752       (IsUnboxedStore() && opt) ? 2 : | 
| 1753           ((IsPotentialUnboxedStore()) ? 3 : 0); | 1753           ((IsPotentialUnboxedStore()) ? 3 : 0); | 
| 1754   LocationSummary* summary = new(zone) LocationSummary( | 1754   LocationSummary* summary = new(zone) LocationSummary( | 
| 1755       zone, kNumInputs, kNumTemps, | 1755       zone, kNumInputs, kNumTemps, | 
| 1756           ((IsUnboxedStore() && opt && is_potential_unboxed_initialization_) || | 1756           ((IsUnboxedStore() && opt && is_initialization()) || | 
| 1757            IsPotentialUnboxedStore()) | 1757            IsPotentialUnboxedStore()) | 
| 1758           ? LocationSummary::kCallOnSlowPath | 1758           ? LocationSummary::kCallOnSlowPath | 
| 1759           : LocationSummary::kNoCall); | 1759           : LocationSummary::kNoCall); | 
| 1760 | 1760 | 
| 1761   summary->set_in(0, Location::RequiresRegister()); | 1761   summary->set_in(0, Location::RequiresRegister()); | 
| 1762   if (IsUnboxedStore() && opt) { | 1762   if (IsUnboxedStore() && opt) { | 
| 1763     summary->set_in(1, Location::RequiresFpuRegister()); | 1763     summary->set_in(1, Location::RequiresFpuRegister()); | 
| 1764     summary->set_temp(0, Location::RequiresRegister()); | 1764     summary->set_temp(0, Location::RequiresRegister()); | 
| 1765     summary->set_temp(1, Location::RequiresRegister()); | 1765     summary->set_temp(1, Location::RequiresRegister()); | 
| 1766   } else if (IsPotentialUnboxedStore()) { | 1766   } else if (IsPotentialUnboxedStore()) { | 
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1806   Label skip_store; | 1806   Label skip_store; | 
| 1807 | 1807 | 
| 1808   Register instance_reg = locs()->in(0).reg(); | 1808   Register instance_reg = locs()->in(0).reg(); | 
| 1809 | 1809 | 
| 1810   if (IsUnboxedStore() && compiler->is_optimizing()) { | 1810   if (IsUnboxedStore() && compiler->is_optimizing()) { | 
| 1811     XmmRegister value = locs()->in(1).fpu_reg(); | 1811     XmmRegister value = locs()->in(1).fpu_reg(); | 
| 1812     Register temp = locs()->temp(0).reg(); | 1812     Register temp = locs()->temp(0).reg(); | 
| 1813     Register temp2 = locs()->temp(1).reg(); | 1813     Register temp2 = locs()->temp(1).reg(); | 
| 1814     const intptr_t cid = field().UnboxedFieldCid(); | 1814     const intptr_t cid = field().UnboxedFieldCid(); | 
| 1815 | 1815 | 
| 1816     if (is_potential_unboxed_initialization_) { | 1816     if (is_initialization()) { | 
| 1817       const Class* cls = NULL; | 1817       const Class* cls = NULL; | 
| 1818       switch (cid) { | 1818       switch (cid) { | 
| 1819         case kDoubleCid: | 1819         case kDoubleCid: | 
| 1820           cls = &compiler->double_class(); | 1820           cls = &compiler->double_class(); | 
| 1821           break; | 1821           break; | 
| 1822         case kFloat32x4Cid: | 1822         case kFloat32x4Cid: | 
| 1823           cls = &compiler->float32x4_class(); | 1823           cls = &compiler->float32x4_class(); | 
| 1824           break; | 1824           break; | 
| 1825         case kFloat64x2Cid: | 1825         case kFloat64x2Cid: | 
| 1826           cls = &compiler->float64x2_class(); | 1826           cls = &compiler->float64x2_class(); | 
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1951   if (ShouldEmitStoreBarrier()) { | 1951   if (ShouldEmitStoreBarrier()) { | 
| 1952     Register value_reg = locs()->in(1).reg(); | 1952     Register value_reg = locs()->in(1).reg(); | 
| 1953     __ StoreIntoObject(instance_reg, | 1953     __ StoreIntoObject(instance_reg, | 
| 1954                        FieldAddress(instance_reg, offset_in_bytes_), | 1954                        FieldAddress(instance_reg, offset_in_bytes_), | 
| 1955                        value_reg, | 1955                        value_reg, | 
| 1956                        CanValueBeSmi()); | 1956                        CanValueBeSmi()); | 
| 1957   } else { | 1957   } else { | 
| 1958     if (locs()->in(1).IsConstant()) { | 1958     if (locs()->in(1).IsConstant()) { | 
| 1959       __ StoreIntoObjectNoBarrier(instance_reg, | 1959       __ StoreIntoObjectNoBarrier(instance_reg, | 
| 1960                                   FieldAddress(instance_reg, offset_in_bytes_), | 1960                                   FieldAddress(instance_reg, offset_in_bytes_), | 
| 1961                                   locs()->in(1).constant(), | 1961                                   locs()->in(1).constant()); | 
| 1962                                   is_object_reference_initialization_ ? |  | 
| 1963                                       Assembler::kEmptyOrSmiOrNull : |  | 
| 1964                                       Assembler::kHeapObjectOrSmi); |  | 
| 1965     } else { | 1962     } else { | 
| 1966       Register value_reg = locs()->in(1).reg(); | 1963       Register value_reg = locs()->in(1).reg(); | 
| 1967       __ StoreIntoObjectNoBarrier(instance_reg, | 1964       __ StoreIntoObjectNoBarrier(instance_reg, | 
| 1968           FieldAddress(instance_reg, offset_in_bytes_), | 1965           FieldAddress(instance_reg, offset_in_bytes_), | 
| 1969           value_reg, | 1966           value_reg); | 
| 1970           is_object_reference_initialization_ ? |  | 
| 1971               Assembler::kEmptyOrSmiOrNull : |  | 
| 1972               Assembler::kHeapObjectOrSmi); |  | 
| 1973     } | 1967     } | 
| 1974   } | 1968   } | 
| 1975   __ Bind(&skip_store); | 1969   __ Bind(&skip_store); | 
| 1976 } | 1970 } | 
| 1977 | 1971 | 
| 1978 | 1972 | 
| 1979 LocationSummary* LoadStaticFieldInstr::MakeLocationSummary(Zone* zone, | 1973 LocationSummary* LoadStaticFieldInstr::MakeLocationSummary(Zone* zone, | 
| 1980                                                            bool opt) const { | 1974                                                            bool opt) const { | 
| 1981   const intptr_t kNumInputs = 1; | 1975   const intptr_t kNumInputs = 1; | 
| 1982   const intptr_t kNumTemps = 0; | 1976   const intptr_t kNumTemps = 0; | 
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2079   const Register kElemTypeReg = RBX; | 2073   const Register kElemTypeReg = RBX; | 
| 2080   const intptr_t instance_size = Array::InstanceSize(num_elements); | 2074   const intptr_t instance_size = Array::InstanceSize(num_elements); | 
| 2081 | 2075 | 
| 2082   __ TryAllocateArray(kArrayCid, instance_size, slow_path, Assembler::kFarJump, | 2076   __ TryAllocateArray(kArrayCid, instance_size, slow_path, Assembler::kFarJump, | 
| 2083                       RAX,  // instance | 2077                       RAX,  // instance | 
| 2084                       RCX,  // end address | 2078                       RCX,  // end address | 
| 2085                       R13);  // temp | 2079                       R13);  // temp | 
| 2086 | 2080 | 
| 2087   // RAX: new object start as a tagged pointer. | 2081   // RAX: new object start as a tagged pointer. | 
| 2088   // Store the type argument field. | 2082   // Store the type argument field. | 
| 2089   __ InitializeFieldNoBarrier(RAX, | 2083   __ StoreIntoObjectNoBarrier(RAX, | 
| 2090                               FieldAddress(RAX, Array::type_arguments_offset()), | 2084                               FieldAddress(RAX, Array::type_arguments_offset()), | 
| 2091                               kElemTypeReg); | 2085                               kElemTypeReg); | 
| 2092 | 2086 | 
| 2093   // Set the length field. | 2087   // Set the length field. | 
| 2094   __ InitializeFieldNoBarrier(RAX, | 2088   __ StoreIntoObjectNoBarrier(RAX, | 
| 2095                               FieldAddress(RAX, Array::length_offset()), | 2089                               FieldAddress(RAX, Array::length_offset()), | 
| 2096                               kLengthReg); | 2090                               kLengthReg); | 
| 2097 | 2091 | 
| 2098   // Initialize all array elements to raw_null. | 2092   // Initialize all array elements to raw_null. | 
| 2099   // RAX: new object start as a tagged pointer. | 2093   // RAX: new object start as a tagged pointer. | 
| 2100   // RCX: new object end address. | 2094   // RCX: new object end address. | 
| 2101   // RDI: iterator which initially points to the start of the variable | 2095   // RDI: iterator which initially points to the start of the variable | 
| 2102   // data area to be initialized. | 2096   // data area to be initialized. | 
| 2103   if (num_elements > 0) { | 2097   if (num_elements > 0) { | 
| 2104     const intptr_t array_size = instance_size - sizeof(RawArray); | 2098     const intptr_t array_size = instance_size - sizeof(RawArray); | 
| 2105     __ LoadObject(R12, Object::null_object()); | 2099     __ LoadObject(R12, Object::null_object()); | 
| 2106     __ leaq(RDI, FieldAddress(RAX, sizeof(RawArray))); | 2100     __ leaq(RDI, FieldAddress(RAX, sizeof(RawArray))); | 
| 2107     if (array_size < (kInlineArraySize * kWordSize)) { | 2101     if (array_size < (kInlineArraySize * kWordSize)) { | 
| 2108       intptr_t current_offset = 0; | 2102       intptr_t current_offset = 0; | 
| 2109       while (current_offset < array_size) { | 2103       while (current_offset < array_size) { | 
| 2110         __ InitializeFieldNoBarrier(RAX, Address(RDI, current_offset), R12); | 2104         __ StoreIntoObjectNoBarrier(RAX, Address(RDI, current_offset), R12); | 
| 2111         current_offset += kWordSize; | 2105         current_offset += kWordSize; | 
| 2112       } | 2106       } | 
| 2113     } else { | 2107     } else { | 
| 2114       Label init_loop; | 2108       Label init_loop; | 
| 2115       __ Bind(&init_loop); | 2109       __ Bind(&init_loop); | 
| 2116       __ InitializeFieldNoBarrier(RAX, Address(RDI, 0), R12); | 2110       __ StoreIntoObjectNoBarrier(RAX, Address(RDI, 0), R12); | 
| 2117       __ addq(RDI, Immediate(kWordSize)); | 2111       __ addq(RDI, Immediate(kWordSize)); | 
| 2118       __ cmpq(RDI, RCX); | 2112       __ cmpq(RDI, RCX); | 
| 2119       __ j(BELOW, &init_loop, Assembler::kNearJump); | 2113       __ j(BELOW, &init_loop, Assembler::kNearJump); | 
| 2120     } | 2114     } | 
| 2121   } | 2115   } | 
| 2122   __ jmp(done, Assembler::kNearJump); | 2116   __ jmp(done, Assembler::kNearJump); | 
| 2123 } | 2117 } | 
| 2124 | 2118 | 
| 2125 | 2119 | 
| 2126 void CreateArrayInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2120 void CreateArrayInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 
| (...skipping 4431 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 6558   __ Drop(1); | 6552   __ Drop(1); | 
| 6559   __ popq(result); | 6553   __ popq(result); | 
| 6560 } | 6554 } | 
| 6561 | 6555 | 
| 6562 | 6556 | 
| 6563 }  // namespace dart | 6557 }  // namespace dart | 
| 6564 | 6558 | 
| 6565 #undef __ | 6559 #undef __ | 
| 6566 | 6560 | 
| 6567 #endif  // defined TARGET_ARCH_X64 | 6561 #endif  // defined TARGET_ARCH_X64 | 
| OLD | NEW | 
|---|