| 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 4223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4234 key, | 4234 key, |
| 4235 FAST_DOUBLE_ELEMENTS, | 4235 FAST_DOUBLE_ELEMENTS, |
| 4236 FixedDoubleArray::kHeaderSize - kHeapObjectTag, | 4236 FixedDoubleArray::kHeaderSize - kHeapObjectTag, |
| 4237 instr->additional_index()); | 4237 instr->additional_index()); |
| 4238 | 4238 |
| 4239 __ movsd(double_store_operand, value); | 4239 __ movsd(double_store_operand, value); |
| 4240 } | 4240 } |
| 4241 | 4241 |
| 4242 | 4242 |
| 4243 void LCodeGen::DoStoreKeyedFixedArray(LStoreKeyed* instr) { | 4243 void LCodeGen::DoStoreKeyedFixedArray(LStoreKeyed* instr) { |
| 4244 Register elements = ToRegister(instr->elements()); | 4244 HStoreKeyed* hinstr = instr->hydrogen(); |
| 4245 LOperand* key = instr->key(); | 4245 LOperand* key = instr->key(); |
| 4246 if (!key->IsConstantOperand()) { | 4246 if (!key->IsConstantOperand()) { |
| 4247 Register key_reg = ToRegister(key); | 4247 Register key_reg = ToRegister(key); |
| 4248 // Even though the HLoad/StoreKeyedFastElement instructions force | 4248 // Even though the HLoad/StoreKeyedFastElement instructions force |
| 4249 // the input representation for the key to be an integer, the | 4249 // the input representation for the key to be an integer, the |
| 4250 // input gets replaced during bound check elimination with the index | 4250 // input gets replaced during bound check elimination with the index |
| 4251 // argument to the bounds check, which can be tagged, so that case | 4251 // argument to the bounds check, which can be tagged, so that case |
| 4252 // must be handled here, too. | 4252 // must be handled here, too. |
| 4253 if (instr->hydrogen()->IsDehoisted()) { | 4253 if (hinstr->IsDehoisted()) { |
| 4254 // Sign extend key because it could be a 32 bit negative value | 4254 // Sign extend key because it could be a 32 bit negative value |
| 4255 // and the dehoisted address computation happens in 64 bits | 4255 // and the dehoisted address computation happens in 64 bits |
| 4256 __ movsxlq(key_reg, key_reg); | 4256 __ movsxlq(key_reg, key_reg); |
| 4257 } | 4257 } |
| 4258 } | 4258 } |
| 4259 | 4259 |
| 4260 int offset = FixedArray::kHeaderSize - kHeapObjectTag; |
| 4261 Representation representation = hinstr->value()->representation(); |
| 4262 |
| 4263 if (representation.IsInteger32()) { |
| 4264 ASSERT(hinstr->store_mode() == STORE_TO_INITIALIZED_ENTRY); |
| 4265 ASSERT(hinstr->elements_kind() == FAST_SMI_ELEMENTS); |
| 4266 // Store int value directly to upper half of the smi. |
| 4267 STATIC_ASSERT(kSmiTag == 0); |
| 4268 STATIC_ASSERT(kSmiTagSize + kSmiShiftSize == 32); |
| 4269 offset += kPointerSize / 2; |
| 4270 } |
| 4271 |
| 4260 Operand operand = | 4272 Operand operand = |
| 4261 BuildFastArrayOperand(instr->elements(), | 4273 BuildFastArrayOperand(instr->elements(), |
| 4262 key, | 4274 key, |
| 4263 FAST_ELEMENTS, | 4275 FAST_ELEMENTS, |
| 4264 FixedArray::kHeaderSize - kHeapObjectTag, | 4276 offset, |
| 4265 instr->additional_index()); | 4277 instr->additional_index()); |
| 4278 |
| 4266 if (instr->value()->IsRegister()) { | 4279 if (instr->value()->IsRegister()) { |
| 4267 __ movq(operand, ToRegister(instr->value())); | 4280 __ Store(operand, ToRegister(instr->value()), representation); |
| 4268 } else { | 4281 } else { |
| 4269 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); | 4282 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); |
| 4270 if (IsInteger32Constant(operand_value)) { | 4283 if (IsInteger32Constant(operand_value)) { |
| 4271 Smi* smi_value = Smi::FromInt(ToInteger32(operand_value)); | 4284 int32_t value = ToInteger32(operand_value); |
| 4272 __ Move(operand, smi_value); | 4285 if (representation.IsSmi()) { |
| 4286 __ Move(operand, Smi::FromInt(value)); |
| 4287 |
| 4288 } else { |
| 4289 __ movl(operand, Immediate(value)); |
| 4290 } |
| 4273 } else { | 4291 } else { |
| 4274 Handle<Object> handle_value = ToHandle(operand_value); | 4292 Handle<Object> handle_value = ToHandle(operand_value); |
| 4275 __ Move(operand, handle_value); | 4293 __ Move(operand, handle_value); |
| 4276 } | 4294 } |
| 4277 } | 4295 } |
| 4278 | 4296 |
| 4279 if (instr->hydrogen()->NeedsWriteBarrier()) { | 4297 if (hinstr->NeedsWriteBarrier()) { |
| 4298 Register elements = ToRegister(instr->elements()); |
| 4280 ASSERT(instr->value()->IsRegister()); | 4299 ASSERT(instr->value()->IsRegister()); |
| 4281 Register value = ToRegister(instr->value()); | 4300 Register value = ToRegister(instr->value()); |
| 4282 ASSERT(!instr->key()->IsConstantOperand()); | 4301 ASSERT(!key->IsConstantOperand()); |
| 4283 SmiCheck check_needed = | 4302 SmiCheck check_needed = hinstr->value()->IsHeapObject() |
| 4284 instr->hydrogen()->value()->IsHeapObject() | |
| 4285 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; | 4303 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; |
| 4286 // Compute address of modified element and store it into key register. | 4304 // Compute address of modified element and store it into key register. |
| 4287 Register key_reg(ToRegister(key)); | 4305 Register key_reg(ToRegister(key)); |
| 4288 __ lea(key_reg, operand); | 4306 __ lea(key_reg, operand); |
| 4289 __ RecordWrite(elements, | 4307 __ RecordWrite(elements, |
| 4290 key_reg, | 4308 key_reg, |
| 4291 value, | 4309 value, |
| 4292 kSaveFPRegs, | 4310 kSaveFPRegs, |
| 4293 EMIT_REMEMBERED_SET, | 4311 EMIT_REMEMBERED_SET, |
| 4294 check_needed); | 4312 check_needed); |
| (...skipping 1321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5616 FixedArray::kHeaderSize - kPointerSize)); | 5634 FixedArray::kHeaderSize - kPointerSize)); |
| 5617 __ bind(&done); | 5635 __ bind(&done); |
| 5618 } | 5636 } |
| 5619 | 5637 |
| 5620 | 5638 |
| 5621 #undef __ | 5639 #undef __ |
| 5622 | 5640 |
| 5623 } } // namespace v8::internal | 5641 } } // namespace v8::internal |
| 5624 | 5642 |
| 5625 #endif // V8_TARGET_ARCH_X64 | 5643 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |