From 353919a532d16fa18d97cb1b13723059a582474b Mon Sep 17 00:00:00 2001 From: Terrence Cole Date: Tue, 30 Apr 2013 15:40:48 -0700 Subject: [PATCH] Bug 867426 - Remove RawString typedef; r=jonco --HG-- extra : rebase_source : 1cec78a4251429458c4df7fecb652e43443d7b5b --- js/public/RootingAPI.h | 1 - js/src/builtin/Object.cpp | 6 +++--- js/src/builtin/RegExp.cpp | 2 +- js/src/gc/Marking.cpp | 4 ++-- js/src/gdb/tests/test-JSString.cpp | 4 ++-- js/src/ion/BaselineIC.cpp | 12 ++++++------ js/src/jscntxt.h | 4 ++-- js/src/jscompartment.cpp | 4 ++-- js/src/jsdate.cpp | 14 +++++++------- js/src/jsexn.cpp | 10 +++++----- js/src/jsfun.cpp | 2 +- js/src/jsiter.cpp | 2 +- js/src/jsstr.cpp | 2 +- js/src/vm/RegExpStatics-inl.h | 2 +- js/src/vm/String.h | 5 ++--- 15 files changed, 36 insertions(+), 38 deletions(-) diff --git a/js/public/RootingAPI.h b/js/public/RootingAPI.h index 86bf7c363255..9e9975f242e3 100644 --- a/js/public/RootingAPI.h +++ b/js/public/RootingAPI.h @@ -318,7 +318,6 @@ namespace js { * rooted. */ typedef JSObject * RawObject; -typedef JSString * RawString; typedef jsid RawId; typedef JS::Value RawValue; diff --git a/js/src/builtin/Object.cpp b/js/src/builtin/Object.cpp index 60e578e3a2ba..2885068712a1 100644 --- a/js/src/builtin/Object.cpp +++ b/js/src/builtin/Object.cpp @@ -183,7 +183,7 @@ obj_toSource(JSContext *cx, unsigned argc, Value *vp) } /* Convert id to a linear string. */ - RawString s = ToString(cx, IdToValue(id)); + JSString *s = ToString(cx, IdToValue(id)); if (!s) return false; Rooted idstr(cx, s->ensureLinear(cx)); @@ -278,7 +278,7 @@ obj_toSource(JSContext *cx, unsigned argc, Value *vp) if (outermost && !buf.append(')')) return false; - RawString str = buf.finishString(); + JSString *str = buf.finishString(); if (!str) return false; args.rval().setString(str); @@ -324,7 +324,7 @@ obj_toString(JSContext *cx, unsigned argc, Value *vp) 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); diff --git a/js/src/builtin/RegExp.cpp b/js/src/builtin/RegExp.cpp index 93886c8f328c..2f3ea0f25ed3 100644 --- a/js/src/builtin/RegExp.cpp +++ b/js/src/builtin/RegExp.cpp @@ -366,7 +366,7 @@ 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; diff --git a/js/src/gc/Marking.cpp b/js/src/gc/Marking.cpp index c6832964be6a..81910307e039 100644 --- a/js/src/gc/Marking.cpp +++ b/js/src/gc/Marking.cpp @@ -386,7 +386,7 @@ gc::MarkKind(JSTracer *trc, void **thingp, JSGCTraceKind kind) MarkInternal(trc, reinterpret_cast(thingp)); break; case JSTRACE_STRING: - MarkInternal(trc, reinterpret_cast(thingp)); + MarkInternal(trc, reinterpret_cast(thingp)); break; case JSTRACE_SCRIPT: MarkInternal(trc, reinterpret_cast(thingp)); @@ -1495,7 +1495,7 @@ js::TraceChildren(JSTracer *trc, void *thing, JSGCTraceKind kind) break; case JSTRACE_STRING: - MarkChildren(trc, static_cast(thing)); + MarkChildren(trc, static_cast(thing)); break; case JSTRACE_SCRIPT: diff --git a/js/src/gdb/tests/test-JSString.cpp b/js/src/gdb/tests/test-JSString.cpp index 934fbdd87df5..b8a61ebe8ab8 100644 --- a/js/src/gdb/tests/test-JSString.cpp +++ b/js/src/gdb/tests/test-JSString.cpp @@ -24,7 +24,7 @@ FRAGMENT(JSString, simple) { JS::Rooted 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(); @@ -39,7 +39,7 @@ FRAGMENT(JSString, simple) { FRAGMENT(JSString, null) { JS::Rooted null(cx, NULL); - js::RawString nullRaw = null; + JSString *nullRaw = null; breakpoint(); diff --git a/js/src/ion/BaselineIC.cpp b/js/src/ion/BaselineIC.cpp index 6b4c27a7c807..51d4cc741383 100644 --- a/js/src/ion/BaselineIC.cpp +++ b/js/src/ion/BaselineIC.cpp @@ -2568,9 +2568,9 @@ DoConcatStrings(JSContext *cx, HandleValue lhs, HandleValue rhs, MutableHandleVa { JS_ASSERT(lhs.isString()); JS_ASSERT(rhs.isString()); - RawString lstr = lhs.toString(); - RawString rstr = rhs.toString(); - RawString result = ConcatStrings(cx, lstr, rstr); + JSString *lstr = lhs.toString(); + JSString *rstr = rhs.toString(); + JSString *result = ConcatStrings(cx, lstr, rstr); if (result) { res.set(StringValue(result)); return true; @@ -2609,7 +2609,7 @@ ICBinaryArith_StringConcat::Compiler::generateStubCode(MacroAssembler &masm) return true; } -static RawString +static JSString * ConvertObjectToStringForConcat(JSContext *cx, HandleValue obj) { JS_ASSERT(obj.isObject()); @@ -2623,8 +2623,8 @@ 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()); diff --git a/js/src/jscntxt.h b/js/src/jscntxt.h index 0e10201cf142..8f7d1d3f40f5 100644 --- a/js/src/jscntxt.h +++ b/js/src/jscntxt.h @@ -2243,12 +2243,12 @@ class AutoObjectVector : public AutoVectorRooter MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER }; -class AutoStringVector : public AutoVectorRooter +class AutoStringVector : public AutoVectorRooter { public: explicit AutoStringVector(JSContext *cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM) - : AutoVectorRooter(cx, STRINGVECTOR) + : AutoVectorRooter(cx, STRINGVECTOR) { MOZ_GUARD_OBJECT_NOTIFIER_INIT; } diff --git a/js/src/jscompartment.cpp b/js/src/jscompartment.cpp index bbafe0e63eff..887e5fd68fca 100644 --- a/js/src/jscompartment.cpp +++ b/js/src/jscompartment.cpp @@ -206,7 +206,7 @@ JSCompartment::wrap(JSContext *cx, MutableHandleValue vp, HandleObject existingA 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()) @@ -281,7 +281,7 @@ JSCompartment::wrap(JSContext *cx, MutableHandleValue vp, HandleObject existingA if (!str) return false; - RawString wrapped = js_NewStringCopyN(cx, str->chars(), str->length()); + JSString *wrapped = js_NewStringCopyN(cx, str->chars(), str->length()); if (!wrapped) return false; diff --git a/js/src/jsdate.cpp b/js/src/jsdate.cpp index b03471067d96..ea4f45fe99f8 100644 --- a/js/src/jsdate.cpp +++ b/js/src/jsdate.cpp @@ -1182,7 +1182,7 @@ date_parse(JSContext *cx, unsigned argc, Value *vp) return true; } - RawString str = ToString(cx, args[0]); + JSString *str = ToString(cx, args[0]); if (!str) return false; @@ -2487,7 +2487,7 @@ date_toGMTString_impl(JSContext *cx, CallArgs args) 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); @@ -2516,7 +2516,7 @@ date_toISOString_impl(JSContext *cx, CallArgs args) 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); @@ -2713,7 +2713,7 @@ date_format(JSContext *cx, double date, formatspec format, MutableHandleValue rv } } - RawString str = JS_NewStringCopyZ(cx, buf); + JSString *str = JS_NewStringCopyZ(cx, buf); if (!str) return false; rval.setString(str); @@ -2759,7 +2759,7 @@ ToLocaleFormatHelper(JSContext *cx, HandleObject obj, const char *format, Mutabl 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); @@ -2934,7 +2934,7 @@ date_toSource_impl(JSContext *cx, CallArgs args) return false; } - RawString str = sb.finishString(); + JSString *str = sb.finishString(); if (!str) return false; args.rval().setString(str); @@ -3071,7 +3071,7 @@ js_Date(JSContext *cx, unsigned argc, Value *vp) if (args[0].isString()) { /* Step 2. */ - RawString str = args[0].toString(); + JSString *str = args[0].toString(); if (!str) return false; diff --git a/js/src/jsexn.cpp b/js/src/jsexn.cpp index b2fddf0c6518..40ccfb047a9c 100644 --- a/js/src/jsexn.cpp +++ b/js/src/jsexn.cpp @@ -445,7 +445,7 @@ exn_resolve(JSContext *cx, HandleObject obj, HandleId id, unsigned flags, atom = cx->names().stack; if (str == atom) { - RawString stack = StackTraceToString(cx, priv); + JSString *stack = StackTraceToString(cx, priv); if (!stack) return false; @@ -669,7 +669,7 @@ exn_toString(JSContext *cx, unsigned argc, Value *vp) 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); @@ -738,7 +738,7 @@ exn_toSource(JSContext *cx, unsigned argc, Value *vp) if (filename->empty() && !sb.append(", \"\"")) return false; - RawString linenumber = ToString(cx, linenoVal); + JSString *linenumber = ToString(cx, linenoVal); if (!linenumber) return false; if (!sb.append(", ") || !sb.append(linenumber)) @@ -748,7 +748,7 @@ exn_toSource(JSContext *cx, unsigned argc, Value *vp) if (!sb.append("))")) return false; - RawString str = sb.finishString(); + JSString *str = sb.finishString(); if (!str) return false; args.rval().setString(str); @@ -1077,7 +1077,7 @@ js_ReportUncaughtException(JSContext *cx) } if (JS_GetProperty(cx, exnObject, filename_str, &roots[4])) { - RawString tmp = ToString(cx, roots[4]); + JSString *tmp = ToString(cx, roots[4]); if (tmp) filename.encodeLatin1(cx, tmp); } diff --git a/js/src/jsfun.cpp b/js/src/jsfun.cpp index b138ae5fb502..87de0def84e3 100644 --- a/js/src/jsfun.cpp +++ b/js/src/jsfun.cpp @@ -1424,7 +1424,7 @@ js::Function(JSContext *cx, unsigned argc, Value *vp) #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 diff --git a/js/src/jsiter.cpp b/js/src/jsiter.cpp index a466d63f73f8..e6959d2edda5 100644 --- a/js/src/jsiter.cpp +++ b/js/src/jsiter.cpp @@ -396,7 +396,7 @@ NativeIterator::allocateIterator(JSContext *cx, uint32_t slength, const AutoIdVe 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; diff --git a/js/src/jsstr.cpp b/js/src/jsstr.cpp index 68afd1eb5644..7329383dbf3e 100644 --- a/js/src/jsstr.cpp +++ b/js/src/jsstr.cpp @@ -4237,7 +4237,7 @@ const bool js_isspace[] = { static inline bool TransferBufferToString(StringBuffer &sb, MutableHandleValue rval) { - RawString str = sb.finishString(); + JSString *str = sb.finishString(); if (!str) return false; rval.setString(str); diff --git a/js/src/vm/RegExpStatics-inl.h b/js/src/vm/RegExpStatics-inl.h index 8b8842e40c71..da2f6ec1d0db 100644 --- a/js/src/vm/RegExpStatics-inl.h +++ b/js/src/vm/RegExpStatics-inl.h @@ -222,7 +222,7 @@ RegExpStatics::createDependent(JSContext *cx, size_t start, size_t end, MutableH 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); diff --git a/js/src/vm/String.h b/js/src/vm/String.h index 31b530a73886..963bcc2338d1 100644 --- a/js/src/vm/String.h +++ b/js/src/vm/String.h @@ -21,13 +21,12 @@ #include "js/CharacterEncoding.h" #include "js/RootingAPI.h" -ForwardDeclareJS(String); class JSDependentString; -class JSUndependedString; class JSExtensibleString; class JSExternalString; -class JSStableString; class JSInlineString; +class JSStableString; +class JSString; class JSRope; namespace js {