Track trace entry/exit in debug mode and count cycles.
authorAndreas Gal <gal@mozilla.com>
Sat, 05 Jul 2008 17:10:58 -0700
changeset 17435 639f37f76fa0a16a05e95a5b05c2fb81026914a5
parent 17434 f5a30a112d06eacf7a701fcf27123fd4907e97cf
child 17436 6ffdcbdb066c1963380a2e12e4e99f601da2f8ba
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone1.9.1a1pre
Track trace entry/exit in debug mode and count cycles.
js/src/jstracer.cpp
--- a/js/src/jstracer.cpp
+++ b/js/src/jstracer.cpp
@@ -599,17 +599,25 @@ js_LoopEdge(JSContext* cx)
     double* entry_sp = &native[fi->nativeStackBase/sizeof(double) + 
                                (cx->fp->regs->sp - cx->fp->spbase - 1)];
     state.sp = (void*)entry_sp;
     state.rp = NULL;
     state.f = NULL;
     state.cx = cx;
     union { NIns *code; GuardRecord* (FASTCALL *func)(InterpState*, Fragment*); } u;
     u.code = f->code();
+#ifdef DEBUG  
+    printf("entering trace, pc=%p, sp=%p\n", state.ip, state.sp);
+    uint64 start = rdtsc();
+#endif    
     GuardRecord* lr = u.func(&state, NULL);
+#ifdef DEBUG
+    printf("leaving trace, pc=%p, sp=%p, cycles=%llu\n", state.ip, state.sp, 
+            (rdtsc() - start));
+#endif    
     cx->fp->regs->sp += (((double*)state.sp - entry_sp));
     cx->fp->regs->pc = (jsbytecode*)state.ip;
     box(cx, cx->fp, *cx->fp->regs, ((VMSideExitInfo*)lr->vmprivate)->typeMap, native);
 #ifdef DEBUG
     JS_ASSERT(*(uint64*)&native[fi->maxNativeFrameSlots] == 0xdeadbeefdeadbeefLL);
 #endif
 
     return false; /* continue with regular interpreter */