Bug 1024250; r=billm

This commit is contained in:
Terrence Cole
2014-07-28 10:16:56 -07:00
parent c630ab1475
commit 86c8e4f12a
16 changed files with 148 additions and 78 deletions

View File

@@ -271,10 +271,6 @@ WeakMap_get_impl(JSContext *cx, CallArgs args)
if (ObjectValueMap *map = args.thisv().toObject().as<WeakMapObject>().getMap()) {
if (ObjectValueMap::Ptr ptr = map->lookup(key)) {
// Read barrier to prevent an incorrectly gray value from escaping the
// weak map. See the comment before UnmarkGrayChildren in gc/Marking.cpp
ExposeValueToActiveJS(ptr->value().get());
args.rval().set(ptr->value());
return true;
}
@@ -450,6 +446,7 @@ JS_NondeterministicGetWeakMapKeys(JSContext *cx, HandleObject objArg, MutableHan
// Prevent GC from mutating the weakmap while iterating.
AutoSuppressGC suppress(cx);
for (ObjectValueMap::Base::Range r = map->all(); !r.empty(); r.popFront()) {
JS::ExposeObjectToActiveJS(r.front().key());
RootedObject key(cx, r.front().key());
if (!cx->compartment()->wrap(cx, &key))
return false;