MIPS: Elide unnecessary context reload in generated stubs.

Port r13290 (6970ca83)

BUG=
TEST=

Review URL: https://codereview.chromium.org/11773013
Patch from Akos Palfi <palfia@homejinni.com>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13323 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
danno@chromium.org 2013-01-07 10:23:30 +00:00
parent b510dc58d3
commit a060bf0e9b
2 changed files with 8 additions and 4 deletions

View File

@ -2468,9 +2468,6 @@ void LCodeGen::DoReturn(LReturn* instr) {
__ Pop(ra, fp);
__ Addu(sp, sp, Operand(sp_delta));
}
if (info()->IsStub()) {
__ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
}
__ Jump(ra);
}

View File

@ -1002,7 +1002,14 @@ LInstruction* LChunkBuilder::DoThisFunction(HThisFunction* instr) {
LInstruction* LChunkBuilder::DoContext(HContext* instr) {
return instr->HasNoUses() ? NULL : DefineAsRegister(new(zone()) LContext);
// If there is a non-return use, the context must be allocated in a register.
for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) {
if (!it.value()->IsReturn()) {
return DefineAsRegister(new(zone()) LContext);
}
}
return NULL;
}