Index: src/x64/lithium-x64.cc |
diff --git a/src/x64/lithium-x64.cc b/src/x64/lithium-x64.cc |
index 1d42455ce3c1bafed61ec5a48a6c953f57c0c56f..8ada3a80284c587813fb9312c9d7e70f105354b0 100644 |
--- a/src/x64/lithium-x64.cc |
+++ b/src/x64/lithium-x64.cc |
@@ -2137,7 +2137,7 @@ LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { |
ASSERT(instr->value()->representation().IsTagged()); |
object = UseTempRegister(instr->elements()); |
val = needs_write_barrier ? UseTempRegister(instr->value()) |
- : UseRegisterAtStart(instr->value()); |
+ : UseRegisterOrConstantAtStart(instr->value()); |
key = (clobbers_key || needs_write_barrier) |
? UseTempRegister(instr->key()) |
: UseRegisterOrConstantAtStart(instr->key()); |
@@ -2234,9 +2234,22 @@ LInstruction* LChunkBuilder::DoStoreNamedField(HStoreNamedField* instr) { |
: UseRegisterAtStart(instr->object()); |
} |
- LOperand* val = needs_write_barrier |
- ? UseTempRegister(instr->value()) |
- : UseRegister(instr->value()); |
+ bool register_or_constant = false; |
+ if (instr->value()->IsConstant()) { |
+ HConstant* constant_value = HConstant::cast(instr->value()); |
+ register_or_constant = constant_value->HasInteger32Value() |
+ || constant_value->HasDoubleValue() |
+ || constant_value->ImmortalImmovable(); |
+ } |
+ |
+ LOperand* val; |
+ if (needs_write_barrier) { |
+ val = UseTempRegister(instr->value()); |
+ } else if (register_or_constant) { |
+ val = UseRegisterOrConstant(instr->value()); |
+ } else { |
+ val = UseRegister(instr->value()); |
+ } |
// We only need a scratch register if we have a write barrier or we |
// have a store into the properties array (not in-object-property). |
@@ -2379,8 +2392,15 @@ LInstruction* LChunkBuilder::DoArgumentsObject(HArgumentsObject* instr) { |
LInstruction* LChunkBuilder::DoAccessArgumentsAt(HAccessArgumentsAt* instr) { |
LOperand* args = UseRegister(instr->arguments()); |
- LOperand* length = UseTempRegister(instr->length()); |
- LOperand* index = Use(instr->index()); |
+ LOperand* length; |
+ LOperand* index; |
+ if (instr->length()->IsConstant() && instr->index()->IsConstant()) { |
+ length = UseRegisterOrConstant(instr->length()); |
+ index = UseOrConstant(instr->index()); |
+ } else { |
+ length = UseTempRegister(instr->length()); |
+ index = Use(instr->index()); |
+ } |
return DefineAsRegister(new(zone()) LAccessArgumentsAt(args, length, index)); |
} |