Bug 867426 - Remove RawString typedef; r=jonco
authorTerrence Cole <terrence@mozilla.com>
Tue, 30 Apr 2013 15:40:48 -0700
changeset 141450 f9cf4a647f394df1febe2f9a0fcbce7d25bb193f
parent 141449 8c8e389fd3c34f41d1d5adbdde629bfa30e4b70a
child 141451 e119cde77a3bcf9f9ca3eb14c9441e7ca1ebc9d4
push id2579
push userakeybl@mozilla.com
push dateMon, 24 Jun 2013 18:52:47 +0000
treeherdermozilla-beta@b69b7de8a05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjonco
bugs867426
milestone23.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 867426 - Remove RawString typedef; r=jonco
js/public/RootingAPI.h
js/src/builtin/Object.cpp
js/src/builtin/RegExp.cpp
js/src/gc/Marking.cpp
js/src/gdb/tests/test-JSString.cpp
js/src/ion/BaselineIC.cpp
js/src/jscntxt.h
js/src/jscompartment.cpp
js/src/jsdate.cpp
js/src/jsexn.cpp
js/src/jsfun.cpp
js/src/jsiter.cpp
js/src/jsstr.cpp
js/src/vm/RegExpStatics-inl.h
js/src/vm/String.h
--- a/js/public/RootingAPI.h
+++ b/js/public/RootingAPI.h
@@ -313,17 +313,16 @@ typedef MutableHandle<Value>       Mutab
 
 namespace js {
 
 /*
  * Raw pointer used as documentation that a parameter does not need to be
  * rooted.
  */
 typedef JSObject *                  RawObject;
-typedef JSString *                  RawString;
 typedef jsid                        RawId;
 typedef JS::Value                   RawValue;
 
 /*
  * InternalHandle is a handle to an internal pointer into a gcthing. Use
  * InternalHandle when you have a pointer to a direct field of a gcthing, or
  * when you need a parameter type for something that *may* be a pointer to a
  * direct field of a gcthing.
--- a/js/src/builtin/Object.cpp
+++ b/js/src/builtin/Object.cpp
@@ -178,17 +178,17 @@ obj_toSource(JSContext *cx, unsigned arg
                 valcnt = 1;
                 gsop[0].set(NULL);
                 if (!JSObject::getGeneric(cx, obj, obj, id, val[0]))
                     return false;
             }
         }
 
         /* Convert id to a linear string. */
-        RawString s = ToString<CanGC>(cx, IdToValue(id));
+        JSString *s = ToString<CanGC>(cx, IdToValue(id));
         if (!s)
             return false;
         Rooted<JSLinearString*> idstr(cx, s->ensureLinear(cx));
         if (!idstr)
             return false;
 
         /*
          * If id is a string that's not an identifier, or if it's a negative
@@ -273,17 +273,17 @@ obj_toSource(JSContext *cx, unsigned arg
         }
     }
 
     if (!buf.append('}'))
         return false;
     if (outermost && !buf.append(')'))
         return false;
 
-    RawString str = buf.finishString();
+    JSString *str = buf.finishString();
     if (!str)
         return false;
     args.rval().setString(str);
     return true;
 }
 #endif /* JS_HAS_TOSOURCE */
 
 JSString *
@@ -319,17 +319,17 @@ obj_toString(JSContext *cx, unsigned arg
     }
 
     /* Step 3. */
     RootedObject obj(cx, ToObject(cx, args.thisv()));
     if (!obj)
         return false;
 
     /* Steps 4-5. */
-    RawString str = JS_BasicObjectToString(cx, obj);
+    JSString *str = JS_BasicObjectToString(cx, obj);
     if (!str)
         return false;
     args.rval().setString(str);
     return true;
 }
 
 /* ES5 15.2.4.3. */
 static JSBool
--- a/js/src/builtin/RegExp.cpp
+++ b/js/src/builtin/RegExp.cpp
@@ -361,17 +361,17 @@ regexp_construct(JSContext *cx, unsigned
     return CompileRegExpObject(cx, builder, args);
 }
 
 JS_ALWAYS_INLINE bool
 regexp_toString_impl(JSContext *cx, CallArgs args)
 {
     JS_ASSERT(IsRegExp(args.thisv()));
 
-    RawString str = args.thisv().toObject().asRegExp().toString(cx);
+    JSString *str = args.thisv().toObject().asRegExp().toString(cx);
     if (!str)
         return false;
 
     args.rval().setString(str);
     return true;
 }
 
 JSBool
