Bug 509982: don't populate flat closure upvars when there aren't any upvars, r=dvander
authorDavid Mandelin <dmandelin@mozilla.com>
Fri, 14 Aug 2009 15:25:05 -0700
changeset 31834 8c2a6c5dbcad08b59aa48e5d9cf521b8be309068
parent 31833 95ef863925f9a38617d75d1250367ef58ec5fbb3
child 31835 3d873e06a0a574287cbd75674319c525882d023c
push id8746
push userrsayre@mozilla.com
push dateTue, 25 Aug 2009 16:53:43 +0000
treeherdermozilla-central@189759c41621 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdvander
bugs509982
milestone1.9.3a1pre
Bug 509982: don't populate flat closure upvars when there aren't any upvars, r=dvander
js/src/jstracer.cpp
--- a/js/src/jstracer.cpp
+++ b/js/src/jstracer.cpp
@@ -11831,25 +11831,27 @@ TraceRecorder::record_JSOP_LAMBDA_FC()
     };
     LIns* call_ins = lir->insCall(&js_AllocFlatClosure_ci, args);
     guard(false,
           addName(lir->ins2(LIR_eq, call_ins, INS_CONSTPTR(0)),
                   "guard(js_AllocFlatClosure)"),
           OOM_EXIT);
     stack(0, call_ins);
 
-    JSUpvarArray *uva = JS_SCRIPT_UPVARS(fun->u.i.script);
-    for (uint32 i = 0, n = uva->length; i < n; i++) {
-        jsval v;
-        LIns* upvar_ins = upvar(fun->u.i.script, uva, i, v);
-        if (!upvar_ins)
-            return JSRS_STOP;
-        box_jsval(v, upvar_ins);
-        LIns* dslots_ins = NULL;
-        stobj_set_dslot(call_ins, i, dslots_ins, upvar_ins, "fc upvar");
+    if (fun->u.i.script->upvarsOffset) {
+        JSUpvarArray *uva = JS_SCRIPT_UPVARS(fun->u.i.script);
+        for (uint32 i = 0, n = uva->length; i < n; i++) {
+            jsval v;
+            LIns* upvar_ins = upvar(fun->u.i.script, uva, i, v);
+            if (!upvar_ins)
+                return JSRS_STOP;
+            box_jsval(v, upvar_ins);
+            LIns* dslots_ins = NULL;
+            stobj_set_dslot(call_ins, i, dslots_ins, upvar_ins, "fc upvar");
+        }
     }
 
     return JSRS_CONTINUE;
 }
 
 JS_REQUIRES_STACK JSRecordingStatus
 TraceRecorder::record_JSOP_CALLEE()
 {