OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_X64 | 7 #if V8_TARGET_ARCH_X64 |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
(...skipping 3258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3269 Register elements_pointer_reg = ToRegister(elements_pointer); | 3269 Register elements_pointer_reg = ToRegister(elements_pointer); |
3270 int shift_size = ElementsKindToShiftSize(elements_kind); | 3270 int shift_size = ElementsKindToShiftSize(elements_kind); |
3271 if (key->IsConstantOperand()) { | 3271 if (key->IsConstantOperand()) { |
3272 int32_t constant_value = ToInteger32(LConstantOperand::cast(key)); | 3272 int32_t constant_value = ToInteger32(LConstantOperand::cast(key)); |
3273 if (constant_value & 0xF0000000) { | 3273 if (constant_value & 0xF0000000) { |
3274 Abort(kArrayIndexConstantValueTooBig); | 3274 Abort(kArrayIndexConstantValueTooBig); |
3275 } | 3275 } |
3276 return Operand(elements_pointer_reg, | 3276 return Operand(elements_pointer_reg, |
3277 (constant_value << shift_size) + offset); | 3277 (constant_value << shift_size) + offset); |
3278 } else { | 3278 } else { |
3279 // Take the tag bit into account while computing the shift size. | 3279 // Guaranteed by ArrayInstructionInterface::KeyedAccessIndexRequirement(). |
3280 if (key_representation.IsSmi() && (shift_size >= 1)) { | 3280 DCHECK(key_representation.IsInteger32()); |
3281 DCHECK(SmiValuesAre31Bits()); | 3281 |
3282 shift_size -= kSmiTagSize; | |
3283 } | |
3284 ScaleFactor scale_factor = static_cast<ScaleFactor>(shift_size); | 3282 ScaleFactor scale_factor = static_cast<ScaleFactor>(shift_size); |
3285 return Operand(elements_pointer_reg, | 3283 return Operand(elements_pointer_reg, |
3286 ToRegister(key), | 3284 ToRegister(key), |
3287 scale_factor, | 3285 scale_factor, |
3288 offset); | 3286 offset); |
3289 } | 3287 } |
3290 } | 3288 } |
3291 | 3289 |
3292 | 3290 |
3293 void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) { | 3291 void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) { |
(...skipping 2595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5889 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5887 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
5890 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5888 RecordSafepoint(Safepoint::kNoLazyDeopt); |
5891 } | 5889 } |
5892 | 5890 |
5893 | 5891 |
5894 #undef __ | 5892 #undef __ |
5895 | 5893 |
5896 } } // namespace v8::internal | 5894 } } // namespace v8::internal |
5897 | 5895 |
5898 #endif // V8_TARGET_ARCH_X64 | 5896 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |