From the Harmony draft:
https://people.mozilla.org/~jorendorff/es6-draft.html#sec-map.prototype.set
https://people.mozilla.org/~jorendorff/es6-draft.html#sec-weakmap.prototype.set
https://people.mozilla.org/~jorendorff/es6-draft.html#sec-set.prototype.add
https://people.mozilla.org/~jorendorff/es6-draft.html#sec-weakset.prototype.add
BUG=v8:3410
R=arv@chromium.org, rossberg@chromium.org
Review URL: https://codereview.chromium.org/
359173002
Patch from caitp <caitpotter88@gmail.com>.
git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22111
ce2b1a6d-e550-0410-aec6-
3dcde31c8c00
Handle<OrderedHashSet> table(OrderedHashSet::cast(holder->table()));
table = OrderedHashSet::Add(table, key);
holder->set_table(*table);
- return isolate->heap()->undefined_value();
+ return *holder;
}
Handle<OrderedHashMap> table(OrderedHashMap::cast(holder->table()));
Handle<OrderedHashMap> new_table = OrderedHashMap::Put(table, key, value);
holder->set_table(*new_table);
- return isolate->heap()->undefined_value();
+ return *holder;
}
RUNTIME_ASSERT(table->IsKey(*key));
Handle<ObjectHashTable> new_table = ObjectHashTable::Put(table, key, value);
weak_collection->set_table(*new_table);
- return isolate->heap()->undefined_value();
+ return *weak_collection;
}
// Test expected behavior for WeakSets
function TestSet(set, key) {
assertFalse(set.has(key));
- assertSame(undefined, set.add(key));
+ assertSame(set, set.add(key));
assertTrue(set.has(key));
assertTrue(set.delete(key));
assertFalse(set.has(key));
// Test expected mapping behavior for WeakMaps
function TestMapping(map, key, value) {
- assertSame(undefined, map.set(key, value));
+ assertSame(map, map.set(key, value));
assertSame(value, map.get(key));
}
function TestMapBehavior1(m) {
// Test expected behavior for Sets and WeakSets
function TestSet(set, key) {
assertFalse(set.has(key));
- assertSame(undefined, set.add(key));
+ assertSame(set, set.add(key));
assertTrue(set.has(key));
assertTrue(set.delete(key));
assertFalse(set.has(key));
// Test expected mapping behavior for Maps and WeakMaps
function TestMapping(map, key, value) {
- assertSame(undefined, map.set(key, value));
+ assertSame(map, map.set(key, value));
assertSame(value, map.get(key));
}
function TestMapBehavior1(m) {