Bug 712055 - Remove xpc_qsInt32ToJsval/xpc_qsUint32ToJsval; r=jorendorff
authorMs2ger <ms2ger@gmail.com>
Sat, 24 Dec 2011 09:28:14 +0100
changeset 84513 25d4c80193c8c9700a342e5657c1f5e34190d828
parent 84512 b14872f6fd555084a106c7aadb570bf5cd19d55a
child 84514 2aa6d71c6839d159ffa3483fb8bfc2eba2904719
push id805
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 18:17:35 +0000
treeherdermozilla-aurora@6fb3bf232436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorendorff
bugs712055
milestone12.0a1
Bug 712055 - Remove xpc_qsInt32ToJsval/xpc_qsUint32ToJsval; r=jorendorff
js/xpconnect/src/XPCQuickStubs.h
js/xpconnect/src/codegen.py
js/xpconnect/src/qsgen.py
--- a/js/xpconnect/src/XPCQuickStubs.h
+++ b/js/xpconnect/src/XPCQuickStubs.h
@@ -229,33 +229,16 @@ xpc_qsThrowBadSetterValue(JSContext *cx,
 
 
 JSBool
 xpc_qsGetterOnlyPropertyStub(JSContext *cx, JSObject *obj, jsid id, JSBool strict, jsval *vp);
 
 /* Functions for converting values between COM and JS. */
 
 inline JSBool
-xpc_qsInt32ToJsval(JSContext *cx, PRInt32 i, jsval *rv)
-{
-    *rv = INT_TO_JSVAL(i);
-    return true;
-}
-
-inline JSBool
-xpc_qsUint32ToJsval(JSContext *cx, PRUint32 u, jsval *rv)
-{
-    if (u <= JSVAL_INT_MAX)
-        *rv = INT_TO_JSVAL(u);
-    else
-        *rv = DOUBLE_TO_JSVAL(u);
-    return true;
-}
-
-inline JSBool
 xpc_qsInt64ToJsval(JSContext *cx, PRInt64 i, jsval *rv)
 {
     return JS_NewNumberValue(cx, static_cast<jsdouble>(i), rv);
 }
 
 inline JSBool
 xpc_qsUint64ToJsval(JSContext *cx, PRUint64 u, jsval *rv)
 {
--- a/js/xpconnect/src/codegen.py
+++ b/js/xpconnect/src/codegen.py
@@ -342,27 +342,29 @@ resultConvTemplates = {
         "    ${jsvalRef} = INT_TO_JSVAL(int32_t(result));\n"
         "    return JS_TRUE;\n",
 
     'short':
         "    ${jsvalRef} = INT_TO_JSVAL(int32_t(result));\n"
         "    return JS_TRUE;\n",
 
     'long':
-        "    return xpc_qsInt32ToJsval(cx, result, ${jsvalPtr});\n",
+        "    ${jsvalRef} = INT_TO_JSVAL(result);\n"
+        "    return JS_TRUE;\n",
 
     'long long':
         "    return xpc_qsInt64ToJsval(cx, result, ${jsvalPtr};\n",
 
     'unsigned short':
         "    ${jsvalRef} = INT_TO_JSVAL(int32_t(result));\n"
         "    return JS_TRUE;\n",
 
     'unsigned long':
-        "    return xpc_qsUint32ToJsval(cx, result, ${jsvalPtr});\n",
+        "    ${jsvalRef} = UINT_TO_JSVAL(result);\n"
+        "    return JS_TRUE;\n",
 
     'unsigned long long':
         "    return xpc_qsUint64ToJsval(cx, result, ${jsvalPtr});\n",
 
     'float':
         "    return JS_NewNumberValue(cx, result, ${jsvalPtr});\n",
 
     'double':
--- a/js/xpconnect/src/qsgen.py
+++ b/js/xpconnect/src/qsgen.py
@@ -636,27 +636,29 @@ resultConvTemplates = {
         "    ${jsvalRef} = INT_TO_JSVAL((int32) result);\n"
         "    return JS_TRUE;\n",
 
     'short':
         "    ${jsvalRef} = INT_TO_JSVAL((int32) result);\n"
         "    return JS_TRUE;\n",
 
     'long':
-        "    return xpc_qsInt32ToJsval(cx, result, ${jsvalPtr});\n",
+        "    ${jsvalRef} = INT_TO_JSVAL(result);\n"
+        "    return JS_TRUE;\n",
 
     'long long':
         "    return xpc_qsInt64ToJsval(cx, result, ${jsvalPtr});\n",
 
     'unsigned short':
         "    ${jsvalRef} = INT_TO_JSVAL((int32) result);\n"
         "    return JS_TRUE;\n",
 
     'unsigned long':
-        "    return xpc_qsUint32ToJsval(cx, result, ${jsvalPtr});\n",
+        "    ${jsvalRef} = UINT_TO_JSVAL(result);\n"
+        "    return JS_TRUE;\n",
 
     'unsigned long long':
         "    return xpc_qsUint64ToJsval(cx, result, ${jsvalPtr});\n",
 
     'float':
         "    return JS_NewNumberValue(cx, result, ${jsvalPtr});\n",
 
     'double':