From 2c79d78867058c98130adf4f579205f457996a1e Mon Sep 17 00:00:00 2001 From: Luke Wagner Date: Wed, 10 Nov 2010 11:43:22 -0800 Subject: [PATCH] Bug 610848 - merge js::Int32ToString and js_IntToString (r=waldo) --- js/src/jsnum.cpp | 18 ++---------------- js/src/jsnum.h | 3 --- js/src/jsstr.cpp | 2 +- 3 files changed, 3 insertions(+), 20 deletions(-) diff --git a/js/src/jsnum.cpp b/js/src/jsnum.cpp index 5e704a9a1c31..be81150fc74f 100644 --- a/js/src/jsnum.cpp +++ b/js/src/jsnum.cpp @@ -584,10 +584,8 @@ ToCStringBuf::~ToCStringBuf() js_free(dbuf); } -namespace js { - -JSString * -Int32ToString(JSContext *cx, int32 si) +JSString * JS_FASTCALL +js_IntToString(JSContext *cx, int32 si) { uint32 ui; if (si >= 0) { @@ -634,8 +632,6 @@ Int32ToString(JSContext *cx, int32 si) return ret; } -} - /* Returns a non-NULL pointer to inside cbuf. */ static char * IntToCString(ToCStringBuf *cbuf, jsint i, jsint base = 10) @@ -1123,16 +1119,6 @@ NumberToCString(JSContext *cx, ToCStringBuf *cbuf, jsdouble d, jsint base/* = 10 } -JSString * JS_FASTCALL -js_IntToString(JSContext *cx, jsint i) -{ - if (jsuint(i) < INT_STRING_LIMIT) - return JSString::intString(i); - - ToCStringBuf cbuf; - return js_NewStringCopyZ(cx, IntToCString(&cbuf, i)); -} - static JSString * JS_FASTCALL js_NumberToStringWithBase(JSContext *cx, jsdouble d, jsint base) { diff --git a/js/src/jsnum.h b/js/src/jsnum.h index 43b438e9816b..dd1492e6f5a6 100644 --- a/js/src/jsnum.h +++ b/js/src/jsnum.h @@ -235,9 +235,6 @@ struct ToCStringBuf extern char * NumberToCString(JSContext *cx, ToCStringBuf *cbuf, jsdouble d, jsint base = 10); -extern JSString * -Int32ToString(JSContext *cx, int32 i); - /* * The largest positive integer such that all positive integers less than it * may be precisely represented using the IEEE-754 double-precision format. diff --git a/js/src/jsstr.cpp b/js/src/jsstr.cpp index d874b867a456..10ef0cc176e7 100644 --- a/js/src/jsstr.cpp +++ b/js/src/jsstr.cpp @@ -3742,7 +3742,7 @@ js_ValueToString(JSContext *cx, const Value &arg) if (v.isString()) { str = v.toString(); } else if (v.isInt32()) { - str = Int32ToString(cx, v.toInt32()); + str = js_IntToString(cx, v.toInt32()); } else if (v.isDouble()) { str = js_NumberToString(cx, v.toDouble()); } else if (v.isBoolean()) {