| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 4199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4210 key, | 4210 key, |
| 4211 FAST_DOUBLE_ELEMENTS, | 4211 FAST_DOUBLE_ELEMENTS, |
| 4212 FixedDoubleArray::kHeaderSize - kHeapObjectTag, | 4212 FixedDoubleArray::kHeaderSize - kHeapObjectTag, |
| 4213 instr->additional_index()); | 4213 instr->additional_index()); |
| 4214 | 4214 |
| 4215 __ movsd(double_store_operand, value); | 4215 __ movsd(double_store_operand, value); |
| 4216 } | 4216 } |
| 4217 | 4217 |
| 4218 | 4218 |
| 4219 void LCodeGen::DoStoreKeyedFixedArray(LStoreKeyed* instr) { | 4219 void LCodeGen::DoStoreKeyedFixedArray(LStoreKeyed* instr) { |
| 4220 Register elements = ToRegister(instr->elements()); | 4220 HStoreKeyed* hinstr = instr->hydrogen(); |
| 4221 LOperand* key = instr->key(); | 4221 LOperand* key = instr->key(); |
| 4222 if (!key->IsConstantOperand()) { | 4222 if (!key->IsConstantOperand()) { |
| 4223 Register key_reg = ToRegister(key); | 4223 Register key_reg = ToRegister(key); |
| 4224 // Even though the HLoad/StoreKeyedFastElement instructions force | 4224 // Even though the HLoad/StoreKeyedFastElement instructions force |
| 4225 // the input representation for the key to be an integer, the | 4225 // the input representation for the key to be an integer, the |
| 4226 // input gets replaced during bound check elimination with the index | 4226 // input gets replaced during bound check elimination with the index |
| 4227 // argument to the bounds check, which can be tagged, so that case | 4227 // argument to the bounds check, which can be tagged, so that case |
| 4228 // must be handled here, too. | 4228 // must be handled here, too. |
| 4229 if (instr->hydrogen()->IsDehoisted()) { | 4229 if (hinstr->IsDehoisted()) { |
| 4230 // Sign extend key because it could be a 32 bit negative value | 4230 // Sign extend key because it could be a 32 bit negative value |
| 4231 // and the dehoisted address computation happens in 64 bits | 4231 // and the dehoisted address computation happens in 64 bits |
| 4232 __ movsxlq(key_reg, key_reg); | 4232 __ movsxlq(key_reg, key_reg); |
| 4233 } | 4233 } |
| 4234 } | 4234 } |
| 4235 | 4235 |
| 4236 int offset = FixedArray::kHeaderSize - kHeapObjectTag; |
| 4237 Representation representation = hinstr->value()->representation(); |
| 4238 |
| 4239 if (representation.IsInteger32()) { |
| 4240 if (hinstr->store_to_initialized_element()) { |
| 4241 // Store int value directly to upper half of the smi. |
| 4242 STATIC_ASSERT(kSmiTag == 0); |
| 4243 STATIC_ASSERT(kSmiTagSize + kSmiShiftSize == 32); |
| 4244 offset += kPointerSize / 2; |
| 4245 |
| 4246 } else { |
| 4247 if (instr->value()->IsRegister()) { |
| 4248 Register value = ToRegister(instr->value()); |
| 4249 __ Integer32ToSmi(value, value); |
| 4250 } |
| 4251 representation = Representation::Smi(); |
| 4252 } |
| 4253 } |
| 4254 |
| 4236 Operand operand = | 4255 Operand operand = |
| 4237 BuildFastArrayOperand(instr->elements(), | 4256 BuildFastArrayOperand(instr->elements(), |
| 4238 key, | 4257 key, |
| 4239 FAST_ELEMENTS, | 4258 FAST_ELEMENTS, |
| 4240 FixedArray::kHeaderSize - kHeapObjectTag, | 4259 offset, |
| 4241 instr->additional_index()); | 4260 instr->additional_index()); |
| 4261 |
| 4242 if (instr->value()->IsRegister()) { | 4262 if (instr->value()->IsRegister()) { |
| 4243 __ movq(operand, ToRegister(instr->value())); | 4263 __ Store(operand, ToRegister(instr->value()), representation); |
| 4244 } else { | 4264 } else { |
| 4245 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); | 4265 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); |
| 4246 if (IsInteger32Constant(operand_value)) { | 4266 if (IsInteger32Constant(operand_value)) { |
| 4247 Smi* smi_value = Smi::FromInt(ToInteger32(operand_value)); | 4267 int32_t value = ToInteger32(operand_value); |
| 4248 __ Move(operand, smi_value); | 4268 if (representation.IsSmi()) { |
| 4269 __ Move(operand, Smi::FromInt(value)); |
| 4270 |
| 4271 } else { |
| 4272 __ movl(operand, Immediate(value)); |
| 4273 } |
| 4249 } else { | 4274 } else { |
| 4250 Handle<Object> handle_value = ToHandle(operand_value); | 4275 Handle<Object> handle_value = ToHandle(operand_value); |
| 4251 __ Move(operand, handle_value); | 4276 __ Move(operand, handle_value); |
| 4252 } | 4277 } |
| 4253 } | 4278 } |
| 4254 | 4279 |
| 4255 if (instr->hydrogen()->NeedsWriteBarrier()) { | 4280 if (hinstr->NeedsWriteBarrier()) { |
| 4281 Register elements = ToRegister(instr->elements()); |
| 4256 ASSERT(instr->value()->IsRegister()); | 4282 ASSERT(instr->value()->IsRegister()); |
| 4257 Register value = ToRegister(instr->value()); | 4283 Register value = ToRegister(instr->value()); |
| 4258 ASSERT(!instr->key()->IsConstantOperand()); | 4284 ASSERT(!instr->key()->IsConstantOperand()); |
| 4259 SmiCheck check_needed = | 4285 SmiCheck check_needed = hinstr->value()->IsHeapObject() |
| 4260 instr->hydrogen()->value()->IsHeapObject() | |
| 4261 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; | 4286 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; |
| 4262 // Compute address of modified element and store it into key register. | 4287 // Compute address of modified element and store it into key register. |
| 4263 Register key_reg(ToRegister(key)); | 4288 Register key_reg(ToRegister(key)); |
| 4264 __ lea(key_reg, operand); | 4289 __ lea(key_reg, operand); |
| 4265 __ RecordWrite(elements, | 4290 __ RecordWrite(elements, |
| 4266 key_reg, | 4291 key_reg, |
| 4267 value, | 4292 value, |
| 4268 kSaveFPRegs, | 4293 kSaveFPRegs, |
| 4269 EMIT_REMEMBERED_SET, | 4294 EMIT_REMEMBERED_SET, |
| 4270 check_needed); | 4295 check_needed); |
| (...skipping 1321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5592 FixedArray::kHeaderSize - kPointerSize)); | 5617 FixedArray::kHeaderSize - kPointerSize)); |
| 5593 __ bind(&done); | 5618 __ bind(&done); |
| 5594 } | 5619 } |
| 5595 | 5620 |
| 5596 | 5621 |
| 5597 #undef __ | 5622 #undef __ |
| 5598 | 5623 |
| 5599 } } // namespace v8::internal | 5624 } } // namespace v8::internal |
| 5600 | 5625 |
| 5601 #endif // V8_TARGET_ARCH_X64 | 5626 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |