Help the branch predictor in the builtins.
authorAndreas Gal <gal@mozilla.com>
Sat, 05 Jul 2008 15:46:58 -0700
changeset 17433 8c6d36837b228e0b633f5e0dbc9cfaa01ad7f798
parent 17432 9edc74143be669124e0589c0636e026bd9d7519b
child 17434 f5a30a112d06eacf7a701fcf27123fd4907e97cf
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
Help the branch predictor in the builtins.
js/src/jstracer.cpp
--- a/js/src/jstracer.cpp
+++ b/js/src/jstracer.cpp
@@ -171,24 +171,24 @@ inline FASTCALL uint64 builtin_BoxDouble
 #ifdef DEBUG
     JS_ASSERT(ok);
 #endif        
     return v & 0xffffffffLL;
 }
 
 inline FASTCALL uint64 builtin_BoxInt32(JSContext* cx, jsint i)
 {
-    if (INT_FITS_IN_JSVAL(i)) 
+    if (JS_LIKELY(INT_FITS_IN_JSVAL(i)))
         return INT_TO_JSVAL(i) & 0xffffffffLL;
     return builtin_BoxDouble(cx, (jsdouble)i);
-}
+} 
 
 inline FASTCALL uint64 builtin_UnboxInt32(JSContext* cx, jsval v)
 {
-    if (JSVAL_IS_INT(v))
+    if (JS_LIKELY(JSVAL_IS_INT(v)))
         return JSVAL_TO_INT(v);
     jsint i;
     if (JSVAL_IS_DOUBLE(v) && JSDOUBLE_IS_INT(*JSVAL_TO_DOUBLE(v), i))
         return i;
     return 1LL << 32;
 }
 
 #define BUILTIN1(op, at0, atr, tr, t0, cse, fold) \