OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 | 488 |
489 | 489 |
490 XMMRegister LCodeGen::ToDoubleRegister(LOperand* op) const { | 490 XMMRegister LCodeGen::ToDoubleRegister(LOperand* op) const { |
491 ASSERT(op->IsDoubleRegister()); | 491 ASSERT(op->IsDoubleRegister()); |
492 return ToDoubleRegister(op->index()); | 492 return ToDoubleRegister(op->index()); |
493 } | 493 } |
494 | 494 |
495 | 495 |
496 int LCodeGen::ToInteger32(LConstantOperand* op) const { | 496 int LCodeGen::ToInteger32(LConstantOperand* op) const { |
497 HConstant* constant = chunk_->LookupConstant(op); | 497 HConstant* constant = chunk_->LookupConstant(op); |
| 498 ASSERT(chunk_->LookupLiteralRepresentation(op).IsInteger32()); |
| 499 ASSERT(constant->HasInteger32Value()); |
498 return constant->Integer32Value(); | 500 return constant->Integer32Value(); |
499 } | 501 } |
500 | 502 |
501 | 503 |
502 Handle<Object> LCodeGen::ToHandle(LConstantOperand* op) const { | 504 Handle<Object> LCodeGen::ToHandle(LConstantOperand* op) const { |
503 HConstant* constant = chunk_->LookupConstant(op); | 505 HConstant* constant = chunk_->LookupConstant(op); |
504 ASSERT(chunk_->LookupLiteralRepresentation(op).IsTagged()); | 506 ASSERT(chunk_->LookupLiteralRepresentation(op).IsTagged()); |
505 return constant->handle(); | 507 return constant->handle(); |
506 } | 508 } |
507 | 509 |
(...skipping 2683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3191 | 3193 |
3192 Operand LCodeGen::BuildFastArrayOperand( | 3194 Operand LCodeGen::BuildFastArrayOperand( |
3193 LOperand* elements_pointer, | 3195 LOperand* elements_pointer, |
3194 LOperand* key, | 3196 LOperand* key, |
3195 Representation key_representation, | 3197 Representation key_representation, |
3196 ElementsKind elements_kind, | 3198 ElementsKind elements_kind, |
3197 uint32_t offset, | 3199 uint32_t offset, |
3198 uint32_t additional_index) { | 3200 uint32_t additional_index) { |
3199 Register elements_pointer_reg = ToRegister(elements_pointer); | 3201 Register elements_pointer_reg = ToRegister(elements_pointer); |
3200 int shift_size = ElementsKindToShiftSize(elements_kind); | 3202 int shift_size = ElementsKindToShiftSize(elements_kind); |
| 3203 // Even though the HLoad/StoreKeyed instructions force the input |
| 3204 // representation for the key to be an integer, the input gets replaced during |
| 3205 // bound check elimination with the index argument to the bounds check, which |
| 3206 // can be tagged, so that case must be handled here, too. |
| 3207 if (key_representation.IsTagged() && (shift_size >= 1)) { |
| 3208 shift_size -= kSmiTagSize; |
| 3209 } |
3201 if (key->IsConstantOperand()) { | 3210 if (key->IsConstantOperand()) { |
3202 int constant_value = ToInteger32(LConstantOperand::cast(key)); | 3211 int constant_value = ToInteger32(LConstantOperand::cast(key)); |
3203 if (constant_value & 0xF0000000) { | 3212 if (constant_value & 0xF0000000) { |
3204 Abort("array index constant value too big"); | 3213 Abort("array index constant value too big"); |
3205 } | 3214 } |
3206 return Operand(elements_pointer_reg, | 3215 return Operand(elements_pointer_reg, |
3207 ((constant_value + additional_index) << shift_size) | 3216 ((constant_value + additional_index) << shift_size) |
3208 + offset); | 3217 + offset); |
3209 } else { | 3218 } else { |
3210 // Take the tag bit into account while computing the shift size. | |
3211 if (key_representation.IsTagged() && (shift_size >= 1)) { | |
3212 shift_size -= kSmiTagSize; | |
3213 } | |
3214 ScaleFactor scale_factor = static_cast<ScaleFactor>(shift_size); | 3219 ScaleFactor scale_factor = static_cast<ScaleFactor>(shift_size); |
3215 return Operand(elements_pointer_reg, | 3220 return Operand(elements_pointer_reg, |
3216 ToRegister(key), | 3221 ToRegister(key), |
3217 scale_factor, | 3222 scale_factor, |
3218 offset + (additional_index << shift_size)); | 3223 offset + (additional_index << shift_size)); |
3219 } | 3224 } |
3220 } | 3225 } |
3221 | 3226 |
3222 | 3227 |
3223 void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) { | 3228 void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) { |
(...skipping 2748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5972 FixedArray::kHeaderSize - kPointerSize)); | 5977 FixedArray::kHeaderSize - kPointerSize)); |
5973 __ bind(&done); | 5978 __ bind(&done); |
5974 } | 5979 } |
5975 | 5980 |
5976 | 5981 |
5977 #undef __ | 5982 #undef __ |
5978 | 5983 |
5979 } } // namespace v8::internal | 5984 } } // namespace v8::internal |
5980 | 5985 |
5981 #endif // V8_TARGET_ARCH_IA32 | 5986 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |