Bug 866789 - GC: Fix some more shell rooting hazards r=terrence
This commit is contained in:
@@ -250,8 +250,8 @@ AtomizeAndTakeOwnership(JSContext *cx, const jschar *tbchars, size_t length,
|
||||
* unchanged, we need to re-lookup the table position because a last-ditch
|
||||
* GC will potentially free some table entries.
|
||||
*/
|
||||
AtomHasher::Lookup lookup(tbchars, length);
|
||||
AtomSet::AddPtr p = cx->runtime->atoms.lookupForAdd(lookup);
|
||||
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();
|
||||
@@ -270,7 +270,8 @@ AtomizeAndTakeOwnership(JSContext *cx, const jschar *tbchars, size_t length,
|
||||
|
||||
RawAtom atom = flat->morphAtomizedStringIntoAtom();
|
||||
|
||||
if (!cx->runtime->atoms.relookupOrAdd(p, lookup, AtomStateEntry(atom, bool(ib)))) {
|
||||
if (!atoms.relookupOrAdd(p, AtomHasher::Lookup(tbchars, length),
|
||||
AtomStateEntry(atom, bool(ib)))) {
|
||||
JS_ReportOutOfMemory(cx); /* SystemAllocPolicy does not report OOM. */
|
||||
return NULL;
|
||||
}
|
||||
@@ -293,8 +294,9 @@ AtomizeAndCopyChars(JSContext *cx, const jschar *tbchars, size_t length, InternB
|
||||
* unchanged, we need to re-lookup the table position because a last-ditch
|
||||
* GC will potentially free some table entries.
|
||||
*/
|
||||
AtomHasher::Lookup lookup(tbchars, length);
|
||||
AtomSet::AddPtr p = cx->runtime->atoms.lookupForAdd(lookup);
|
||||
|
||||
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();
|
||||
@@ -310,7 +312,8 @@ AtomizeAndCopyChars(JSContext *cx, const jschar *tbchars, size_t length, InternB
|
||||
|
||||
RawAtom atom = flat->morphAtomizedStringIntoAtom();
|
||||
|
||||
if (!cx->runtime->atoms.relookupOrAdd(p, lookup, AtomStateEntry(atom, bool(ib)))) {
|
||||
if (!atoms.relookupOrAdd(p, AtomHasher::Lookup(tbchars, length),
|
||||
AtomStateEntry(atom, bool(ib)))) {
|
||||
JS_ReportOutOfMemory(cx); /* SystemAllocPolicy does not report OOM. */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user