MIPS: Clean up handling of global cell stores in the optimizing compiler.

Port r10280 (5f6aec5).

Original commit message:

Tell the register allocator the value is not overwritten.  Never use
temporary registers on ia32, avoid them on x64 and ARM.  Restore the
original copyright date on assembler.cc.

BUG=
TEST=

Review URL: http://codereview.chromium.org/9004017
Patch from Daniel Kalmar <kalmard@homejinni.com>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@10281 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
kmillikin@chromium.org 2011-12-20 12:36:36 +00:00
parent d8acc2dfbe
commit 76cc6878fc
3 changed files with 16 additions and 13 deletions

View File

@ -2141,26 +2141,26 @@ void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) {
void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) {
Register value = ToRegister(instr->InputAt(0));
Register scratch = scratch0();
Register scratch2 = ToRegister(instr->TempAt(0));
Register value = ToRegister(instr->value());
Register cell = scratch0();
// Load the cell.
__ li(scratch, Operand(Handle<Object>(instr->hydrogen()->cell())));
__ li(cell, Operand(instr->hydrogen()->cell()));
// If the cell we are storing to contains the hole it could have
// been deleted from the property dictionary. In that case, we need
// to update the property details in the property dictionary to mark
// it as no longer deleted.
if (instr->hydrogen()->RequiresHoleCheck()) {
__ lw(scratch2,
FieldMemOperand(scratch, JSGlobalPropertyCell::kValueOffset));
// We use a temp to check the payload.
Register payload = ToRegister(instr->TempAt(0));
__ lw(payload, FieldMemOperand(cell, JSGlobalPropertyCell::kValueOffset));
__ LoadRoot(at, Heap::kTheHoleValueRootIndex);
DeoptimizeIf(eq, instr->environment(), scratch2, Operand(at));
DeoptimizeIf(eq, instr->environment(), payload, Operand(at));
}
// Store the value.
__ sw(value, FieldMemOperand(scratch, JSGlobalPropertyCell::kValueOffset));
__ sw(value, FieldMemOperand(cell, JSGlobalPropertyCell::kValueOffset));
// Cells are always rescanned, so no write barrier here.
}

View File

@ -1782,11 +1782,12 @@ LInstruction* LChunkBuilder::DoLoadGlobalGeneric(HLoadGlobalGeneric* instr) {
LInstruction* LChunkBuilder::DoStoreGlobalCell(HStoreGlobalCell* instr) {
LOperand* temp = TempRegister();
LOperand* value = UseTempRegister(instr->value());
LInstruction* result = new LStoreGlobalCell(value, temp);
if (instr->RequiresHoleCheck()) result = AssignEnvironment(result);
return result;
LOperand* value = UseRegister(instr->value());
// Use a temp to check the value in the cell in the case where we perform
// a hole check.
return instr->RequiresHoleCheck()
? AssignEnvironment(new LStoreGlobalCell(value, TempRegister()))
: new LStoreGlobalCell(value, NULL);
}

View File

@ -1242,6 +1242,8 @@ class LStoreGlobalCell: public LTemplateInstruction<0, 1, 1> {
DECLARE_CONCRETE_INSTRUCTION(StoreGlobalCell, "store-global-cell")
DECLARE_HYDROGEN_ACCESSOR(StoreGlobalCell)
LOperand* value() { return inputs_[0]; }
};