Bug 390348: pinning of JSAtomState.emptyAtom is restored. r=brendan
authorigor@mir2.org
Thu, 02 Aug 2007 02:28:25 -0700
changeset 4152 30937af3a0f92c63a43ac0a92dd30a7c5052a854
parent 4151 ace1b41a4e82e8ab38e947243d8925a1da814aa9
child 4153 8c565d01c37098ce1a1f82d8157d205b7c9359ee
push id1
push userbsmedberg@mozilla.com
push dateThu, 20 Mar 2008 16:49:24 +0000
treeherdermozilla-central@61007906a1f8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbrendan
bugs390348
milestone1.9a7pre
Bug 390348: pinning of JSAtomState.emptyAtom is restored. r=brendan
js/src/jsatom.c
--- a/js/src/jsatom.c
+++ b/js/src/jsatom.c
@@ -274,39 +274,29 @@ js_InitAtomState(JSContext *cx, JSAtomSt
 
     if (!js_InitPinnedAtoms(cx, state)) {
         js_FreeAtomState(cx, state);
         return JS_FALSE;
     }
     return JS_TRUE;
 }
 
-static JSAtom *
-AtomizeHashedKey(JSContext *cx, jsval key, JSHashNumber keyHash);
-
 JSBool
 js_InitPinnedAtoms(JSContext *cx, JSAtomState *state)
 {
-    JSString *empty;
     uintN i;
 
-    empty = js_NewStringCopyN(cx, js_empty_ucstr, 0);
-    if (!empty)
-        return JS_FALSE;
-    JS_ASSERT(js_HashString(empty) == 0);
-    state->emptyAtom = AtomizeHashedKey(cx, STRING_TO_JSVAL(empty), 0);
-    if (!state->emptyAtom)
-        return JS_FALSE;
-
 #define FROB(lval,str)                                                        \
     JS_BEGIN_MACRO                                                            \
         if (!(state->lval = js_Atomize(cx, str, strlen(str), ATOM_PINNED)))   \
             return JS_FALSE;                                                  \
     JS_END_MACRO
 
+    FROB(emptyAtom,               "");
+
     for (i = 0; i < JSTYPE_LIMIT; i++)
         FROB(typeAtoms[i],        js_type_strs[i]);
 
     for (i = 0; i < JSProto_LIMIT; i++)
         FROB(classAtoms[i],       js_proto_strs[i]);
 
     FROB(booleanAtoms[0],         js_false_str);
     FROB(booleanAtoms[1],         js_true_str);