Bug 837981 - Remove GetDeflatedStringLength(). r=terrence.
authorNicholas Nethercote <nnethercote@mozilla.com>
Tue, 05 Feb 2013 15:12:05 -0800
changeset 130843 a7f93cfc074e467aa8488de6da01b3ad6d112f4d
parent 130842 43a5c9890c22e54152c997f8800956b517819a3a
child 130844 2ffeac43b95e356c3d655ae347033829f3f8f7c5
push id2323
push userbbajaj@mozilla.com
push dateMon, 01 Apr 2013 19:47:02 +0000
treeherdermozilla-beta@7712be144d91 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersterrence
bugs837981
milestone21.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 837981 - Remove GetDeflatedStringLength(). r=terrence.
js/src/jsapi.cpp
js/src/jsopcode.cpp
js/src/jsstr.cpp
js/src/jsstr.h
--- a/js/src/jsapi.cpp
+++ b/js/src/jsapi.cpp
@@ -6137,17 +6137,17 @@ JS_PUBLIC_API(size_t)
 JS_GetStringEncodingLength(JSContext *cx, JSString *str)
 {
     AssertHeapIsIdle(cx);
     CHECK_REQUEST(cx);
 
     const jschar *chars = str->getChars(cx);
     if (!chars)
         return size_t(-1);
-    return GetDeflatedStringLength(cx, chars, str->length());
+    return str->length();
 }
 
 JS_PUBLIC_API(size_t)
 JS_EncodeStringToBuffer(JSContext *cx, JSString *str, char *buffer, size_t length)
 {
     AssertHeapIsIdle(cx);
     CHECK_REQUEST(cx);
 
@@ -6160,17 +6160,17 @@ JS_EncodeStringToBuffer(JSContext *cx, J
     const jschar *chars = str->getChars(NULL);
     if (!chars)
         return size_t(-1);
     if (DeflateStringToBuffer(NULL, chars, str->length(), buffer, &writtenLength)) {
         JS_ASSERT(writtenLength <= length);
         return writtenLength;
     }
     JS_ASSERT(writtenLength <= length);
-    size_t necessaryLength = GetDeflatedStringLength(NULL, chars, str->length());
+    size_t necessaryLength = str->length();
     if (necessaryLength == size_t(-1))
         return size_t(-1);
     JS_ASSERT(writtenLength == length); // C strings are NOT encoded.
     return necessaryLength;
 }
 
 JS_PUBLIC_API(JSBool)
 JS_Stringify(JSContext *cx, jsval *vp, JSObject *replacerArg, jsval space,
--- a/js/src/jsopcode.cpp
+++ b/js/src/jsopcode.cpp
@@ -866,17 +866,17 @@ Sprinter::putString(JSString *s)
 {
     InvariantChecker ic(this);
 
     size_t length = s->length();
     const jschar *chars = s->getChars(context);
     if (!chars)
         return -1;
 
-    size_t size = GetDeflatedStringLength(context, chars, length);
+    size_t size = length;
     if (size == (size_t) -1)
         return -1;
 
     ptrdiff_t oldOffset = offset;
     char *buffer = reserve(size);
     if (!buffer)
         return -1;
     DeflateStringToBuffer(context, chars, length, buffer, &size);
--- a/js/src/jsstr.cpp
+++ b/js/src/jsstr.cpp
@@ -3890,22 +3890,16 @@ js::InflateUTF8String(JSContext *cx, con
     /*
      * For compatibility with callers of JS_DecodeBytes we must zero lengthp
      * on errors.
      */
     *lengthp = 0;
     return NULL;
 }
 
-size_t
-js::GetDeflatedStringLength(JSContext *cx, const jschar *chars, size_t nchars)
-{
-    return nchars;
-}
-
 bool
 js::DeflateStringToBuffer(JSContext *maybecx, const jschar *src, size_t srclen,
                           char *dst, size_t *dstlenp)
 {
     size_t dstlen = *dstlenp;
     if (srclen > dstlen) {
         for (size_t i = 0; i < dstlen; i++)
             dst[i] = (char) src[i];
--- a/js/src/jsstr.h
+++ b/js/src/jsstr.h
@@ -242,20 +242,16 @@ InflateUTF8String(JSContext *cx, const c
 extern bool
 InflateStringToBuffer(JSContext *cx, const char *bytes, size_t length,
                       jschar *chars, size_t *charsLength);
 
 extern bool
 InflateUTF8StringToBuffer(JSContext *cx, const char *bytes, size_t length,
                           jschar *chars, size_t *charsLength);
 
-/* Get number of bytes in the deflated sequence of characters. */
-extern size_t
-GetDeflatedStringLength(JSContext *cx, const jschar *chars, size_t charsLength);
-
 /*
  * Deflate JS chars to bytes into a buffer. 'bytes' must be large enough for
  * 'length chars. The buffer is NOT null-terminated. The destination length
  * must to be initialized with the buffer size and will contain on return the
  * number of copied bytes.
  */
 extern bool
 DeflateStringToBuffer(JSContext *cx, const jschar *chars,