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 3307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3318 | 3318 |
3319 | 3319 |
3320 Operand LCodeGen::BuildFastArrayOperand( | 3320 Operand LCodeGen::BuildFastArrayOperand( |
3321 LOperand* elements_pointer, | 3321 LOperand* elements_pointer, |
3322 LOperand* key, | 3322 LOperand* key, |
3323 Representation key_representation, | 3323 Representation key_representation, |
3324 ElementsKind elements_kind, | 3324 ElementsKind elements_kind, |
3325 uint32_t offset, | 3325 uint32_t offset, |
3326 uint32_t additional_index) { | 3326 uint32_t additional_index) { |
3327 Register elements_pointer_reg = ToRegister(elements_pointer); | 3327 Register elements_pointer_reg = ToRegister(elements_pointer); |
3328 int shift_size = ElementsKindToShiftSize(elements_kind); | 3328 int element_shift_size = ElementsKindToShiftSize(elements_kind); |
| 3329 int shift_size = element_shift_size; |
3329 if (key->IsConstantOperand()) { | 3330 if (key->IsConstantOperand()) { |
3330 int constant_value = ToInteger32(LConstantOperand::cast(key)); | 3331 int constant_value = ToInteger32(LConstantOperand::cast(key)); |
3331 if (constant_value & 0xF0000000) { | 3332 if (constant_value & 0xF0000000) { |
3332 Abort("array index constant value too big"); | 3333 Abort("array index constant value too big"); |
3333 } | 3334 } |
3334 return Operand(elements_pointer_reg, | 3335 return Operand(elements_pointer_reg, |
3335 ((constant_value + additional_index) << shift_size) | 3336 ((constant_value + additional_index) << shift_size) |
3336 + offset); | 3337 + offset); |
3337 } else { | 3338 } else { |
3338 // Take the tag bit into account while computing the shift size. | 3339 // Take the tag bit into account while computing the shift size. |
3339 if (key_representation.IsTagged() && (shift_size >= 1)) { | 3340 if (key_representation.IsTagged() && (shift_size >= 1)) { |
3340 shift_size -= kSmiTagSize; | 3341 shift_size -= kSmiTagSize; |
3341 } | 3342 } |
3342 ScaleFactor scale_factor = static_cast<ScaleFactor>(shift_size); | 3343 ScaleFactor scale_factor = static_cast<ScaleFactor>(shift_size); |
3343 return Operand(elements_pointer_reg, | 3344 return Operand(elements_pointer_reg, |
3344 ToRegister(key), | 3345 ToRegister(key), |
3345 scale_factor, | 3346 scale_factor, |
3346 offset + (additional_index << shift_size)); | 3347 offset + (additional_index << element_shift_size)); |
3347 } | 3348 } |
3348 } | 3349 } |
3349 | 3350 |
3350 | 3351 |
3351 void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) { | 3352 void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) { |
3352 ASSERT(ToRegister(instr->context()).is(esi)); | 3353 ASSERT(ToRegister(instr->context()).is(esi)); |
3353 ASSERT(ToRegister(instr->object()).is(edx)); | 3354 ASSERT(ToRegister(instr->object()).is(edx)); |
3354 ASSERT(ToRegister(instr->key()).is(ecx)); | 3355 ASSERT(ToRegister(instr->key()).is(ecx)); |
3355 | 3356 |
3356 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize(); | 3357 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize(); |
(...skipping 3148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6505 FixedArray::kHeaderSize - kPointerSize)); | 6506 FixedArray::kHeaderSize - kPointerSize)); |
6506 __ bind(&done); | 6507 __ bind(&done); |
6507 } | 6508 } |
6508 | 6509 |
6509 | 6510 |
6510 #undef __ | 6511 #undef __ |
6511 | 6512 |
6512 } } // namespace v8::internal | 6513 } } // namespace v8::internal |
6513 | 6514 |
6514 #endif // V8_TARGET_ARCH_IA32 | 6515 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |