OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |