Index: src/ia32/lithium-ia32.cc |
diff --git a/src/ia32/lithium-ia32.cc b/src/ia32/lithium-ia32.cc |
index a7bb2d95fbdf539fdb40b949145842dd50f9b9c9..98177d5187d2bdb833494ff0bc5187938420e420 100644 |
--- a/src/ia32/lithium-ia32.cc |
+++ b/src/ia32/lithium-ia32.cc |
@@ -2291,19 +2291,21 @@ LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { |
val = UseX87TopOfStack(instr->value()); |
} |
LOperand* key = UseRegisterOrConstantAtStart(instr->key()); |
- |
return new(zone()) LStoreKeyed(object, key, val); |
} else { |
ASSERT(instr->value()->representation().IsTagged()); |
bool needs_write_barrier = instr->NeedsWriteBarrier(); |
LOperand* obj = UseRegister(instr->elements()); |
- LOperand* val = needs_write_barrier |
- ? UseTempRegister(instr->value()) |
- : UseRegisterAtStart(instr->value()); |
- LOperand* key = needs_write_barrier |
- ? UseTempRegister(instr->key()) |
- : UseRegisterOrConstantAtStart(instr->key()); |
+ LOperand* val; |
+ LOperand* key; |
+ if (needs_write_barrier) { |
+ val = UseTempRegister(instr->value()); |
+ key = UseTempRegister(instr->key()); |
+ } else { |
+ val = UseRegisterOrConstantAtStart(instr->value()); |
+ key = UseRegisterOrConstantAtStart(instr->key()); |
+ } |
return new(zone()) LStoreKeyed(obj, key, val); |
} |
} |
@@ -2403,9 +2405,22 @@ LInstruction* LChunkBuilder::DoStoreNamedField(HStoreNamedField* instr) { |
: UseRegisterAtStart(instr->object()); |
} |
- LOperand* val = needs_write_barrier |
- ? UseTempRegister(instr->value()) |
- : UseRegister(instr->value()); |
+ LOperand* val = NULL; |
+ if (needs_write_barrier) { |
+ val = UseTempRegister(instr->value()); |
+ } else if (instr->value()->IsConstant()) { |
+ // If it's tagged, it might still be in new space |
+ HConstant* constant_value = HConstant::cast(instr->value()); |
+ if (constant_value->HasInteger32Value() || |
+ constant_value->HasDoubleValue() || |
+ constant_value->ImmortalImmovable()) { |
+ val = UseRegisterOrConstant(instr->value()); |
+ } |
+ } |
+ |
+ if (val == NULL) { |
+ val = UseRegister(instr->value()); |
danno
2013/04/18 15:37:54
Can't you just move this to the else of the above
mvstanton
2013/04/19 16:53:28
I reworked this to be less awkward, I think.
|
+ } |
// 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). |
@@ -2572,8 +2587,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)); |
} |