| 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 "lib/error.h" | 10 #include "lib/error.h" |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 // We should never return here. | 212 // We should never return here. |
| 213 __ int3(); | 213 __ int3(); |
| 214 __ Bind(&done); | 214 __ Bind(&done); |
| 215 } | 215 } |
| 216 | 216 |
| 217 | 217 |
| 218 void AssertBooleanInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 218 void AssertBooleanInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 219 Register obj = locs()->in(0).reg(); | 219 Register obj = locs()->in(0).reg(); |
| 220 Register result = locs()->out().reg(); | 220 Register result = locs()->out().reg(); |
| 221 | 221 |
| 222 EmitAssertBoolean(obj, token_pos(), deopt_id(), locs(), compiler); | 222 if (!is_eliminated()) { |
| 223 EmitAssertBoolean(obj, token_pos(), deopt_id(), locs(), compiler); |
| 224 } |
| 223 ASSERT(obj == result); | 225 ASSERT(obj == result); |
| 224 } | 226 } |
| 225 | 227 |
| 226 | 228 |
| 227 LocationSummary* ArgumentDefinitionTestInstr::MakeLocationSummary() const { | 229 LocationSummary* ArgumentDefinitionTestInstr::MakeLocationSummary() const { |
| 228 const intptr_t kNumInputs = 1; | 230 const intptr_t kNumInputs = 1; |
| 229 const intptr_t kNumTemps = 0; | 231 const intptr_t kNumTemps = 0; |
| 230 LocationSummary* locs = | 232 LocationSummary* locs = |
| 231 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); | 233 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); |
| 232 locs->set_in(0, Location::RegisterLocation(RAX)); | 234 locs->set_in(0, Location::RegisterLocation(RAX)); |
| (...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 952 Register result = locs()->out().reg(); | 954 Register result = locs()->out().reg(); |
| 953 __ movq(result, | 955 __ movq(result, |
| 954 Immediate(reinterpret_cast<uword>(Symbols::PredefinedAddress()))); | 956 Immediate(reinterpret_cast<uword>(Symbols::PredefinedAddress()))); |
| 955 __ movq(result, Address(result, | 957 __ movq(result, Address(result, |
| 956 char_code, | 958 char_code, |
| 957 TIMES_HALF_WORD_SIZE, // Char code is a smi. | 959 TIMES_HALF_WORD_SIZE, // Char code is a smi. |
| 958 Symbols::kNullCharCodeSymbolOffset * kWordSize)); | 960 Symbols::kNullCharCodeSymbolOffset * kWordSize)); |
| 959 } | 961 } |
| 960 | 962 |
| 961 | 963 |
| 962 CompileType* LoadIndexedInstr::ComputeInitialType() const { | 964 intptr_t LoadIndexedInstr::ResultCid() const { |
| 963 switch (class_id_) { | 965 switch (class_id_) { |
| 964 case kArrayCid: | 966 case kArrayCid: |
| 965 case kImmutableArrayCid: | 967 case kImmutableArrayCid: |
| 966 return CompileType::Dynamic(); | 968 return kDynamicCid; |
| 967 | |
| 968 case kFloat32ArrayCid : | 969 case kFloat32ArrayCid : |
| 969 case kFloat64ArrayCid : | 970 case kFloat64ArrayCid : |
| 970 return CompileType::FromCid(kDoubleCid); | 971 return kDoubleCid; |
| 971 | |
| 972 case kInt8ArrayCid: | 972 case kInt8ArrayCid: |
| 973 case kUint8ArrayCid: | 973 case kUint8ArrayCid: |
| 974 case kUint8ClampedArrayCid: | 974 case kUint8ClampedArrayCid: |
| 975 case kExternalUint8ArrayCid: | 975 case kExternalUint8ArrayCid: |
| 976 case kExternalUint8ClampedArrayCid: | 976 case kExternalUint8ClampedArrayCid: |
| 977 case kInt16ArrayCid: | 977 case kInt16ArrayCid: |
| 978 case kUint16ArrayCid: | 978 case kUint16ArrayCid: |
| 979 case kOneByteStringCid: | 979 case kOneByteStringCid: |
| 980 case kTwoByteStringCid: | 980 case kTwoByteStringCid: |
| 981 case kInt32ArrayCid: | 981 case kInt32ArrayCid: |
| 982 case kUint32ArrayCid: | 982 case kUint32ArrayCid: |
| 983 return CompileType::FromCid(kSmiCid); | 983 return kSmiCid; |
| 984 | |
| 985 default: | 984 default: |
| 986 UNIMPLEMENTED(); | 985 UNIMPLEMENTED(); |
| 987 return NULL; | 986 return kSmiCid; |
| 988 } | 987 } |
| 989 } | 988 } |
| 990 | 989 |
| 991 | 990 |
| 992 Representation LoadIndexedInstr::representation() const { | 991 Representation LoadIndexedInstr::representation() const { |
| 993 switch (class_id_) { | 992 switch (class_id_) { |
| 994 case kArrayCid: | 993 case kArrayCid: |
| 995 case kImmutableArrayCid: | 994 case kImmutableArrayCid: |
| 996 case kInt8ArrayCid: | 995 case kInt8ArrayCid: |
| 997 case kUint8ArrayCid: | 996 case kUint8ArrayCid: |
| (...skipping 1123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2121 break; | 2120 break; |
| 2122 } | 2121 } |
| 2123 default: | 2122 default: |
| 2124 UNREACHABLE(); | 2123 UNREACHABLE(); |
| 2125 break; | 2124 break; |
| 2126 } | 2125 } |
| 2127 } | 2126 } |
| 2128 | 2127 |
| 2129 | 2128 |
| 2130 LocationSummary* CheckEitherNonSmiInstr::MakeLocationSummary() const { | 2129 LocationSummary* CheckEitherNonSmiInstr::MakeLocationSummary() const { |
| 2131 ASSERT((left()->Type()->ToCid() != kDoubleCid) && | 2130 ASSERT((left()->ResultCid() != kDoubleCid) && |
| 2132 (right()->Type()->ToCid() != kDoubleCid)); | 2131 (right()->ResultCid() != kDoubleCid)); |
| 2133 const intptr_t kNumInputs = 2; | 2132 const intptr_t kNumInputs = 2; |
| 2134 const intptr_t kNumTemps = 1; | 2133 const intptr_t kNumTemps = 1; |
| 2135 LocationSummary* summary = | 2134 LocationSummary* summary = |
| 2136 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); | 2135 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 2137 summary->set_in(0, Location::RequiresRegister()); | 2136 summary->set_in(0, Location::RequiresRegister()); |
| 2138 summary->set_in(1, Location::RequiresRegister()); | 2137 summary->set_in(1, Location::RequiresRegister()); |
| 2139 summary->set_temp(0, Location::RequiresRegister()); | 2138 summary->set_temp(0, Location::RequiresRegister()); |
| 2140 return summary; | 2139 return summary; |
| 2141 } | 2140 } |
| 2142 | 2141 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2219 LocationSummary* summary = | 2218 LocationSummary* summary = |
| 2220 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); | 2219 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 2221 summary->set_in(0, Location::RequiresRegister()); | 2220 summary->set_in(0, Location::RequiresRegister()); |
| 2222 if (CanDeoptimize()) summary->set_temp(0, Location::RequiresRegister()); | 2221 if (CanDeoptimize()) summary->set_temp(0, Location::RequiresRegister()); |
| 2223 summary->set_out(Location::RequiresFpuRegister()); | 2222 summary->set_out(Location::RequiresFpuRegister()); |
| 2224 return summary; | 2223 return summary; |
| 2225 } | 2224 } |
| 2226 | 2225 |
| 2227 | 2226 |
| 2228 void UnboxDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2227 void UnboxDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2229 const intptr_t value_cid = value()->Type()->ToCid(); | 2228 const intptr_t value_cid = value()->ResultCid(); |
| 2230 const Register value = locs()->in(0).reg(); | 2229 const Register value = locs()->in(0).reg(); |
| 2231 const XmmRegister result = locs()->out().fpu_reg(); | 2230 const XmmRegister result = locs()->out().fpu_reg(); |
| 2232 | 2231 |
| 2233 if (value_cid == kDoubleCid) { | 2232 if (value_cid == kDoubleCid) { |
| 2234 __ movsd(result, FieldAddress(value, Double::value_offset())); | 2233 __ movsd(result, FieldAddress(value, Double::value_offset())); |
| 2235 } else if (value_cid == kSmiCid) { | 2234 } else if (value_cid == kSmiCid) { |
| 2236 __ SmiUntag(value); // Untag input before conversion. | 2235 __ SmiUntag(value); // Untag input before conversion. |
| 2237 __ cvtsi2sd(result, value); | 2236 __ cvtsi2sd(result, value); |
| 2238 __ SmiTag(value); // Restore input register. | 2237 __ SmiTag(value); // Restore input register. |
| 2239 } else { | 2238 } else { |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2621 const intptr_t kNumInputs = 1; | 2620 const intptr_t kNumInputs = 1; |
| 2622 const intptr_t kNumTemps = 0; | 2621 const intptr_t kNumTemps = 0; |
| 2623 LocationSummary* summary = | 2622 LocationSummary* summary = |
| 2624 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); | 2623 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 2625 summary->set_in(0, Location::RequiresRegister()); | 2624 summary->set_in(0, Location::RequiresRegister()); |
| 2626 return summary; | 2625 return summary; |
| 2627 } | 2626 } |
| 2628 | 2627 |
| 2629 | 2628 |
| 2630 void CheckSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2629 void CheckSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2630 // TODO(srdjan): Check if we can remove this by reordering CSE and LICM. |
| 2631 if (value()->ResultCid() == kSmiCid) return; |
| 2631 Register value = locs()->in(0).reg(); | 2632 Register value = locs()->in(0).reg(); |
| 2632 Label* deopt = compiler->AddDeoptStub(deopt_id(), | 2633 Label* deopt = compiler->AddDeoptStub(deopt_id(), |
| 2633 kDeoptCheckSmi); | 2634 kDeoptCheckSmi); |
| 2634 __ testq(value, Immediate(kSmiTagMask)); | 2635 __ testq(value, Immediate(kSmiTagMask)); |
| 2635 __ j(NOT_ZERO, deopt); | 2636 __ j(NOT_ZERO, deopt); |
| 2636 } | 2637 } |
| 2637 | 2638 |
| 2638 | 2639 |
| 2639 LocationSummary* CheckArrayBoundInstr::MakeLocationSummary() const { | 2640 LocationSummary* CheckArrayBoundInstr::MakeLocationSummary() const { |
| 2640 const intptr_t kNumInputs = 2; | 2641 const intptr_t kNumInputs = 2; |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3045 PcDescriptors::kOther, | 3046 PcDescriptors::kOther, |
| 3046 locs()); | 3047 locs()); |
| 3047 __ Drop(2); // Discard type arguments and receiver. | 3048 __ Drop(2); // Discard type arguments and receiver. |
| 3048 } | 3049 } |
| 3049 | 3050 |
| 3050 } // namespace dart | 3051 } // namespace dart |
| 3051 | 3052 |
| 3052 #undef __ | 3053 #undef __ |
| 3053 | 3054 |
| 3054 #endif // defined TARGET_ARCH_X64 | 3055 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |