Reviewers: Søren Gjesse,

Description:
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=


Please review this at http://codereview.chromium.org/7289008/

Affected files:
  M src/mips/full-codegen-mips.cc


Index: src/mips/full-codegen-mips.cc
diff --git a/src/mips/full-codegen-mips.cc b/src/mips/full-codegen-mips.cc
index b1b3d8410e826142ededf19646eb6484d4046121..0762886289e5e832dd2bf271942672361774fe0a 100644
--- a/src/mips/full-codegen-mips.cc
+++ b/src/mips/full-codegen-mips.cc
@@ -4245,6 +4245,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.



--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to