Capture the typemap of the outgoing stack frame during a function call and store a pointer to it on the native call stack.
authorAndreas Gal <gal@mozilla.com>
Tue, 09 Sep 2008 15:16:21 +0200
changeset 19085 62afdd7c83e631e18a074558110ff93411ccf86a
parent 19084 6a8762adc8e6fe3b22bf60c2ba301d6af9344f39
child 19086 dba82b744d758163ea346691beb7c909436f030b
push id1930
push usermrbkap@mozilla.com
push dateWed, 10 Sep 2008 06:40:47 +0000
treeherderautoland@ee61af1469cd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone1.9.1b1pre
Capture the typemap of the outgoing stack frame during a function call and store a pointer to it on the native call stack.
js/src/jstracer.cpp
--- a/js/src/jstracer.cpp
+++ b/js/src/jstracer.cpp
@@ -1471,16 +1471,17 @@ js_IsLoopExit(JSContext* cx, JSScript* s
       default:;
     }
     return false;
 }
 
 struct FrameInfo {
     JSObject*       callee;     // callee function object
     jsbytecode*     callpc;     // pc of JSOP_CALL in caller script
+    uint8*          typemap;    // typemap for the stack frame
     union {
         struct {
             uint16  spdist;     // distance from fp->slots to fp->regs->sp at JSOP_CALL
             uint16  argc;       // actual argument count, may be < fun->nargs
         } s;
         uint32      word;       // for spdist/argc LIR store in record_JSOP_CALL
     };
 };
@@ -4598,19 +4599,32 @@ TraceRecorder::interpretedFunctionCall(j
     JSStackFrame* fp = cx->fp;
 
     // TODO: track the copying via the tracker...
     if (argc < fun->nargs &&
         jsuword(fp->regs->sp + (fun->nargs - argc)) > cx->stackPool.current->limit) {
         ABORT_TRACE("can't trace calls with too few args requiring argv move");
     }
 
+    // Generate a type map for the outgoing frame and stash it in the LIR
+    unsigned stackSlots = js_NativeStackSlots(cx, 0/*callDepth*/);
+    LIns* data = lir_buf_writer->skip(stackSlots * sizeof(uint8));
+    uint8* typemap = (uint8 *)data->payload();
+    uint8* m = typemap;
+    /* Determine the type of a store by looking at the current type of the actual value the
+       interpreter is using. For numbers we have to check what kind of store we used last
+       (integer or double) to figure out what the side exit show reflect in its typemap. */
+    FORALL_SLOTS_IN_PENDING_FRAMES(cx, 0/*callDepth*/,
+        *m++ = determineSlotType(vp);
+    );
+    
     FrameInfo fi = {
         JSVAL_TO_OBJECT(fval),
         fp->regs->pc,
+        typemap,
         { { fp->regs->sp - fp->slots, argc } }
     };
 
     unsigned callDepth = getCallDepth();
     if (callDepth >= treeInfo->maxCallDepth)
         treeInfo->maxCallDepth = callDepth + 1;
 
     lir->insStorei(INS_CONSTPTR(fi.callee), lirbuf->rp,