Bug 1017079 - Fix obsolete comment in AtomizeAndCopyChars. r=bhackett.

This commit is contained in:
Jason Orendorff 2014-06-05 13:23:40 -04:00
parent feb5c344e3
commit 89f5b4b3cc

View File

@ -365,13 +365,6 @@ AtomizeAndCopyChars(ExclusiveContext *cx, const jschar *tbchars, size_t length,
if (pp)
return pp->asPtr();
/*
* 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.
*/
AutoLockForExclusiveAccess lock(cx);
AtomSet& atoms = cx->atoms();
@ -392,7 +385,10 @@ AtomizeAndCopyChars(ExclusiveContext *cx, const jschar *tbchars, size_t length,
JSAtom *atom = flat->morphAtomizedStringIntoAtom();
if (!atoms.relookupOrAdd(p, lookup, AtomStateEntry(atom, bool(ib)))) {
// We have held the lock since looking up p, and the operations we've done
// since then can't GC; therefore the atoms table has not been modified and
// p is still valid.
if (!atoms.add(p, AtomStateEntry(atom, bool(ib)))) {
js_ReportOutOfMemory(cx); /* SystemAllocPolicy does not report OOM. */
return nullptr;
}