[INFER] Bug 642059 - Add -n flag to JITFLAGS, turning on type inference during jit-tests (r=bhackett)
authorPaul Biggar <pbiggar@mozilla.com>
Wed, 16 Mar 2011 10:03:02 -0700
changeset 74777 969f5bd56be74a4aa0f957694d1ffd304c7cc8fd
parent 74776 4e94fdc3e8dd5ab4560e42d941ad65c881f55567
child 74783 55ea5951461ed392ada34c33b94e6e19e39c0914
push id2
push userbsmedberg@mozilla.com
push dateFri, 19 Aug 2011 14:38:13 +0000
reviewersbhackett
bugs642059
milestone2.0b13pre
[INFER] Bug 642059 - Add -n flag to JITFLAGS, turning on type inference during jit-tests (r=bhackett)
js/src/jstracer.cpp
--- a/js/src/jstracer.cpp
+++ b/js/src/jstracer.cpp
@@ -480,43 +480,51 @@ enum jitstat_ids {
 static JSBool
 jitstats_getOnTrace(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
 {
     *vp = BOOLEAN_TO_JSVAL(JS_ON_TRACE(cx));
     return true;
 }
 
 static JSPropertySpec jitstats_props[] = {
-#define JITSTAT(x) { #x, STAT ## x ## ID, JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT },
+#define JITSTAT(x) { #x, STAT ## x ## ID, JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT, NULL, NULL, JS_TypeHandlerInt },
 #include "jitstats.tbl"
 #undef JITSTAT
-    { "onTrace", 0, JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT, jitstats_getOnTrace, NULL },
+    { "onTrace", 0, JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT, jitstats_getOnTrace, NULL, JS_TypeHandlerBool },
     { 0 }
 };
 
 static JSBool
 jitstats_getProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
 {
     int index = -1;
 
     if (JSID_IS_STRING(id)) {
         JSAtom* str = JSID_TO_ATOM(id);
         if (StringEqualsAscii(str, "HOTLOOP")) {
             *vp = INT_TO_JSVAL(HOTLOOP);
+
+            if (!cx->addTypePropertyId(obj->getType(), id, Valueify(*vp)))
+                return JS_FALSE;
+
             return JS_TRUE;
         }
 
         if (StringEqualsAscii(str, "adaptive")) {
 #ifdef JS_METHODJIT
             *vp = BOOLEAN_TO_JSVAL(cx->profilingEnabled ||
                                    (cx->methodJitEnabled &&
                                     !cx->hasRunOption(JSOPTION_METHODJIT_ALWAYS)));
 #else
             *vp = BOOLEAN_TO_JSVAL(false);
 #endif
+
+            if (!cx->addTypePropertyId(obj->getType(), id, Valueify(*vp)))
+                return JS_FALSE;
+
             return JS_TRUE;
         }
     }
 
     if (JSID_IS_INT(id))
         index = JSID_TO_INT(id);
 
     uint64 result = 0;