Commits

Anonymous committed 8dc017d

refreshing patch for TM

Comments (0)

Files changed (1)

patches/metric-lwact.diff

-diff -r 0aaaa4eb75b6 js/src/jsapi.cpp
---- a/js/src/jsapi.cpp	Thu Mar 19 09:41:58 2009 -0700
-+++ b/js/src/jsapi.cpp	Thu Mar 19 15:11:50 2009 -0700
-@@ -720,6 +720,9 @@ JS_PUBLIC_API(JSRuntime *)
+diff -r 1e9b4d1ec9af js/src/jsapi.cpp
+--- a/js/src/jsapi.cpp	Tue May 12 16:25:57 2009 -0700
++++ b/js/src/jsapi.cpp	Tue May 12 16:51:12 2009 -0700
+@@ -721,6 +721,9 @@
  JS_PUBLIC_API(JSRuntime *)
  JS_NewRuntime(uint32 maxbytes)
  {
      JSRuntime *rt;
  
  #ifdef DEBUG
-@@ -894,6 +897,9 @@ JS_PUBLIC_API(void)
+@@ -886,6 +889,9 @@
  JS_PUBLIC_API(void)
  JS_ShutDown(void)
  {
  #ifdef JS_OPMETER
      extern void js_DumpOpMeters();
  
-diff -r 0aaaa4eb75b6 js/src/jsinterp.cpp
---- a/js/src/jsinterp.cpp	Thu Mar 19 09:41:58 2009 -0700
-+++ b/js/src/jsinterp.cpp	Thu Mar 19 15:11:50 2009 -0700
-@@ -2477,9 +2477,22 @@ JS_STATIC_ASSERT(JSOP_INCNAME_LENGTH == 
- JS_STATIC_ASSERT(JSOP_INCNAME_LENGTH == JSOP_NAMEINC_LENGTH);
- JS_STATIC_ASSERT(JSOP_INCNAME_LENGTH == JSOP_NAMEDEC_LENGTH);
+diff -r 1e9b4d1ec9af js/src/jsinterp.cpp
+--- a/js/src/jsinterp.cpp	Tue May 12 16:25:57 2009 -0700
++++ b/js/src/jsinterp.cpp	Tue May 12 16:51:12 2009 -0700
+@@ -2600,9 +2600,22 @@
+ # define ABORT_RECORDING(cx, reason)    ((void) 0)
+ #endif
  
 +#define XXX
 +
      JSRuntime *rt;
      JSStackFrame *fp;
      JSScript *script;
-@@ -2681,6 +2694,8 @@ js_Interpret(JSContext *cx)
+@@ -2820,6 +2833,8 @@
          if (TRACING_ENABLED(cx)) {                                            \
              if (js_MonitorLoopEdge(cx, inlineCallCount)) {                    \
                  JS_ASSERT(TRACE_RECORDER(cx));                                \
                  ENABLE_INTERRUPTS();                                          \
              }                                                                 \
              fp = cx->fp;                                                      \
-@@ -2890,6 +2905,8 @@ js_Interpret(JSContext *cx)
+@@ -3038,6 +3053,8 @@
  #endif /* !JS_TRACER */
  
  #if JS_THREADED_INTERP
              jumpTable = moreInterrupts ? interruptJumpTable : normalJumpTable;
              JS_EXTENSION_(goto *normalJumpTable[op]);
  #else
-@@ -7188,6 +7205,13 @@ js_Interpret(JSContext *cx)
+@@ -7334,6 +7351,13 @@
          }
      }
  #endif
      return ok;
  
    atom_not_defined:
-diff -r 0aaaa4eb75b6 js/src/jstracer.cpp
---- a/js/src/jstracer.cpp	Thu Mar 19 09:41:58 2009 -0700
-+++ b/js/src/jstracer.cpp	Thu Mar 19 15:11:50 2009 -0700
-@@ -75,6 +75,8 @@
- 
+diff -r 1e9b4d1ec9af js/src/jstracer.cpp
+--- a/js/src/jstracer.cpp	Tue May 12 16:25:57 2009 -0700
++++ b/js/src/jstracer.cpp	Tue May 12 16:51:12 2009 -0700
+@@ -78,6 +78,8 @@
  #include "jsautooplen.h"        // generated headers last
  #include "imacros.c.out"
+ 
++FILE* mon_logFile = NULL;
 +
-+FILE* mon_logFile = NULL;
- 
- /* Never use JSVAL_IS_BOOLEAN because it restricts the value (true, false) and
-    the type. What you want to use is JSVAL_TAG(x) == JSVAL_BOOLEAN and then
-@@ -2497,6 +2499,8 @@ JS_REQUIRES_STACK void
+ #if JS_HAS_XML_SUPPORT
+ #define ABORT_IF_XML(v)                                                       \
+     JS_BEGIN_MACRO                                                            \
+@@ -2774,6 +2776,8 @@
  JS_REQUIRES_STACK void
  TraceRecorder::compile(JSTraceMonitor* tm)
  {
 +    mon_StateObj _mso(S_COMPILE);
 +
-     Fragmento* fragmento = tm->fragmento;
-     if (treeInfo->maxNativeStackSlots >= MAX_NATIVE_STACK_SLOTS) {
-         debug_only_v(printf("Blacklist: excessive stack use.\n"));
-@@ -3899,6 +3903,8 @@ js_ExecuteTree(JSContext* cx, Fragment* 
+     if (tm->needFlush) {
+         FlushJITCache(cx);
+         return;
+@@ -4269,6 +4273,8 @@
  js_ExecuteTree(JSContext* cx, Fragment* f, uintN& inlineCallCount,
                 VMSideExit** innermostNestedGuardp)
  {
 +    mon_StateObj _mso(S_EXECUTE);
 +
-     JS_ASSERT(f->code() && f->vmprivate);
-     JS_ASSERT(cx->builtinStatus == 0);
+     JS_ASSERT(f->root == f && f->code() && f->vmprivate);
  
-@@ -3986,11 +3992,14 @@ js_ExecuteTree(JSContext* cx, Fragment* 
+     JSTraceMonitor* tm = &JS_TRACE_MONITOR(cx);
+@@ -4358,11 +4364,14 @@
  
      debug_only(fflush(NULL);)
      GuardRecord* rec;
      VMSideExit* lr = (VMSideExit*)rec->exit;
  
      AUDIT(traceTriggered);
-@@ -4228,6 +4237,8 @@ JS_REQUIRES_STACK bool
+@@ -4622,6 +4631,8 @@
  JS_REQUIRES_STACK bool
  js_MonitorLoopEdge(JSContext* cx, uintN& inlineCallCount)
  {
      JSTraceMonitor* tm = &JS_TRACE_MONITOR(cx);
  
      /* Is the recorder currently active? */
-@@ -4247,14 +4258,17 @@ js_MonitorLoopEdge(JSContext* cx, uintN&
+@@ -4641,14 +4652,17 @@
           * the interpreter and do not attempt to trigger or record a new tree at this
           * location.
           */
 -        if (innerLoopHeaderPC != cx->fp->regs->pc)
--            return false;
 +        if (innerLoopHeaderPC != cx->fp->regs->pc) {
 +            _mso.r = R_INNER_SIDE_EXIT;
-+            return false;
+             return false;
 +        }
      }
      JS_ASSERT(!tm->recorder);
          return false; /* Out of memory, don't try to record now. */
      }
  
-@@ -4267,8 +4281,10 @@ js_MonitorLoopEdge(JSContext* cx, uintN&
-         js_FlushJITCache(cx);
+@@ -4663,8 +4677,10 @@
+     }
  
      /* Do not enter the JIT code with a pending operation callback. */
 -    if (cx->operationCallbackFlag)
 +    }
      
      jsbytecode* pc = cx->fp->regs->pc;
- 
-@@ -4278,6 +4294,7 @@ js_MonitorLoopEdge(JSContext* cx, uintN&
+     uint32 argc = cx->fp->argc;
+@@ -4675,6 +4691,7 @@
  
      if (!f) {
-         js_FlushJITCache(cx);
+         FlushJITCache(cx);
 +        _mso.r = R_OOM_GETANCHOR;
          return false;
      }
  
-@@ -4285,11 +4302,16 @@ js_MonitorLoopEdge(JSContext* cx, uintN&
+@@ -4682,12 +4699,17 @@
         activate any trees so, start compiling. */
      if (!f->code() && !f->peer) {
      record:
 -        if (++f->hits() < HOTLOOP)
--            return false;
 +        if (++f->hits() < HOTLOOP) {
 +            _mso.r = f->hits() < 1 ? R_BACKED_OFF : R_COLD;
-+            return false;
+             return false;
 +        }
          /* We can give RecordTree the root peer. If that peer is already taken, it will
             walk the peer list and find us a free slot or allocate a new tree if needed. */
--        return js_RecordTree(cx, tm, f->first, NULL, globalShape, globalSlots);
-+        bool rv = js_RecordTree(cx, tm, f->first, NULL, globalShape, globalSlots);
+-        return js_RecordTree(cx, tm, f->first, NULL, 0, globalObj, globalShape, 
+-                             globalSlots, argc);
++        bool rv = js_RecordTree(cx, tm, f->first, NULL, 0, globalObj, globalShape,
++                                globalSlots, argc);
 +        if (!rv)
 +            _mso.r = R_FAIL_RECORD_TREE;
 +        return rv;
      }
  
      debug_only_v(printf("Looking for compat peer %d@%d, from %p (ip: %p)\n",
-@@ -4305,6 +4327,7 @@ js_MonitorLoopEdge(JSContext* cx, uintN&
+@@ -4703,6 +4725,7 @@
             expensive. This must be a rather type-unstable loop. */
          debug_only_v(printf("Blacklisted: too many peer trees.\n");)
-         js_Blacklist(f->root);
+         js_Blacklist((jsbytecode*) f->root->ip);
 +        _mso.r = R_MAX_PEERS;
          return false;
      }
  
-@@ -4312,24 +4335,45 @@ js_MonitorLoopEdge(JSContext* cx, uintN&
+@@ -4710,24 +4733,45 @@
      VMSideExit* innermostNestedGuard = NULL;
  
      lr = js_ExecuteTree(cx, match, inlineCallCount, &innermostNestedGuard);
 +    bool rv;
      switch (lr->exitType) {
        case UNSTABLE_LOOP_EXIT:
--        return js_AttemptToStabilizeTree(cx, lr, NULL);
-+        rv = js_AttemptToStabilizeTree(cx, lr, NULL);
+-        return js_AttemptToStabilizeTree(cx, lr, NULL, NULL);
++          rv = js_AttemptToStabilizeTree(cx, lr, NULL, NULL);
 +        if (!rv)
 +            _mso.r = R_FAIL_STABILIZE;
 +        return rv;
 -        if (innermostNestedGuard)
 -            return js_AttemptToExtendTree(cx, innermostNestedGuard, lr, NULL);
 -        return false;
--      default:
 +        if (innermostNestedGuard) {
 +            rv = js_AttemptToExtendTree(cx, innermostNestedGuard, lr, NULL);
 +            if (!rv)
 +        }
 +        _mso.r = R_NO_EXTEND_OUTER;
 +        return false;
-+    case MISMATCH_EXIT: _mso.r = R_MISMATCH_EXIT; return false;
-+    case OOM_EXIT: _mso.r = R_OOM_EXIT; return false;
-+    case OVERFLOW_EXIT: _mso.r = R_OVERFLOW_EXIT; return false;
-+    case TIMEOUT_EXIT: _mso.r = R_TIMEOUT_EXIT; return false;
-+    case DEEP_BAIL_EXIT: _mso.r = R_DEEP_BAIL_EXIT; return false;
-+    case STATUS_EXIT: _mso.r = R_STATUS_EXIT; return false;
-+    default:
++      case MISMATCH_EXIT: _mso.r = R_MISMATCH_EXIT; return false;
++      case OOM_EXIT: _mso.r = R_OOM_EXIT; return false;
++      case OVERFLOW_EXIT: _mso.r = R_OVERFLOW_EXIT; return false;
++      case TIMEOUT_EXIT: _mso.r = R_TIMEOUT_EXIT; return false;
++      case DEEP_BAIL_EXIT: _mso.r = R_DEEP_BAIL_EXIT; return false;
++      case STATUS_EXIT: _mso.r = R_STATUS_EXIT; return false;
+       default:
          /* No, this was an unusual exit (i.e. out of memory/GC), so just resume interpretation. */
 +        _mso.r = R_OTHER_EXIT;
          return false;
      }
  }
-diff -r 0aaaa4eb75b6 js/src/jstracer.h
---- a/js/src/jstracer.h	Thu Mar 19 09:41:58 2009 -0700
-+++ b/js/src/jstracer.h	Thu Mar 19 15:11:50 2009 -0700
-@@ -648,6 +648,80 @@ extern JSObject *
- extern JSObject *
- js_GetBuiltinFunction(JSContext *cx, uintN index);
+diff -r 1e9b4d1ec9af js/src/jstracer.h
+--- a/js/src/jstracer.h	Tue May 12 16:25:57 2009 -0700
++++ b/js/src/jstracer.h	Tue May 12 16:51:12 2009 -0700
+@@ -749,6 +749,80 @@
+ extern void
+ js_SetMaxCodeCacheBytes(JSContext* cx, uint32 bytes);
  
 +/* Performance monitoring */
 +