Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 <stdlib.h> | 5 #include <stdlib.h> |
| 6 #include <limits> | 6 #include <limits> |
| 7 | 7 |
| 8 #include "v8.h" | 8 #include "v8.h" |
| 9 | 9 |
| 10 #include "accessors.h" | 10 #include "accessors.h" |
| (...skipping 1625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1636 } | 1636 } |
| 1637 | 1637 |
| 1638 | 1638 |
| 1639 RUNTIME_FUNCTION(Runtime_MapDelete) { | 1639 RUNTIME_FUNCTION(Runtime_MapDelete) { |
| 1640 HandleScope scope(isolate); | 1640 HandleScope scope(isolate); |
| 1641 ASSERT(args.length() == 2); | 1641 ASSERT(args.length() == 2); |
| 1642 CONVERT_ARG_HANDLE_CHECKED(JSMap, holder, 0); | 1642 CONVERT_ARG_HANDLE_CHECKED(JSMap, holder, 0); |
| 1643 CONVERT_ARG_HANDLE_CHECKED(Object, key, 1); | 1643 CONVERT_ARG_HANDLE_CHECKED(Object, key, 1); |
| 1644 Handle<OrderedHashMap> table(OrderedHashMap::cast(holder->table())); | 1644 Handle<OrderedHashMap> table(OrderedHashMap::cast(holder->table())); |
| 1645 Handle<Object> lookup(table->Lookup(key), isolate); | 1645 Handle<Object> lookup(table->Lookup(key), isolate); |
| 1646 Handle<OrderedHashMap> new_table = | 1646 Handle<OrderedHashMap> new_table = OrderedHashMap::Remove(table, key); |
|
adamk
2014/05/30 20:13:58
You probably want to use the was_present version h
arv (Not doing code reviews)
2014/05/30 20:53:07
Done.
| |
| 1647 OrderedHashMap::Put(table, key, isolate->factory()->the_hole_value()); | |
| 1648 holder->set_table(*new_table); | 1647 holder->set_table(*new_table); |
| 1649 return isolate->heap()->ToBoolean(!lookup->IsTheHole()); | 1648 return isolate->heap()->ToBoolean(!lookup->IsTheHole()); |
| 1650 } | 1649 } |
| 1651 | 1650 |
| 1652 | 1651 |
| 1653 RUNTIME_FUNCTION(Runtime_MapClear) { | 1652 RUNTIME_FUNCTION(Runtime_MapClear) { |
| 1654 HandleScope scope(isolate); | 1653 HandleScope scope(isolate); |
| 1655 ASSERT(args.length() == 1); | 1654 ASSERT(args.length() == 1); |
| 1656 CONVERT_ARG_HANDLE_CHECKED(JSMap, holder, 0); | 1655 CONVERT_ARG_HANDLE_CHECKED(JSMap, holder, 0); |
| 1657 Handle<OrderedHashMap> table(OrderedHashMap::cast(holder->table())); | 1656 Handle<OrderedHashMap> table(OrderedHashMap::cast(holder->table())); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1753 RUNTIME_FUNCTION(Runtime_WeakCollectionDelete) { | 1752 RUNTIME_FUNCTION(Runtime_WeakCollectionDelete) { |
| 1754 HandleScope scope(isolate); | 1753 HandleScope scope(isolate); |
| 1755 ASSERT(args.length() == 2); | 1754 ASSERT(args.length() == 2); |
| 1756 CONVERT_ARG_HANDLE_CHECKED(JSWeakCollection, weak_collection, 0); | 1755 CONVERT_ARG_HANDLE_CHECKED(JSWeakCollection, weak_collection, 0); |
| 1757 CONVERT_ARG_HANDLE_CHECKED(Object, key, 1); | 1756 CONVERT_ARG_HANDLE_CHECKED(Object, key, 1); |
| 1758 RUNTIME_ASSERT(key->IsJSReceiver() || key->IsSymbol()); | 1757 RUNTIME_ASSERT(key->IsJSReceiver() || key->IsSymbol()); |
| 1759 Handle<ObjectHashTable> table(ObjectHashTable::cast( | 1758 Handle<ObjectHashTable> table(ObjectHashTable::cast( |
| 1760 weak_collection->table())); | 1759 weak_collection->table())); |
| 1761 RUNTIME_ASSERT(table->IsKey(*key)); | 1760 RUNTIME_ASSERT(table->IsKey(*key)); |
| 1762 Handle<Object> lookup(table->Lookup(key), isolate); | 1761 Handle<Object> lookup(table->Lookup(key), isolate); |
| 1763 Handle<ObjectHashTable> new_table = | 1762 Handle<ObjectHashTable> new_table = ObjectHashTable::Remove(table, key); |
| 1764 ObjectHashTable::Put(table, key, isolate->factory()->the_hole_value()); | |
| 1765 weak_collection->set_table(*new_table); | 1763 weak_collection->set_table(*new_table); |
| 1766 return isolate->heap()->ToBoolean(!lookup->IsTheHole()); | 1764 return isolate->heap()->ToBoolean(!lookup->IsTheHole()); |
| 1767 } | 1765 } |
| 1768 | 1766 |
| 1769 | 1767 |
| 1770 RUNTIME_FUNCTION(Runtime_WeakCollectionSet) { | 1768 RUNTIME_FUNCTION(Runtime_WeakCollectionSet) { |
| 1771 HandleScope scope(isolate); | 1769 HandleScope scope(isolate); |
| 1772 ASSERT(args.length() == 3); | 1770 ASSERT(args.length() == 3); |
| 1773 CONVERT_ARG_HANDLE_CHECKED(JSWeakCollection, weak_collection, 0); | 1771 CONVERT_ARG_HANDLE_CHECKED(JSWeakCollection, weak_collection, 0); |
| 1774 CONVERT_ARG_HANDLE_CHECKED(Object, key, 1); | 1772 CONVERT_ARG_HANDLE_CHECKED(Object, key, 1); |
| (...skipping 13383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 15158 } | 15156 } |
| 15159 return NULL; | 15157 return NULL; |
| 15160 } | 15158 } |
| 15161 | 15159 |
| 15162 | 15160 |
| 15163 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { | 15161 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { |
| 15164 return &(kIntrinsicFunctions[static_cast<int>(id)]); | 15162 return &(kIntrinsicFunctions[static_cast<int>(id)]); |
| 15165 } | 15163 } |
| 15166 | 15164 |
| 15167 } } // namespace v8::internal | 15165 } } // namespace v8::internal |
| OLD | NEW |