| 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/dart_entry.h" | 10 #include "vm/dart_entry.h" |
| (...skipping 1166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1177 break; | 1177 break; |
| 1178 case kTypedDataInt16ArrayCid: | 1178 case kTypedDataInt16ArrayCid: |
| 1179 __ movsxw(result, element_address); | 1179 __ movsxw(result, element_address); |
| 1180 __ SmiTag(result); | 1180 __ SmiTag(result); |
| 1181 break; | 1181 break; |
| 1182 case kTypedDataUint16ArrayCid: | 1182 case kTypedDataUint16ArrayCid: |
| 1183 case kTwoByteStringCid: | 1183 case kTwoByteStringCid: |
| 1184 __ movzxw(result, element_address); | 1184 __ movzxw(result, element_address); |
| 1185 __ SmiTag(result); | 1185 __ SmiTag(result); |
| 1186 break; | 1186 break; |
| 1187 case kTypedDataInt32ArrayCid: { | |
| 1188 Label* deopt = compiler->AddDeoptStub(deopt_id(), | |
| 1189 ICData::kDeoptInt32Load); | |
| 1190 __ movl(result, element_address); | |
| 1191 // Verify that the signed value in 'result' can fit inside a Smi. | |
| 1192 __ cmpl(result, Immediate(0xC0000000)); | |
| 1193 __ j(NEGATIVE, deopt); | |
| 1194 __ SmiTag(result); | |
| 1195 } | |
| 1196 break; | |
| 1197 case kTypedDataUint32ArrayCid: { | |
| 1198 Label* deopt = compiler->AddDeoptStub(deopt_id(), | |
| 1199 ICData::kDeoptUint32Load); | |
| 1200 __ movl(result, element_address); | |
| 1201 // Verify that the unsigned value in 'result' can fit inside a Smi. | |
| 1202 __ testl(result, Immediate(0xC0000000)); | |
| 1203 __ j(NOT_ZERO, deopt); | |
| 1204 __ SmiTag(result); | |
| 1205 } | |
| 1206 break; | |
| 1207 default: | 1187 default: |
| 1208 ASSERT((class_id() == kArrayCid) || (class_id() == kImmutableArrayCid)); | 1188 ASSERT((class_id() == kArrayCid) || (class_id() == kImmutableArrayCid)); |
| 1209 __ movl(result, element_address); | 1189 __ movl(result, element_address); |
| 1210 break; | 1190 break; |
| 1211 } | 1191 } |
| 1212 } | 1192 } |
| 1213 | 1193 |
| 1214 | 1194 |
| 1215 Representation StoreIndexedInstr::RequiredInputRepresentation( | 1195 Representation StoreIndexedInstr::RequiredInputRepresentation( |
| 1216 intptr_t idx) const { | 1196 intptr_t idx) const { |
| (...skipping 4840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6057 Register left_lo = left_pair->At(0).reg(); | 6037 Register left_lo = left_pair->At(0).reg(); |
| 6058 Register left_hi = left_pair->At(1).reg(); | 6038 Register left_hi = left_pair->At(1).reg(); |
| 6059 PairLocation* out_pair = locs()->out(0).AsPairLocation(); | 6039 PairLocation* out_pair = locs()->out(0).AsPairLocation(); |
| 6060 Register out_lo = out_pair->At(0).reg(); | 6040 Register out_lo = out_pair->At(0).reg(); |
| 6061 Register out_hi = out_pair->At(1).reg(); | 6041 Register out_hi = out_pair->At(1).reg(); |
| 6062 ASSERT(out_lo == left_lo); | 6042 ASSERT(out_lo == left_lo); |
| 6063 ASSERT(out_hi == left_hi); | 6043 ASSERT(out_hi == left_hi); |
| 6064 | 6044 |
| 6065 Label* deopt = NULL; | 6045 Label* deopt = NULL; |
| 6066 if (CanDeoptimize()) { | 6046 if (CanDeoptimize()) { |
| 6067 deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptShiftMintOp); | 6047 deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptBinaryMintOp); |
| 6068 } | 6048 } |
| 6069 if (locs()->in(1).IsConstant()) { | 6049 if (locs()->in(1).IsConstant()) { |
| 6070 // Code for a constant shift amount. | 6050 // Code for a constant shift amount. |
| 6071 ASSERT(locs()->in(1).constant().IsSmi()); | 6051 ASSERT(locs()->in(1).constant().IsSmi()); |
| 6072 const int32_t shift = | 6052 const int32_t shift = |
| 6073 reinterpret_cast<int32_t>(locs()->in(1).constant().raw()) >> 1; | 6053 reinterpret_cast<int32_t>(locs()->in(1).constant().raw()) >> 1; |
| 6074 switch (op_kind()) { | 6054 switch (op_kind()) { |
| 6075 case Token::kSHR: { | 6055 case Token::kSHR: { |
| 6076 if (shift > 31) { | 6056 if (shift > 31) { |
| 6077 __ movl(left_lo, left_hi); // Shift by 32. | 6057 __ movl(left_lo, left_hi); // Shift by 32. |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6296 | 6276 |
| 6297 | 6277 |
| 6298 void ShiftUint32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 6278 void ShiftUint32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 6299 const intptr_t kShifterLimit = 31; | 6279 const intptr_t kShifterLimit = 31; |
| 6300 | 6280 |
| 6301 Register left = locs()->in(0).reg(); | 6281 Register left = locs()->in(0).reg(); |
| 6302 Register out = locs()->out(0).reg(); | 6282 Register out = locs()->out(0).reg(); |
| 6303 ASSERT(left == out); | 6283 ASSERT(left == out); |
| 6304 | 6284 |
| 6305 | 6285 |
| 6306 Label* deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptShiftMintOp); | 6286 Label* deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptBinaryMintOp); |
| 6307 | 6287 |
| 6308 if (locs()->in(1).IsConstant()) { | 6288 if (locs()->in(1).IsConstant()) { |
| 6309 // Shifter is constant. | 6289 // Shifter is constant. |
| 6310 | 6290 |
| 6311 const Object& constant = locs()->in(1).constant(); | 6291 const Object& constant = locs()->in(1).constant(); |
| 6312 ASSERT(constant.IsSmi()); | 6292 ASSERT(constant.IsSmi()); |
| 6313 const intptr_t shift_value = Smi::Cast(constant).Value(); | 6293 const intptr_t shift_value = Smi::Cast(constant).Value(); |
| 6314 | 6294 |
| 6315 | 6295 |
| 6316 // Do the shift: (shift_value > 0) && (shift_value <= kShifterLimit). | 6296 // Do the shift: (shift_value > 0) && (shift_value <= kShifterLimit). |
| (...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6828 #if defined(DEBUG) | 6808 #if defined(DEBUG) |
| 6829 __ movl(EDX, Immediate(kInvalidObjectPointer)); | 6809 __ movl(EDX, Immediate(kInvalidObjectPointer)); |
| 6830 #endif | 6810 #endif |
| 6831 } | 6811 } |
| 6832 | 6812 |
| 6833 } // namespace dart | 6813 } // namespace dart |
| 6834 | 6814 |
| 6835 #undef __ | 6815 #undef __ |
| 6836 | 6816 |
| 6837 #endif // defined TARGET_ARCH_IA32 | 6817 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |