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

Side by Side Diff: src/runtime.cc

Issue 256743008: OrderedHashMap::Lookup() and ObjectHashTable::Lookup() handlified. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebasing 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.cc ('k') | test/cctest/test-dictionary.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 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 1594 matching lines...) Expand 10 before | Expand all | Expand 10 after
1605 return *holder; 1605 return *holder;
1606 } 1606 }
1607 1607
1608 1608
1609 RUNTIME_FUNCTION(Runtime_MapGet) { 1609 RUNTIME_FUNCTION(Runtime_MapGet) {
1610 HandleScope scope(isolate); 1610 HandleScope scope(isolate);
1611 ASSERT(args.length() == 2); 1611 ASSERT(args.length() == 2);
1612 CONVERT_ARG_HANDLE_CHECKED(JSMap, holder, 0); 1612 CONVERT_ARG_HANDLE_CHECKED(JSMap, holder, 0);
1613 CONVERT_ARG_HANDLE_CHECKED(Object, key, 1); 1613 CONVERT_ARG_HANDLE_CHECKED(Object, key, 1);
1614 Handle<OrderedHashMap> table(OrderedHashMap::cast(holder->table())); 1614 Handle<OrderedHashMap> table(OrderedHashMap::cast(holder->table()));
1615 Handle<Object> lookup(table->Lookup(*key), isolate); 1615 Handle<Object> lookup(table->Lookup(key), isolate);
1616 return lookup->IsTheHole() ? isolate->heap()->undefined_value() : *lookup; 1616 return lookup->IsTheHole() ? isolate->heap()->undefined_value() : *lookup;
1617 } 1617 }
1618 1618
1619 1619
1620 RUNTIME_FUNCTION(Runtime_MapHas) { 1620 RUNTIME_FUNCTION(Runtime_MapHas) {
1621 HandleScope scope(isolate); 1621 HandleScope scope(isolate);
1622 ASSERT(args.length() == 2); 1622 ASSERT(args.length() == 2);
1623 CONVERT_ARG_HANDLE_CHECKED(JSMap, holder, 0); 1623 CONVERT_ARG_HANDLE_CHECKED(JSMap, holder, 0);
1624 CONVERT_ARG_HANDLE_CHECKED(Object, key, 1); 1624 CONVERT_ARG_HANDLE_CHECKED(Object, key, 1);
1625 Handle<OrderedHashMap> table(OrderedHashMap::cast(holder->table())); 1625 Handle<OrderedHashMap> table(OrderedHashMap::cast(holder->table()));
1626 Handle<Object> lookup(table->Lookup(*key), isolate); 1626 Handle<Object> lookup(table->Lookup(key), isolate);
1627 return isolate->heap()->ToBoolean(!lookup->IsTheHole()); 1627 return isolate->heap()->ToBoolean(!lookup->IsTheHole());
1628 } 1628 }
1629 1629
1630 1630
1631 RUNTIME_FUNCTION(Runtime_MapDelete) { 1631 RUNTIME_FUNCTION(Runtime_MapDelete) {
1632 HandleScope scope(isolate); 1632 HandleScope scope(isolate);
1633 ASSERT(args.length() == 2); 1633 ASSERT(args.length() == 2);
1634 CONVERT_ARG_HANDLE_CHECKED(JSMap, holder, 0); 1634 CONVERT_ARG_HANDLE_CHECKED(JSMap, holder, 0);
1635 CONVERT_ARG_HANDLE_CHECKED(Object, key, 1); 1635 CONVERT_ARG_HANDLE_CHECKED(Object, key, 1);
1636 Handle<OrderedHashMap> table(OrderedHashMap::cast(holder->table())); 1636 Handle<OrderedHashMap> table(OrderedHashMap::cast(holder->table()));
1637 Handle<Object> lookup(table->Lookup(*key), isolate); 1637 Handle<Object> lookup(table->Lookup(key), isolate);
1638 Handle<OrderedHashMap> new_table = 1638 Handle<OrderedHashMap> new_table =
1639 OrderedHashMap::Put(table, key, isolate->factory()->the_hole_value()); 1639 OrderedHashMap::Put(table, key, isolate->factory()->the_hole_value());
1640 holder->set_table(*new_table); 1640 holder->set_table(*new_table);
1641 return isolate->heap()->ToBoolean(!lookup->IsTheHole()); 1641 return isolate->heap()->ToBoolean(!lookup->IsTheHole());
1642 } 1642 }
1643 1643
1644 1644
1645 RUNTIME_FUNCTION(Runtime_MapClear) { 1645 RUNTIME_FUNCTION(Runtime_MapClear) {
1646 HandleScope scope(isolate); 1646 HandleScope scope(isolate);
1647 ASSERT(args.length() == 1); 1647 ASSERT(args.length() == 1);
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
1724 } 1724 }
1725 1725
1726 1726
1727 RUNTIME_FUNCTION(Runtime_WeakCollectionGet) { 1727 RUNTIME_FUNCTION(Runtime_WeakCollectionGet) {
1728 HandleScope scope(isolate); 1728 HandleScope scope(isolate);
1729 ASSERT(args.length() == 2); 1729 ASSERT(args.length() == 2);
1730 CONVERT_ARG_HANDLE_CHECKED(JSWeakCollection, weak_collection, 0); 1730 CONVERT_ARG_HANDLE_CHECKED(JSWeakCollection, weak_collection, 0);
1731 CONVERT_ARG_HANDLE_CHECKED(Object, key, 1); 1731 CONVERT_ARG_HANDLE_CHECKED(Object, key, 1);
1732 Handle<ObjectHashTable> table( 1732 Handle<ObjectHashTable> table(
1733 ObjectHashTable::cast(weak_collection->table())); 1733 ObjectHashTable::cast(weak_collection->table()));
1734 Handle<Object> lookup(table->Lookup(*key), isolate); 1734 Handle<Object> lookup(table->Lookup(key), isolate);
1735 return lookup->IsTheHole() ? isolate->heap()->undefined_value() : *lookup; 1735 return lookup->IsTheHole() ? isolate->heap()->undefined_value() : *lookup;
1736 } 1736 }
1737 1737
1738 1738
1739 RUNTIME_FUNCTION(Runtime_WeakCollectionHas) { 1739 RUNTIME_FUNCTION(Runtime_WeakCollectionHas) {
1740 HandleScope scope(isolate); 1740 HandleScope scope(isolate);
1741 ASSERT(args.length() == 2); 1741 ASSERT(args.length() == 2);
1742 CONVERT_ARG_HANDLE_CHECKED(JSWeakCollection, weak_collection, 0); 1742 CONVERT_ARG_HANDLE_CHECKED(JSWeakCollection, weak_collection, 0);
1743 CONVERT_ARG_HANDLE_CHECKED(Object, key, 1); 1743 CONVERT_ARG_HANDLE_CHECKED(Object, key, 1);
1744 Handle<ObjectHashTable> table( 1744 Handle<ObjectHashTable> table(
1745 ObjectHashTable::cast(weak_collection->table())); 1745 ObjectHashTable::cast(weak_collection->table()));
1746 Handle<Object> lookup(table->Lookup(*key), isolate); 1746 Handle<Object> lookup(table->Lookup(key), isolate);
1747 return isolate->heap()->ToBoolean(!lookup->IsTheHole()); 1747 return isolate->heap()->ToBoolean(!lookup->IsTheHole());
1748 } 1748 }
1749 1749
1750 1750
1751 RUNTIME_FUNCTION(Runtime_WeakCollectionDelete) { 1751 RUNTIME_FUNCTION(Runtime_WeakCollectionDelete) {
1752 HandleScope scope(isolate); 1752 HandleScope scope(isolate);
1753 ASSERT(args.length() == 2); 1753 ASSERT(args.length() == 2);
1754 CONVERT_ARG_HANDLE_CHECKED(JSWeakCollection, weak_collection, 0); 1754 CONVERT_ARG_HANDLE_CHECKED(JSWeakCollection, weak_collection, 0);
1755 CONVERT_ARG_HANDLE_CHECKED(Object, key, 1); 1755 CONVERT_ARG_HANDLE_CHECKED(Object, key, 1);
1756 Handle<ObjectHashTable> table(ObjectHashTable::cast( 1756 Handle<ObjectHashTable> table(ObjectHashTable::cast(
1757 weak_collection->table())); 1757 weak_collection->table()));
1758 Handle<Object> lookup(table->Lookup(*key), isolate); 1758 Handle<Object> lookup(table->Lookup(key), isolate);
1759 Handle<ObjectHashTable> new_table = 1759 Handle<ObjectHashTable> new_table =
1760 ObjectHashTable::Put(table, key, isolate->factory()->the_hole_value()); 1760 ObjectHashTable::Put(table, key, isolate->factory()->the_hole_value());
1761 weak_collection->set_table(*new_table); 1761 weak_collection->set_table(*new_table);
1762 return isolate->heap()->ToBoolean(!lookup->IsTheHole()); 1762 return isolate->heap()->ToBoolean(!lookup->IsTheHole());
1763 } 1763 }
1764 1764
1765 1765
1766 RUNTIME_FUNCTION(Runtime_WeakCollectionSet) { 1766 RUNTIME_FUNCTION(Runtime_WeakCollectionSet) {
1767 HandleScope scope(isolate); 1767 HandleScope scope(isolate);
1768 ASSERT(args.length() == 3); 1768 ASSERT(args.length() == 3);
(...skipping 13368 matching lines...) Expand 10 before | Expand all | Expand 10 after
15137 } 15137 }
15138 return NULL; 15138 return NULL;
15139 } 15139 }
15140 15140
15141 15141
15142 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { 15142 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) {
15143 return &(kIntrinsicFunctions[static_cast<int>(id)]); 15143 return &(kIntrinsicFunctions[static_cast<int>(id)]);
15144 } 15144 }
15145 15145
15146 } } // namespace v8::internal 15146 } } // namespace v8::internal
OLDNEW
« 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