Bug 867426 - Remove RawAtom typedef; r=jonco
authorTerrence Cole <terrence@mozilla.com>
Tue, 30 Apr 2013 15:38:45 -0700
changeset 141441 4fbf994a4b1f5876281c4dc921ababf43d791258
parent 141440 95993aae5d96683971f22d8a06beca27ff1be599
child 141442 fa6176c9b03fb96691fd035fa73e1ba7bb795086
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 RawAtom typedef; r=jonco
js/src/builtin/RegExp.cpp
js/src/frontend/NameFunctions.cpp
js/src/jsatom.cpp
js/src/jsatom.h
js/src/jsexn.cpp
js/src/jsfun.h
js/src/jsfuninlines.h
js/src/jsreflect.cpp
js/src/vm/String.h
js/src/vm/StringBuffer.cpp
js/src/vm/StringBuffer.h
--- a/js/src/builtin/RegExp.cpp
+++ b/js/src/builtin/RegExp.cpp
@@ -195,17 +195,17 @@ EscapeNakedForwardSlashes(JSContext *cx,
             if (!sb.append('\\'))
                 return NULL;
         }
 
         if (!sb.empty() && !sb.append(*it))
             return NULL;
     }
 
-    return sb.empty() ? RawAtom(unescaped) : sb.finishAtom();
+    return sb.empty() ? (JSAtom *)unescaped : sb.finishAtom();
 }
 
 /*
  * Compile a new |RegExpShared| for the |RegExpObject|.
  *
  * Per ECMAv5 15.10.4.1, we act on combinations of (pattern, flags) as
  * arguments:
  *
--- a/js/src/frontend/NameFunctions.cpp
+++ b/js/src/frontend/NameFunctions.cpp
@@ -240,17 +240,17 @@ class NameResolver
          * other namespace are rather considered as "contributing" to the outer
          * function, so give them a contribution symbol here.
          */
         if (!buf.empty() && *(buf.end() - 1) == '/' && !buf.append("<"))
             return NULL;
         if (buf.empty())
             return NULL;
 
-        RawAtom atom = buf.finishAtom();
+        JSAtom *atom = buf.finishAtom();
         fun->setGuessedAtom(atom);
         return atom;
     }
 
     /*
      * Tests whether parents[pos] is a function call whose callee is cur.
      * This is the case for functions which do things like simply create a scope
      * for new variables and then return an anonymous function using this scope.
--- a/js/src/jsatom.cpp
+++ b/js/src/jsatom.cpp
@@ -228,106 +228,106 @@ enum OwnCharsBehavior
 };
 
 /*
  * When the jschars reside in a freshly allocated buffer the memory can be used
  * as a new JSAtom's storage without copying. The contract is that the caller no
  * longer owns the memory and this method is responsible for freeing the memory.
  */
 JS_ALWAYS_INLINE
-static RawAtom
+static JSAtom *
 AtomizeAndTakeOwnership(JSContext *cx, const jschar *tbchars, size_t length,
                            InternBehavior ib)
 {
     JS_ASSERT(tbchars[length] == 0);
 
-    if (RawAtom s = cx->runtime->staticStrings.lookup(tbchars, length)) {
+    if (JSAtom *s = cx->runtime->staticStrings.lookup(tbchars, length)) {
         js_free((void*)tbchars);
         return s;
     }
 
     /*
      * If a GC occurs at js_NewStringCopy then |p| will still have the correct
      * hash, allowing us to avoid rehashing it. Even though the hash is
      * unchanged, we need to re-lookup the table position because a last-ditch
      * GC will potentially free some table entries.
      */
     AtomSet& atoms = cx->runtime->atoms;
     AtomSet::AddPtr p = atoms.lookupForAdd(AtomHasher::Lookup(tbchars, length));
     SkipRoot skipHash(cx, &p); /* Prevent the hash from being poisoned. */
     if (p) {
-        RawAtom atom = p->asPtr();
+        JSAtom *atom = p->asPtr();
         p->setTagged(bool(ib));
         js_free((void*)tbchars);
         return atom;
     }
 
     AutoEnterAtomsCompartment ac(cx);
 
     RawFlatString flat = js_NewString<CanGC>(cx, const_cast<jschar*>(tbchars), length);
     if (!flat) {
         js_free((void*)tbchars);
         return NULL;
     }
 
-    RawAtom atom = flat->morphAtomizedStringIntoAtom();
+    JSAtom *atom = flat->morphAtomizedStringIntoAtom();
 
     if (!atoms.relookupOrAdd(p, AtomHasher::Lookup(tbchars, length),
                              AtomStateEntry(atom, bool(ib)))) {
         JS_ReportOutOfMemory(cx); /* SystemAllocPolicy does not report OOM. */
         return NULL;
     }
 
     return atom;
 }
 
 /* |tbchars| must not point into an inline or short string. */
 template <AllowGC allowGC>
 JS_ALWAYS_INLINE
-static RawAtom
+static JSAtom *
 AtomizeAndCopyChars(JSContext *cx, const jschar *tbchars, size_t length, InternBehavior ib)
 {
-    if (RawAtom s = cx->runtime->staticStrings.lookup(tbchars, length))
+    if (JSAtom *s = cx->runtime->staticStrings.lookup(tbchars, length))
          return s;
 
     /*
      * If a GC occurs at js_NewStringCopy then |p| will still have the correct
      * hash, allowing us to avoid rehashing it. Even though the hash is
      * unchanged, we need to re-lookup the table position because a last-ditch
      * GC will potentially free some table entries.
      */
 
     AtomSet& atoms = cx->runtime->atoms;
     AtomSet::AddPtr p = atoms.lookupForAdd(AtomHasher::Lookup(tbchars, length));
     SkipRoot skipHash(cx, &p); /* Prevent the hash from being poisoned. */
     if (p) {
-        RawAtom atom = p->asPtr();
+        JSAtom *atom = p->asPtr();
         p->setTagged(bool(ib));
         return atom;
     }
 
     AutoEnterAtomsCompartment ac(cx);
 
     RawFlatString flat = js_NewStringCopyN<allowGC>(cx, tbchars, length);
     if (!flat)
         return NULL;
 
-    RawAtom atom = flat->morphAtomizedStringIntoAtom();
+    JSAtom *atom = flat->morphAtomizedStringIntoAtom();
 
     if (!atoms.relookupOrAdd(p, AtomHasher::Lookup(tbchars, length),
                              AtomStateEntry(atom, bool(ib)))) {
         JS_ReportOutOfMemory(cx); /* SystemAllocPolicy does not report OOM. */
         return NULL;
     }
 
     return atom;
 }
 
 template <AllowGC allowGC>
-RawAtom
+JSAtom *
 js::AtomizeString(JSContext *cx, JSString *str, js::InternBehavior ib /* = js::DoNotInternAtom */)
 {
     if (str->isAtom()) {
         JSAtom &atom = str->asAtom();
         /* N.B. static atoms are effectively always interned. */
         if (ib != InternAtom || js::StaticStrings::isStatic(&atom))
             return &atom;
 
@@ -352,23 +352,23 @@ js::AtomizeString(JSContext *cx, JSStrin
     JSLinearString *linear = str->ensureLinear(cx);
     if (!linear)
         return NULL;
 
     JS_ASSERT(linear->length() <= JSString::MAX_LENGTH);
     return AtomizeAndCopyChars<CanGC>(cx, linear->chars(), linear->length(), ib);
 }
 
-template RawAtom
+template JSAtom *
 js::AtomizeString<CanGC>(JSContext *cx, JSString *str, js::InternBehavior ib);
 
-template RawAtom
+template JSAtom *
 js::AtomizeString<NoGC>(JSContext *cx, JSString *str, js::InternBehavior ib);
 
-RawAtom
+JSAtom *
 js::Atomize(JSContext *cx, const char *bytes, size_t length, InternBehavior ib)
 {
     CHECK_REQUEST(cx);
 
     if (!JSString::validateLength(cx, length))
         return NULL;
 
     static const unsigned ATOMIZE_BUF_MAX = 32;
@@ -388,31 +388,31 @@ js::Atomize(JSContext *cx, const char *b
 
     jschar *tbcharsZ = InflateString(cx, bytes, &length);
     if (!tbcharsZ)
         return NULL;
     return AtomizeAndTakeOwnership(cx, tbcharsZ, length, ib);
 }
 
 template <AllowGC allowGC>
-RawAtom
+JSAtom *
 js::AtomizeChars(JSContext *cx, const jschar *chars, size_t length, InternBehavior ib)
 {
     CHECK_REQUEST(cx);
 
     if (!JSString::validateLength(cx, length))
         return NULL;
 
     return AtomizeAndCopyChars<allowGC>(cx, chars, length, ib);
 }
 
-template RawAtom
+template JSAtom *
 js::AtomizeChars<CanGC>(JSContext *cx, const jschar *chars, size_t length, InternBehavior ib);
 
-template RawAtom
+template JSAtom *
 js::AtomizeChars<NoGC>(JSContext *cx, const jschar *chars, size_t length, InternBehavior ib);
 
 template <AllowGC allowGC>
 bool
 js::IndexToIdSlow(JSContext *cx, uint32_t index,
                   typename MaybeRooted<jsid, allowGC>::MutableHandleType idp)
 {
     JS_ASSERT(index > JSID_INT_MAX);
--- a/js/src/jsatom.h
+++ b/js/src/jsatom.h
@@ -18,18 +18,16 @@
 #include "jspubtd.h"
 #include "jslock.h"
 #include "jsversion.h"
 
 #include "gc/Barrier.h"
 #include "js/HashTable.h"
 #include "vm/CommonPropertyNames.h"
 
-ForwardDeclareJS(Atom);
-
 struct JSIdArray {
     int length;
     js::HeapId vector[1];    /* actually, length jsid words */
 };
 
 namespace js {
 
 JS_STATIC_ASSERT(sizeof(HashNumber) == 4);
@@ -76,17 +74,17 @@ class AtomStateEntry
 {
     uintptr_t bits;
 
     static const uintptr_t NO_TAG_MASK = uintptr_t(-1) - 1;
 
   public:
     AtomStateEntry() : bits(0) {}
     AtomStateEntry(const AtomStateEntry &other) : bits(other.bits) {}
-    AtomStateEntry(RawAtom ptr, bool tagged)
+    AtomStateEntry(JSAtom *ptr, bool tagged)
       : bits(uintptr_t(ptr) | uintptr_t(tagged))
     {
         JS_ASSERT((uintptr_t(ptr) & 0x1) == 0);
     }
 
     bool isTagged() const {
         return bits & 0x1;
     }
@@ -217,27 +215,27 @@ FinishCommonNames(JSRuntime *rt);
 
 /* N.B. must correspond to boolean tagging behavior. */
 enum InternBehavior
 {
     DoNotInternAtom = false,
     InternAtom = true
 };
 
-extern RawAtom
+extern JSAtom *
 Atomize(JSContext *cx, const char *bytes, size_t length,
         js::InternBehavior ib = js::DoNotInternAtom);
 
 template <AllowGC allowGC>
-extern RawAtom
+extern JSAtom *
 AtomizeChars(JSContext *cx, const jschar *chars, size_t length,
              js::InternBehavior ib = js::DoNotInternAtom);
 
 template <AllowGC allowGC>
-extern RawAtom
+extern JSAtom *
 AtomizeString(JSContext *cx, JSString *str, js::InternBehavior ib = js::DoNotInternAtom);
 
 template <AllowGC allowGC>
 inline JSAtom *
 ToAtom(JSContext *cx, const js::Value &v);
 
 template<XDRMode mode>
 bool
--- a/js/src/jsexn.cpp
+++ b/js/src/jsexn.cpp
@@ -267,17 +267,17 @@ InitExnPrivate(JSContext *cx, HandleObje
                 if (!checkAccess(cx, obj, callerid, JSACC_READ, &v))
                     break;
             }
 
             if (!frames.growBy(1))
                 return false;
             JSStackTraceStackElem &frame = frames.back();
             if (i.isNonEvalFunctionFrame()) {
-                RawAtom atom = i.callee()->displayAtom();
+                JSAtom *atom = i.callee()->displayAtom();
                 if (atom == NULL)
                     atom = cx->runtime->emptyString;
                 frame.funName = atom;
             } else {
                 frame.funName = NULL;
             }
             RootedScript script(cx, i.script());
             const char *cfilename = script->filename();
--- a/js/src/jsfun.h
+++ b/js/src/jsfun.h
@@ -12,18 +12,16 @@
 #include "jsprvtd.h"
 #include "jspubtd.h"
 #include "jsobj.h"
 #include "jsatom.h"
 #include "jsstr.h"
 
 #include "gc/Barrier.h"
 
-ForwardDeclareJS(Atom);
-
 namespace js { class FunctionExtended; }
 
 class JSFunction : public JSObject
 {
   public:
     enum Flags {
         INTERPRETED      = 0x0001,  /* function has a JSScript and environment. */
         NATIVE_CTOR      = 0x0002,  /* native that can be called as a constructor */
@@ -187,17 +185,17 @@ class JSFunction : public JSObject
         flags &= ~INTERPRETED_LAZY;
     }
 
     JSAtom *atom() const { return hasGuessedAtom() ? NULL : atom_.get(); }
     js::PropertyName *name() const { return hasGuessedAtom() || !atom_ ? NULL : atom_->asPropertyName(); }
     inline void initAtom(JSAtom *atom);
     JSAtom *displayAtom() const { return atom_; }
 
-    inline void setGuessedAtom(js::RawAtom atom);
+    inline void setGuessedAtom(JSAtom *atom);
 
     /* uint16_t representation bounds number of call object dynamic slots. */
     enum { MAX_ARGS_AND_VARS = 2 * ((1U << 16) - 1) };
 
     /*
      * For an interpreted function, accessors for the initial scope object of
      * activations (stack frames) of the function.
      */
--- a/js/src/jsfuninlines.h
+++ b/js/src/jsfuninlines.h
@@ -23,17 +23,17 @@ JSFunction::strict() const
 
 inline void
 JSFunction::initAtom(JSAtom *atom)
 {
     atom_.init(atom);
 }
 
 inline void
-JSFunction::setGuessedAtom(js::RawAtom atom)
+JSFunction::setGuessedAtom(JSAtom *atom)
 {
     JS_ASSERT(atom_ == NULL);
     JS_ASSERT(atom != NULL);
     JS_ASSERT(!hasGuessedAtom());
     atom_ = atom;
     flags |= HAS_GUESSED_ATOM;
 }
 
--- a/js/src/jsreflect.cpp
+++ b/js/src/jsreflect.cpp
@@ -1477,17 +1477,17 @@ NodeBuilder::function(ASTType type, Toke
  */
 class ASTSerializer
 {
     JSContext           *cx;
     Parser<FullParseHandler> *parser;
     NodeBuilder         builder;
     DebugOnly<uint32_t> lineno;
 
-    RawValue unrootedAtomContents(RawAtom atom) {
+    RawValue unrootedAtomContents(JSAtom *atom) {
         return StringValue(atom ? atom : cx->names().empty);
     }
 
     BinaryOperator binop(ParseNodeKind kind, JSOp op);
     UnaryOperator unop(ParseNodeKind kind, JSOp op);
     AssignmentOperator aop(JSOp op);
 
     bool statements(ParseNode *pn, NodeVector &elts);
--- a/js/src/vm/String.h
+++ b/js/src/vm/String.h
@@ -26,17 +26,16 @@ class JSDependentString;
 class JSUndependedString;
 class JSExtensibleString;
 class JSExternalString;
 ForwardDeclareJS(LinearString);
 class JSStableString;
 ForwardDeclareJS(InlineString);
 class JSRope;
 ForwardDeclareJS(FlatString);
-ForwardDeclareJS(Atom);
 
 namespace js {
 
 class StaticStrings;
 class PropertyName;
 
 /* The buffer length required to contain any unsigned 32-bit integer. */
 static const size_t UINT32_CHAR_BUFFER_LENGTH = sizeof("4294967295") - 1;
--- a/js/src/vm/StringBuffer.cpp
+++ b/js/src/vm/StringBuffer.cpp
@@ -61,26 +61,26 @@ StringBuffer::finishString()
         return NULL;
 
     JSFlatString *str = js_NewString<CanGC>(cx, buf, length);
     if (!str)
         js_free(buf);
     return str;
 }
 
-RawAtom
+JSAtom *
 StringBuffer::finishAtom()
 {
     JSContext *cx = context();
 
     size_t length = cb.length();
     if (length == 0)
         return cx->names().empty;
 
-    RawAtom atom = AtomizeChars<CanGC>(cx, cb.begin(), length);
+    JSAtom *atom = AtomizeChars<CanGC>(cx, cb.begin(), length);
     cb.clear();
     return atom;
 }
 
 bool
 js::ValueToStringBufferSlow(JSContext *cx, const Value &arg, StringBuffer &sb)
 {
     RootedValue v(cx, arg);
--- a/js/src/vm/StringBuffer.h
+++ b/js/src/vm/StringBuffer.h
@@ -9,17 +9,16 @@
 
 #include "mozilla/Attributes.h"
 #include "mozilla/DebugOnly.h"
 
 #include "jscntxt.h"
 
 #include "js/Vector.h"
 
-ForwardDeclareJS(Atom);
 ForwardDeclareJS(FlatString);
 
 namespace js {
 
 /*
  * String builder that eagerly checks for over-allocation past the maximum
  * string length.
  *
@@ -87,17 +86,17 @@ class StringBuffer
 
     /*
      * Creates a string from the characters in this buffer, then (regardless
      * whether string creation succeeded or failed) empties the buffer.
      */
     js::RawFlatString finishString();
 
     /* Identical to finishString() except that an atom is created. */
-    js::RawAtom finishAtom();
+    JSAtom *finishAtom();
 
     /*
      * Creates a raw string from the characters in this buffer.  The string is
      * exactly the characters in this buffer: it is *not* null-terminated
      * unless the last appended character was |(jschar)0|.
      */
     jschar *extractWellSized();
 };