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 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 | 497 |
498 | 498 |
499 XMMRegister LCodeGen::ToDoubleRegister(LOperand* op) const { | 499 XMMRegister LCodeGen::ToDoubleRegister(LOperand* op) const { |
500 ASSERT(op->IsDoubleRegister()); | 500 ASSERT(op->IsDoubleRegister()); |
501 return ToDoubleRegister(op->index()); | 501 return ToDoubleRegister(op->index()); |
502 } | 502 } |
503 | 503 |
504 | 504 |
505 int LCodeGen::ToInteger32(LConstantOperand* op) const { | 505 int LCodeGen::ToInteger32(LConstantOperand* op) const { |
506 HConstant* constant = chunk_->LookupConstant(op); | 506 HConstant* constant = chunk_->LookupConstant(op); |
507 ASSERT(chunk_->LookupLiteralRepresentation(op).IsInteger32()); | |
508 ASSERT(constant->HasInteger32Value()); | |
509 return constant->Integer32Value(); | 507 return constant->Integer32Value(); |
510 } | 508 } |
511 | 509 |
512 | 510 |
513 Handle<Object> LCodeGen::ToHandle(LConstantOperand* op) const { | 511 Handle<Object> LCodeGen::ToHandle(LConstantOperand* op) const { |
514 HConstant* constant = chunk_->LookupConstant(op); | 512 HConstant* constant = chunk_->LookupConstant(op); |
515 ASSERT(chunk_->LookupLiteralRepresentation(op).IsTagged()); | 513 ASSERT(chunk_->LookupLiteralRepresentation(op).IsTagged()); |
516 return constant->handle(); | 514 return constant->handle(); |
517 } | 515 } |
518 | 516 |
(...skipping 2683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3202 | 3200 |
3203 Operand LCodeGen::BuildFastArrayOperand( | 3201 Operand LCodeGen::BuildFastArrayOperand( |
3204 LOperand* elements_pointer, | 3202 LOperand* elements_pointer, |
3205 LOperand* key, | 3203 LOperand* key, |
3206 Representation key_representation, | 3204 Representation key_representation, |
3207 ElementsKind elements_kind, | 3205 ElementsKind elements_kind, |
3208 uint32_t offset, | 3206 uint32_t offset, |
3209 uint32_t additional_index) { | 3207 uint32_t additional_index) { |
3210 Register elements_pointer_reg = ToRegister(elements_pointer); | 3208 Register elements_pointer_reg = ToRegister(elements_pointer); |
3211 int shift_size = ElementsKindToShiftSize(elements_kind); | 3209 int shift_size = ElementsKindToShiftSize(elements_kind); |
3212 // Even though the HLoad/StoreKeyed instructions force the input | |
3213 // representation for the key to be an integer, the input gets replaced during | |
3214 // bound check elimination with the index argument to the bounds check, which | |
3215 // can be tagged, so that case must be handled here, too. | |
3216 if (key_representation.IsTagged() && (shift_size >= 1)) { | |
3217 shift_size -= kSmiTagSize; | |
3218 } | |
3219 if (key->IsConstantOperand()) { | 3210 if (key->IsConstantOperand()) { |
3220 int constant_value = ToInteger32(LConstantOperand::cast(key)); | 3211 int constant_value = ToInteger32(LConstantOperand::cast(key)); |
3221 if (constant_value & 0xF0000000) { | 3212 if (constant_value & 0xF0000000) { |
3222 Abort("array index constant value too big"); | 3213 Abort("array index constant value too big"); |
3223 } | 3214 } |
3224 return Operand(elements_pointer_reg, | 3215 return Operand(elements_pointer_reg, |
3225 ((constant_value + additional_index) << shift_size) | 3216 ((constant_value + additional_index) << shift_size) |
3226 + offset); | 3217 + offset); |
3227 } else { | 3218 } else { |
| 3219 // Take the tag bit into account while computing the shift size. |
| 3220 if (key_representation.IsTagged() && (shift_size >= 1)) { |
| 3221 shift_size -= kSmiTagSize; |
| 3222 } |
3228 ScaleFactor scale_factor = static_cast<ScaleFactor>(shift_size); | 3223 ScaleFactor scale_factor = static_cast<ScaleFactor>(shift_size); |
3229 return Operand(elements_pointer_reg, | 3224 return Operand(elements_pointer_reg, |
3230 ToRegister(key), | 3225 ToRegister(key), |
3231 scale_factor, | 3226 scale_factor, |
3232 offset + (additional_index << shift_size)); | 3227 offset + (additional_index << shift_size)); |
3233 } | 3228 } |
3234 } | 3229 } |
3235 | 3230 |
3236 | 3231 |
3237 void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) { | 3232 void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) { |
(...skipping 2743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5981 FixedArray::kHeaderSize - kPointerSize)); | 5976 FixedArray::kHeaderSize - kPointerSize)); |
5982 __ bind(&done); | 5977 __ bind(&done); |
5983 } | 5978 } |
5984 | 5979 |
5985 | 5980 |
5986 #undef __ | 5981 #undef __ |
5987 | 5982 |
5988 } } // namespace v8::internal | 5983 } } // namespace v8::internal |
5989 | 5984 |
5990 #endif // V8_TARGET_ARCH_IA32 | 5985 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |