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 3262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3273 Register elements_pointer_reg = ToRegister(elements_pointer); | 3273 Register elements_pointer_reg = ToRegister(elements_pointer); |
3274 int shift_size = ElementsKindToShiftSize(elements_kind); | 3274 int shift_size = ElementsKindToShiftSize(elements_kind); |
3275 if (key->IsConstantOperand()) { | 3275 if (key->IsConstantOperand()) { |
3276 int32_t constant_value = ToInteger32(LConstantOperand::cast(key)); | 3276 int32_t constant_value = ToInteger32(LConstantOperand::cast(key)); |
3277 if (constant_value & 0xF0000000) { | 3277 if (constant_value & 0xF0000000) { |
3278 Abort(kArrayIndexConstantValueTooBig); | 3278 Abort(kArrayIndexConstantValueTooBig); |
3279 } | 3279 } |
3280 return Operand(elements_pointer_reg, | 3280 return Operand(elements_pointer_reg, |
3281 (constant_value << shift_size) + offset); | 3281 (constant_value << shift_size) + offset); |
3282 } else { | 3282 } else { |
3283 // Take the tag bit into account while computing the shift size. | 3283 // Guaranteed by ArrayInstructionInterface::KeyedAccessIndexRequirement(). |
3284 if (key_representation.IsSmi() && (shift_size >= 1)) { | 3284 DCHECK(key_representation.IsInteger32()); |
3285 DCHECK(SmiValuesAre31Bits()); | 3285 |
3286 shift_size -= kSmiTagSize; | |
3287 } | |
3288 ScaleFactor scale_factor = static_cast<ScaleFactor>(shift_size); | 3286 ScaleFactor scale_factor = static_cast<ScaleFactor>(shift_size); |
3289 return Operand(elements_pointer_reg, | 3287 return Operand(elements_pointer_reg, |
3290 ToRegister(key), | 3288 ToRegister(key), |
3291 scale_factor, | 3289 scale_factor, |
3292 offset); | 3290 offset); |
3293 } | 3291 } |
3294 } | 3292 } |
3295 | 3293 |
3296 | 3294 |
3297 void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) { | 3295 void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) { |
(...skipping 2620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5918 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5916 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
5919 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5917 RecordSafepoint(Safepoint::kNoLazyDeopt); |
5920 } | 5918 } |
5921 | 5919 |
5922 | 5920 |
5923 #undef __ | 5921 #undef __ |
5924 | 5922 |
5925 } } // namespace v8::internal | 5923 } } // namespace v8::internal |
5926 | 5924 |
5927 #endif // V8_TARGET_ARCH_X64 | 5925 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |