Merge.
authorAndreas Gal <gal@mozilla.com>
Tue, 12 Aug 2008 23:25:40 -0700
changeset 18122 3bf5ae02c28d450cbf5ee44325dde6758e2ba64c
parent 18121 099e3adf99e9cd980ff53e6a79d777cae998e03f (current diff)
parent 18119 6ac5f5bc87b914f3f167a4f7452d4d0e75c94d4f (diff)
child 18123 dd8d7205f3925052dda9157476ef3ca6ab076fe3
push id1452
push usershaver@mozilla.com
push dateFri, 22 Aug 2008 00:08:22 +0000
treeherdermozilla-central@d13bb0868596 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone1.9.1a2pre
Merge.
js/src/jstracer.cpp
--- a/js/src/jstracer.cpp
+++ b/js/src/jstracer.cpp
@@ -513,21 +513,25 @@ public:
             }                                                                 \
             SET_VPNAME("vars");                                               \
             vp = fp->slots; vpstop = &fp->slots[fp->script->nfixed];          \
             while (vp < vpstop) { code; ++vp; INC_VPNUM(); }                  \
         }                                                                     \
         SET_VPNAME("stack");                                                  \
         vp = StackBase(fp); vpstop = fp->regs->sp;                            \
         while (vp < vpstop) { code; ++vp; INC_VPNUM(); }                      \
-        if (depth != 0) {                                                     \
-            SET_VPNAME("missing");                                            \
-            vp = fp->down->regs->sp;                                          \
-            vpstop = vp + (fp->fun->nargs - fp->argc);                        \
-            while (vp < vpstop) { code; ++vp; INC_VPNUM(); }                  \
+        if (fsp < fspstop - 1) {                                              \
+            JSStackFrame* fp2 = fsp[1];                                       \
+            int missing = fp2->fun->nargs - fp2->argc;                        \
+            if (missing > 0) {                                                \
+                SET_VPNAME("missing");                                        \
+                vp = fp->regs->sp;                                            \
+                vpstop = vp + missing;                                        \
+                while (vp < vpstop) { code; ++vp; INC_VPNUM(); }              \
+            }                                                                 \
         }                                                                     \
     JS_END_MACRO
 
 /* Iterate over all slots in each pending frame. */
 #define FORALL_SLOTS_IN_PENDING_FRAMES(cx, callDepth, code)                   \
     JS_BEGIN_MACRO                                                            \
         DEF_VPNAME;                                                           \
         unsigned n;                                                           \
@@ -540,17 +544,17 @@ public:
         JSStackFrame** fstack =                                               \
             (JSStackFrame**) alloca(frames * sizeof (JSStackFrame*));         \
         JSStackFrame** fspstop = &fstack[frames];                             \
         JSStackFrame** fsp = fspstop-1;                                       \
         fp = currentFrame;                                                    \
         for (;; fp = fp->down) { *fsp-- = fp; if (fp == entryFrame) break; }  \
         unsigned depth;                                                       \
         for (depth = 0, fsp = fstack; fsp < fspstop; ++fsp, ++depth) {        \
-            fp = (*fsp);                                                      \
+            fp = *fsp;                                                        \
             FORALL_FRAME_SLOTS(fp, depth, code);                              \
         }                                                                     \
     JS_END_MACRO
 
 #define FORALL_SLOTS(cx, ngslots, gslots, callDepth, code)                    \
     JS_BEGIN_MACRO                                                            \
         FORALL_GLOBAL_SLOTS(cx, ngslots, gslots, code);                       \
         FORALL_SLOTS_IN_PENDING_FRAMES(cx, callDepth, code);                  \
@@ -733,20 +737,24 @@ done:
             if (size_t(p - &fp->slots[0]) < fp->script->nfixed)
                 RETURN(offset + size_t(p - &fp->slots[0]) * sizeof(double));
             offset += fp->script->nfixed * sizeof(double);
         }
         jsval* spbase = StackBase(fp);
         if (size_t(p - spbase) < size_t(fp->regs->sp - spbase))
             RETURN(offset + size_t(p - spbase) * sizeof(double));
         offset += size_t(fp->regs->sp - spbase) * sizeof(double);
-        if (fsp != fstack) {
-            if (size_t(p - fp->down->regs->sp) < size_t(fp->fun->nargs - fp->argc))
-                RETURN(offset + size_t(p - fp->down->regs->sp) * sizeof(double));
-            offset += size_t(fp->fun->nargs - fp->argc) * sizeof(double);
+        if (fsp < fspstop - 1) {
+            JSStackFrame* fp2 = fsp[1];
+            int missing = fp2->fun->nargs - fp2->argc;
+            if (missing > 0) {
+                if (size_t(p - fp->regs->sp) < size_t(missing))
+                    RETURN(offset + size_t(p - fp->regs->sp) * sizeof(double));
+                offset += size_t(missing) * sizeof(double);
+            }
         }
     }
 
     /*
      * If it's not in a pending frame, it must be on the stack of the current frame above
      * sp but below fp->slots + script->nslots.
      */
     JS_ASSERT(size_t(p - currentFrame->slots) < currentFrame->script->nslots);
@@ -2618,20 +2626,29 @@ TraceRecorder::clearFrameSlotsFromCache(
 
 bool
 TraceRecorder::record_EnterFrame()
 {
     if (++callDepth >= MAX_CALLDEPTH)
         ABORT_TRACE("exceeded maximum call depth");
     JSStackFrame* fp = cx->fp;
     LIns* void_ins = lir->insImm(JSVAL_TO_BOOLEAN(JSVAL_VOID));
-    for (uintN n = fp->argc; n < fp->fun->nargs; ++n)
-        set(&fp->argv[n], void_ins, true);
-    for (uintN n = 0; n < fp->script->nfixed; ++n)
-        set(&fp->slots[n], void_ins, true);
+
+    jsval* vp = &fp->argv[fp->argc];
+    jsval* vpstop = vp + (fp->fun->nargs - fp->argc);
+    while (vp < vpstop) {
+        if (vp >= fp->down->regs->sp)
+            nativeFrameTracker.set(vp, (LIns*)0);
+        set(vp++, void_ins, true);
+    }
+
+    vp = &fp->slots[0];
+    vpstop = vp + fp->script->nfixed;
+    while (vp < vpstop)
+        set(vp++, void_ins, true);
     return true;
 }
 
 bool
 TraceRecorder::record_LeaveFrame()
 {
     if (callDepth-- <= 0)
         return false;