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

Side by Side Diff: src/objects.cc

Issue 290733008: Teach OrderedHashSet::Remove to report whether it actually removed anything (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/objects.h ('k') | src/runtime.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "v8.h" 5 #include "v8.h"
6 6
7 #include "accessors.h" 7 #include "accessors.h"
8 #include "allocation-site-scopes.h" 8 #include "allocation-site-scopes.h"
9 #include "api.h" 9 #include "api.h"
10 #include "arguments.h" 10 #include "arguments.h"
(...skipping 16438 matching lines...) Expand 10 before | Expand all | Expand 10 after
16449 table = EnsureGrowable(table); 16449 table = EnsureGrowable(table);
16450 16450
16451 Handle<Smi> hash = GetOrCreateHash(table->GetIsolate(), key); 16451 Handle<Smi> hash = GetOrCreateHash(table->GetIsolate(), key);
16452 int index = table->AddEntry(hash->value()); 16452 int index = table->AddEntry(hash->value());
16453 table->set(index, *key); 16453 table->set(index, *key);
16454 return table; 16454 return table;
16455 } 16455 }
16456 16456
16457 16457
16458 Handle<OrderedHashSet> OrderedHashSet::Remove(Handle<OrderedHashSet> table, 16458 Handle<OrderedHashSet> OrderedHashSet::Remove(Handle<OrderedHashSet> table,
16459 Handle<Object> key) { 16459 Handle<Object> key,
16460 bool* was_present) {
16460 int entry = table->FindEntry(key); 16461 int entry = table->FindEntry(key);
16461 if (entry == kNotFound) return table; 16462 if (entry == kNotFound) {
16463 *was_present = false;
16464 return table;
16465 }
16466 *was_present = true;
16462 table->RemoveEntry(entry); 16467 table->RemoveEntry(entry);
16463 return Shrink(table); 16468 return Shrink(table);
16464 } 16469 }
16465 16470
16466 16471
16467 Object* OrderedHashMap::Lookup(Handle<Object> key) { 16472 Object* OrderedHashMap::Lookup(Handle<Object> key) {
16468 DisallowHeapAllocation no_gc; 16473 DisallowHeapAllocation no_gc;
16469 int entry = FindEntry(key); 16474 int entry = FindEntry(key);
16470 if (entry == kNotFound) return GetHeap()->the_hole_value(); 16475 if (entry == kNotFound) return GetHeap()->the_hole_value();
16471 return ValueAt(entry); 16476 return ValueAt(entry);
(...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after
17247 #define ERROR_MESSAGES_TEXTS(C, T) T, 17252 #define ERROR_MESSAGES_TEXTS(C, T) T,
17248 static const char* error_messages_[] = { 17253 static const char* error_messages_[] = {
17249 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) 17254 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS)
17250 }; 17255 };
17251 #undef ERROR_MESSAGES_TEXTS 17256 #undef ERROR_MESSAGES_TEXTS
17252 return error_messages_[reason]; 17257 return error_messages_[reason];
17253 } 17258 }
17254 17259
17255 17260
17256 } } // namespace v8::internal 17261 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698