--- a/js/src/gc/Marking.cpp
+++ b/js/src/gc/Marking.cpp
@@ -381,17 +381,17 @@ gc::MarkKind(JSTracer *trc, void **thing
     JS_ASSERT(*thingp);
     DebugOnly<Cell *> cell = static_cast<Cell *>(*thingp);
     JS_ASSERT_IF(cell->isTenured(), kind == MapAllocToTraceKind(cell->tenuredGetAllocKind()));
     switch (kind) {
       case JSTRACE_OBJECT:
         MarkInternal(trc, reinterpret_cast<RawObject *>(thingp));
         break;
       case JSTRACE_STRING:
-        MarkInternal(trc, reinterpret_cast<RawString *>(thingp));
+        MarkInternal(trc, reinterpret_cast<JSString **>(thingp));
         break;
       case JSTRACE_SCRIPT:
         MarkInternal(trc, reinterpret_cast<JSScript **>(thingp));
         break;
       case JSTRACE_SHAPE:
         MarkInternal(trc, reinterpret_cast<Shape **>(thingp));
         break;
       case JSTRACE_BASE_SHAPE:
@@ -1490,17 +1490,17 @@ void
 js::TraceChildren(JSTracer *trc, void *thing, JSGCTraceKind kind)
 {
     switch (kind) {
       case JSTRACE_OBJECT:
         MarkChildren(trc, static_cast<RawObject>(thing));
         break;
 
       case JSTRACE_STRING:
-        MarkChildren(trc, static_cast<RawString>(thing));
+        MarkChildren(trc, static_cast<JSString *>(thing));
         break;
 
       case JSTRACE_SCRIPT:
         MarkChildren(trc, static_cast<JSScript *>(thing));
         break;
 
       case JSTRACE_SHAPE:
         MarkChildren(trc, static_cast<Shape *>(thing));
--- a/js/src/gdb/tests/test-JSString.cpp
+++ b/js/src/gdb/tests/test-JSString.cpp
@@ -19,32 +19,32 @@ FRAGMENT(JSString, simple) {
 
   // This may well be an inlined string.
   JS::Rooted<JSString *> xz(cx, JS_ConcatStrings(cx, x, z));
 
   // This will probably be a rope.
   JS::Rooted<JSString *> doubleStars(cx, JS_ConcatStrings(cx, stars, stars));
 
   // Ensure we're not confused by typedefs for pointer types.
-  js::RawString xRaw = x;
+  JSString *xRaw = x;
 
   breakpoint();
 
   (void) empty;
   (void) x;
   (void) z;
   (void) stars;
   (void) xz;
   (void) doubleStars;
   (void) xRaw;
 }
 
 FRAGMENT(JSString, null) {
   JS::Rooted<JSString *> null(cx, NULL);
-  js::RawString nullRaw = null;
+  JSString *nullRaw = null;
 
   breakpoint();
 
   (void) null;
   (void) nullRaw;
 }
 
 FRAGMENT(JSString, subclasses) {
--- a/js/src/ion/BaselineIC.cpp
+++ b/js/src/ion/BaselineIC.cpp
@@ -2563,19 +2563,19 @@ ICBinaryArith_Fallback::Compiler::genera
     return tailCallVM(DoBinaryArithFallbackInfo, masm);
 }
 
 static bool
 DoConcatStrings(JSContext *cx, HandleValue lhs, HandleValue rhs, MutableHandleValue res)
 {
     JS_ASSERT(lhs.isString());
     JS_ASSERT(rhs.isString());
-    RawString lstr = lhs.toString();
-    RawString rstr = rhs.toString();
-    RawString result = ConcatStrings<NoGC>(cx, lstr, rstr);
+    JSString *lstr = lhs.toString();
+    JSString *rstr = rhs.toString();
+    JSString *result = ConcatStrings<NoGC>(cx, lstr, rstr);
     if (result) {
         res.set(StringValue(result));
         return true;
     }
 
     RootedString rootedl(cx, lstr), rootedr(cx, rstr);
     result = ConcatStrings<CanGC>(cx, rootedl, rootedr);
     if (!result)
@@ -2604,32 +2604,32 @@ ICBinaryArith_StringConcat::Compiler::ge
         return false;
 
     // Failure case - jump to next stub
     masm.bind(&failure);
     EmitStubGuardFailure(masm);
     return true;
 }
 
-static RawString
+static JSString *
 ConvertObjectToStringForConcat(JSContext *cx, HandleValue obj)
 {
     JS_ASSERT(obj.isObject());
     RootedValue rootedObj(cx, obj);
     if (!ToPrimitive(cx, &rootedObj))
         return NULL;
     return ToString<CanGC>(cx, rootedObj);
 }
 
 static bool
 DoConcatStringObject(JSContext *cx, bool lhsIsString, HandleValue lhs, HandleValue rhs,
                      MutableHandleValue res)
 {
-    RawString lstr = NULL;
-    RawString rstr = NULL;
+    JSString *lstr = NULL;
+    JSString *rstr = NULL;
     if (lhsIsString) {
         // Convert rhs first.
         JS_ASSERT(lhs.isString() && rhs.isObject());
         rstr = ConvertObjectToStringForConcat(cx, rhs);
         if (!rstr)
             return false;
 
         // lhs is already string.
--- a/js/src/jscntxt.h
+++ b/js/src/jscntxt.h
@@ -2238,22 +2238,22 @@ class AutoObjectVector : public AutoVect
         : AutoVectorRooter<RawObject>(cx, OBJVECTOR)
     {
         MOZ_GUARD_OBJECT_NOTIFIER_INIT;
     }
 
     MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
 };
 
-class AutoStringVector : public AutoVectorRooter<RawString>
+class AutoStringVector : public AutoVectorRooter<JSString *>
 {
   public:
     explicit AutoStringVector(JSContext *cx
                               MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
-        : AutoVectorRooter<RawString>(cx, STRINGVECTOR)
+        : AutoVectorRooter<JSString *>(cx, STRINGVECTOR)
     {
         MOZ_GUARD_OBJECT_NOTIFIER_INIT;
     }
 
     MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
 };
 
 class AutoShapeVector : public AutoVectorRooter<Shape *>
--- a/js/src/jscompartment.cpp
+++ b/js/src/jscompartment.cpp
@@ -201,17 +201,17 @@ JSCompartment::wrap(JSContext *cx, Mutab
 
     AutoDisableProxyCheck adpc(rt);
 
     /* Only GC things have to be wrapped or copied. */
     if (!vp.isMarkable())
         return true;
 
     if (vp.isString()) {
-        RawString str = vp.toString();
+        JSString *str = vp.toString();
 
         /* If the string is already in this compartment, we are done. */
         if (str->zone() == zone())
             return true;
 
         /* If the string is an atom, we don't have to copy. */
         if (str->isAtom()) {
             JS_ASSERT(str->zone() == cx->runtime->atomsCompartment->zone());
@@ -276,17 +276,17 @@ JSCompartment::wrap(JSContext *cx, Mutab
         return true;
     }
 
     if (vp.isString()) {
         Rooted<JSLinearString *> str(cx, vp.toString()->ensureLinear(cx));
         if (!str)
             return false;
 
-        RawString wrapped = js_NewStringCopyN<CanGC>(cx, str->chars(), str->length());
+        JSString *wrapped = js_NewStringCopyN<CanGC>(cx, str->chars(), str->length());
         if (!wrapped)
             return false;
 
         vp.setString(wrapped);
         if (!putWrapper(key, vp))
             return false;
 
         if (str->zone()->isGCMarking()) {
--- a/js/src/jsdate.cpp
+++ b/js/src/jsdate.cpp
@@ -1177,17 +1177,17 @@ static JSBool
 date_parse(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     if (args.length() == 0) {
         vp->setDouble(js_NaN);
         return true;
     }
 
-    RawString str = ToString<CanGC>(cx, args[0]);
+    JSString *str = ToString<CanGC>(cx, args[0]);
     if (!str)
         return false;
 
     JSLinearString *linearStr = str->ensureLinear(cx);
     if (!linearStr)
         return false;
 
     double result;
@@ -2482,17 +2482,17 @@ date_toGMTString_impl(JSContext *cx, Cal
     double utctime = args.thisv().toObject().getDateUTCTime().toNumber();
 
     char buf[100];
     if (!MOZ_DOUBLE_IS_FINITE(utctime))
         JS_snprintf(buf, sizeof buf, js_NaN_date_str);
     else
         print_gmt_string(buf, sizeof buf, utctime);
 
-    RawString str = JS_NewStringCopyZ(cx, buf);
+    JSString *str = JS_NewStringCopyZ(cx, buf);
     if (!str)
         return false;
     args.rval().setString(str);
     return true;
 }
 
 /* ES5 15.9.5.43. */
 static JSBool
@@ -2511,17 +2511,17 @@ date_toISOString_impl(JSContext *cx, Cal
     if (!MOZ_DOUBLE_IS_FINITE(utctime)) {
         JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_INVALID_DATE);
         return false;
     }
 
     char buf[100];
     print_iso_string(buf, sizeof buf, utctime);
 
-    RawString str = JS_NewStringCopyZ(cx, buf);
+    JSString *str = JS_NewStringCopyZ(cx, buf);
     if (!str)
         return false;
     args.rval().setString(str);
     return true;
 
 }
 
 static JSBool
@@ -2708,17 +2708,17 @@ date_format(JSContext *cx, double date, 
                         int(SecFromTime(local)),
                         offset,
                         usetz ? " " : "",
                         usetz ? tzbuf : "");
             break;
         }
     }
 
-    RawString str = JS_NewStringCopyZ(cx, buf);
+    JSString *str = JS_NewStringCopyZ(cx, buf);
     if (!str)
         return false;
     rval.setString(str);
     return true;
 }
 
 static bool
 ToLocaleFormatHelper(JSContext *cx, HandleObject obj, const char *format, MutableHandleValue rval)
@@ -2754,17 +2754,17 @@ ToLocaleFormatHelper(JSContext *cx, Hand
                         "%d", js_DateGetYear(cx, obj));
         }
 
     }
 
     if (cx->runtime->localeCallbacks && cx->runtime->localeCallbacks->localeToUnicode)
         return cx->runtime->localeCallbacks->localeToUnicode(cx, buf, rval);
 
-    RawString str = JS_NewStringCopyZ(cx, buf);
+    JSString *str = JS_NewStringCopyZ(cx, buf);
     if (!str)
         return false;
     rval.setString(str);
     return true;
 }
 
 #if !ENABLE_INTL_API
 static bool
@@ -2929,17 +2929,17 @@ date_toSource_impl(JSContext *cx, CallAr
     StringBuffer sb(cx);
     if (!sb.append("(new Date(") ||
         !NumberValueToStringBuffer(cx, args.thisv().toObject().getDateUTCTime(), sb) ||
         !sb.append("))"))
     {
         return false;
     }
 
-    RawString str = sb.finishString();
+    JSString *str = sb.finishString();
     if (!str)
         return false;
     args.rval().setString(str);
     return true;
 }
 
 static JSBool
 date_toSource(JSContext *cx, unsigned argc, Value *vp)
@@ -3066,17 +3066,17 @@ js_Date(JSContext *cx, unsigned argc, Va
         /* ES5 15.9.3.2. */
 
         /* Step 1. */
         if (!ToPrimitive(cx, args.handleAt(0)))
             return false;
 
         if (args[0].isString()) {
             /* Step 2. */
-            RawString str = args[0].toString();
+            JSString *str = args[0].toString();
             if (!str)
                 return false;
 
             JSLinearString *linearStr = str->ensureLinear(cx);
             if (!linearStr)
                 return false;
 
             if (!date_parseString(linearStr, &d, &cx->runtime->dateTimeInfo))
--- a/js/src/jsexn.cpp
+++ b/js/src/jsexn.cpp
@@ -440,17 +440,17 @@ exn_resolve(JSContext *cx, HandleObject 
             prop = js_columnNumber_str;
             v = UINT_TO_JSVAL(priv->column);
             attrs = JSPROP_ENUMERATE;
             goto define;
         }
 
         atom = cx->names().stack;
         if (str == atom) {
-            RawString stack = StackTraceToString(cx, priv);
+            JSString *stack = StackTraceToString(cx, priv);
             if (!stack)
                 return false;
 
             prop = js_stack_str;
             v = STRING_TO_JSVAL(stack);
             attrs = JSPROP_ENUMERATE;
             goto define;
         }
@@ -664,17 +664,17 @@ exn_toString(JSContext *cx, unsigned arg
         return true;
     }
 
     /* Step 10. */
     StringBuffer sb(cx);
     if (!sb.append(name) || !sb.append(": ") || !sb.append(message))
         return false;
 
-    RawString str = sb.finishString();
+    JSString *str = sb.finishString();
     if (!str)
         return false;
     args.rval().setString(str);
     return true;
 }
 
 #if JS_HAS_TOSOURCE
 /*
@@ -733,27 +733,27 @@ exn_toSource(JSContext *cx, unsigned arg
         if (!sb.append(", ") || !sb.append(filename))
             return false;
     }
     if (lineno != 0) {
         /* We have a line, but no filename, add empty string */
         if (filename->empty() && !sb.append(", \"\""))
                 return false;
 
-        RawString linenumber = ToString<CanGC>(cx, linenoVal);
+        JSString *linenumber = ToString<CanGC>(cx, linenoVal);
         if (!linenumber)
             return false;
         if (!sb.append(", ") || !sb.append(linenumber))
             return false;
     }
 
     if (!sb.append("))"))
         return false;
 
-    RawString str = sb.finishString();
+    JSString *str = sb.finishString();
     if (!str)
         return false;
     args.rval().setString(str);
     return true;
 }
 #endif
 
 static const JSFunctionSpec exception_methods[] = {
@@ -1072,17 +1072,17 @@ js_ReportUncaughtException(JSContext *cx
                 return false;
         } else if (name) {
             str = name;
         } else if (msg) {
             str = msg;
         }
 
         if (JS_GetProperty(cx, exnObject, filename_str, &roots[4])) {
-            RawString tmp = ToString<CanGC>(cx, roots[4]);
+            JSString *tmp = ToString<CanGC>(cx, roots[4]);
             if (tmp)
                 filename.encodeLatin1(cx, tmp);
         }
 
         uint32_t lineno;
         if (!JS_GetProperty(cx, exnObject, js_lineNumber_str, &roots[5]) ||
             !ToUint32(cx, roots[5], &lineno))
         {
--- a/js/src/jsfun.cpp
+++ b/js/src/jsfun.cpp
@@ -1419,17 +1419,17 @@ js::Function(JSContext *cx, unsigned arg
                     return OnBadFormal(cx, tt);
                 tt = ts.getToken();
             }
         }
     }
 
 #ifdef DEBUG
     for (unsigned i = 0; i < formals.length(); ++i) {
-        RawString str = formals[i];
+        JSString *str = formals[i];
         JS_ASSERT(str->asAtom().asPropertyName() == formals[i]);
     }
 #endif
 
     RootedString str(cx);
     if (!args.length())
         str = cx->runtime->emptyString;
     else
--- a/js/src/jsiter.cpp
+++ b/js/src/jsiter.cpp
@@ -391,17 +391,17 @@ NewPropertyIteratorObject(JSContext *cx,
 }
 
 NativeIterator *
 NativeIterator::allocateIterator(JSContext *cx, uint32_t slength, const AutoIdVector &props)
 {
     size_t plength = props.length();
     NativeIterator *ni = (NativeIterator *)
         cx->malloc_(sizeof(NativeIterator)
-                    + plength * sizeof(RawString)
+                    + plength * sizeof(JSString *)
                     + slength * sizeof(Shape *));
     if (!ni)
         return NULL;
     AutoValueVector strings(cx);
     ni->props_array = ni->props_cursor = (HeapPtr<JSFlatString> *) (ni + 1);
     ni->props_end = ni->props_array + plength;
     if (plength) {
         for (size_t i = 0; i < plength; i++) {
--- a/js/src/jsstr.cpp
+++ b/js/src/jsstr.cpp
@@ -4232,17 +4232,17 @@ const bool js_isspace[] = {
 
 #undef ____
 
 #define URI_CHUNK 64U
 
 static inline bool
 TransferBufferToString(StringBuffer &sb, MutableHandleValue rval)
 {
-    RawString str = sb.finishString();
+    JSString *str = sb.finishString();
     if (!str)
         return false;
     rval.setString(str);
     return true;
 }
 
 /*
  * ECMA 3, 15.1.3 URI Handling Function Properties
--- a/js/src/vm/RegExpStatics-inl.h
+++ b/js/src/vm/RegExpStatics-inl.h
@@ -217,17 +217,17 @@ SizeOfRegExpStaticsData(const JSObject *
 inline bool
 RegExpStatics::createDependent(JSContext *cx, size_t start, size_t end, MutableHandleValue out)
 {
     /* Private function: caller must perform lazy evaluation. */
     JS_ASSERT(!pendingLazyEvaluation);
 
     JS_ASSERT(start <= end);
     JS_ASSERT(end <= matchesInput->length());
-    RawString str = js_NewDependentString(cx, matchesInput, start, end - start);
+    JSString *str = js_NewDependentString(cx, matchesInput, start, end - start);
     if (!str)
         return false;
     out.setString(str);
     return true;
 }
 
 inline bool
 RegExpStatics::createPendingInput(JSContext *cx, MutableHandleValue out)
--- a/js/src/vm/String.h
+++ b/js/src/vm/String.h
@@ -16,23 +16,22 @@
 #include "jsfriendapi.h"
 #include "jsstr.h"
 
 #include "gc/Barrier.h"
 #include "gc/Heap.h"
 #include "js/CharacterEncoding.h"
 #include "js/RootingAPI.h"
 
-ForwardDeclareJS(String);
 class JSDependentString;
-class JSUndependedString;
 class JSExtensibleString;
 class JSExternalString;
+class JSInlineString;
 class JSStableString;
-class JSInlineString;
+class JSString;
 class JSRope;
 
 namespace js {
 
 class StaticStrings;
 class PropertyName;
 
 /* The buffer length required to contain any unsigned 32-bit integer. */