Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(97)

Unified Diff: src/runtime.cc

Issue 309663005: Split Put into Put and Remove (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add assert and some comments Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/objects.cc ('k') | test/cctest/test-dictionary.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index c5b60e91d2aec12f1ac3ba354bb9982938967aec..cfd072bfbc3f69b705f1c6c1a61d7e08c0624bd1 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -1642,11 +1642,11 @@ RUNTIME_FUNCTION(Runtime_MapDelete) {
CONVERT_ARG_HANDLE_CHECKED(JSMap, holder, 0);
CONVERT_ARG_HANDLE_CHECKED(Object, key, 1);
Handle<OrderedHashMap> table(OrderedHashMap::cast(holder->table()));
- Handle<Object> lookup(table->Lookup(key), isolate);
+ bool was_present = false;
Handle<OrderedHashMap> new_table =
- OrderedHashMap::Put(table, key, isolate->factory()->the_hole_value());
+ OrderedHashMap::Remove(table, key, &was_present);
holder->set_table(*new_table);
- return isolate->heap()->ToBoolean(!lookup->IsTheHole());
+ return isolate->heap()->ToBoolean(was_present);
}
@@ -1759,11 +1759,11 @@ RUNTIME_FUNCTION(Runtime_WeakCollectionDelete) {
Handle<ObjectHashTable> table(ObjectHashTable::cast(
weak_collection->table()));
RUNTIME_ASSERT(table->IsKey(*key));
- Handle<Object> lookup(table->Lookup(key), isolate);
+ bool was_present = false;
Handle<ObjectHashTable> new_table =
- ObjectHashTable::Put(table, key, isolate->factory()->the_hole_value());
+ ObjectHashTable::Remove(table, key, &was_present);
weak_collection->set_table(*new_table);
- return isolate->heap()->ToBoolean(!lookup->IsTheHole());
+ return isolate->heap()->ToBoolean(was_present);
}
« no previous file with comments | « src/objects.cc ('k') | test/cctest/test-dictionary.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698