Index: src/x64/lithium-x64.cc |
diff --git a/src/x64/lithium-x64.cc b/src/x64/lithium-x64.cc |
index 974a97017cbcbec11338feaf1b5523bb56ee40fb..bdc92f640c8d55701a951cb2fc4908547a6dcaa9 100644 |
--- a/src/x64/lithium-x64.cc |
+++ b/src/x64/lithium-x64.cc |
@@ -508,6 +508,13 @@ LOperand* LChunkBuilder::UseTempRegister(HValue* value) { |
} |
+LOperand* LChunkBuilder::UseTempRegisterOrConstant(HValue* value) { |
+ return value->IsConstant() |
+ ? chunk_->DefineConstantOperand(HConstant::cast(value)) |
+ : UseTempRegister(value); |
+} |
+ |
+ |
LOperand* LChunkBuilder::Use(HValue* value) { |
return Use(value, new(zone()) LUnallocated(LUnallocated::NONE)); |
} |
@@ -2178,18 +2185,28 @@ LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { |
LOperand* key = NULL; |
LOperand* val = NULL; |
- if (instr->value()->representation().IsDouble()) { |
+ Representation value_representation = instr->value()->representation(); |
+ if (value_representation.IsDouble()) { |
object = UseRegisterAtStart(instr->elements()); |
val = UseTempRegister(instr->value()); |
key = UseRegisterOrConstantAtStart(instr->key()); |
} else { |
- ASSERT(instr->value()->representation().IsSmiOrTagged()); |
- object = UseTempRegister(instr->elements()); |
+ ASSERT(value_representation.IsSmiOrTagged() || |
+ value_representation.IsInteger32()); |
if (needs_write_barrier) { |
+ object = UseTempRegister(instr->elements()); |
val = UseTempRegister(instr->value()); |
key = UseTempRegister(instr->key()); |
} else { |
- val = UseRegisterOrConstantAtStart(instr->value()); |
+ object = UseRegisterAtStart(instr->elements()); |
Toon Verwaest
2013/12/17 13:53:04
None of the variables here should probably be "AtS
Igor Sheludko
2013/12/18 10:01:33
We discussed the "AtStart" issue and decided that
|
+ if (value_representation.IsInteger32() && |
+ !instr->store_to_initialized_element()) { |
+ // In this case we will need a writable register to convert |
+ // int32 to smi if the value is in register. |
+ val = UseTempRegisterOrConstant(instr->value()); |
+ } else { |
+ val = UseRegisterOrConstantAtStart(instr->value()); |
+ } |
key = UseRegisterOrConstantAtStart(instr->key()); |
} |
} |