MIPS: port Explicitly pass the closure when allocating a catch or with context.

Ported r8453 (59dd697)

Original commit message:
Before: allocation of a catch or with context fetched the closure to store
in the context from the previous context in the context chain. Now: the
closure is passed explicitly.

BUG=
TEST=

Review URL: http://codereview.chromium.org/7289008

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8478 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
kmillikin@chromium.org 2011-06-30 08:34:10 +00:00
parent 861d18032a
commit 7d189d848e

View File

@ -4239,6 +4239,26 @@ void FullCodeGenerator::LoadContextField(Register dst, int context_index) {
}
void FullCodeGenerator::PushFunctionArgumentForContextAllocation() {
if (scope()->is_global_scope()) {
// Contexts nested in the global context have a canonical empty function
// as their closure, not the anonymous closure containing the global
// code. Pass a smi sentinel and let the runtime look up the empty
// function.
__ li(at, Operand(Smi::FromInt(0)));
} else if (scope()->is_eval_scope()) {
// Contexts created by a call to eval have the same closure as the
// context calling eval, not the anonymous closure containing the eval
// code. Fetch it from the context.
__ lw(at, ContextOperand(cp, Context::CLOSURE_INDEX));
} else {
ASSERT(scope()->is_function_scope());
__ lw(at, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
}
__ push(at);
}
// ----------------------------------------------------------------------------
// Non-local control flow support.