Reviewed by Geoffrey Garen.
authorggaren@apple.com <ggaren@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 28 Feb 2008 22:16:46 +0000 (22:16 +0000)
committerggaren@apple.com <ggaren@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 28 Feb 2008 22:16:46 +0000 (22:16 +0000)
        ** TOTAL **:          1.005x as fast    2867.6ms +/- 0.4%  2853.2ms +/- 0.3%    significant

        * kjs/nodes.cpp: Tell the compiler that exceptions are unexpected (for
        the sake of branch prediction and code organization).

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@30651 268f45cc-cd09-0410-ab3c-d52691b4dbfc

JavaScriptCore/ChangeLog
JavaScriptCore/kjs/nodes.cpp

index 16b3a72b57f0ed804d40bb370d8473da8e98df16..1166ab4624ff0de3a2aab77e24a93d5c0c16b1f6 100644 (file)
@@ -1,3 +1,12 @@
+2008-02-28  Eric Christopher  <echristo@apple.com>
+
+        Reviewed by Geoffrey Garen.
+
+        ** TOTAL **:          1.005x as fast    2867.6ms +/- 0.4%  2853.2ms +/- 0.3%    significant
+
+        * kjs/nodes.cpp: Tell the compiler that exceptions are unexpected (for
+        the sake of branch prediction and code organization).
+
 2008-02-27  Alexey Proskuryakov  <ap@webkit.org>
 
         Reviewed by Sam Weinig.
index f852eb71f243655811a8c9a932540903251b5274..c36472f49ddbb43a533ffe196b3cf4a66c2dfb25 100644 (file)
@@ -50,30 +50,37 @@ public:
     virtual JSValue* execute(ExecState*) KJS_FAST_CALL;
 };
 
+#if COMPILER(GCC)
+#define UNLIKELY(x) \
+  __builtin_expect ((x), 0)
+#else
+#define UNLIKELY(x) x
+#endif
+    
 #define KJS_CHECKEXCEPTION \
-if (exec->hadException()) \
+if (UNLIKELY(exec->hadException())) \
     return rethrowException(exec);
 
 #define KJS_CHECKEXCEPTIONVALUE \
-if (exec->hadException()) { \
+if (UNLIKELY(exec->hadException())) { \
     handleException(exec); \
     return jsUndefined(); \
 }
 
 #define KJS_CHECKEXCEPTIONNUMBER \
-if (exec->hadException()) { \
+if (UNLIKELY(exec->hadException())) { \
     handleException(exec); \
     return 0; \
 }
 
 #define KJS_CHECKEXCEPTIONBOOLEAN \
-if (exec->hadException()) { \
+if (UNLIKELY(exec->hadException())) { \
     handleException(exec); \
     return false; \
 }
 
 #define KJS_CHECKEXCEPTIONVOID \
-if (exec->hadException()) { \
+if (UNLIKELY(exec->hadException())) { \
     handleException(exec); \
     return; \
 }