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

Side by Side Diff: src/runtime.cc

Issue 7754015: Implement identity hashes for proxies. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed Michael's comments. Created 9 years, 3 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-printer.cc ('k') | test/mjsunit/harmony/proxies.js » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 weakmap->set_table(*table); 678 weakmap->set_table(*table);
679 weakmap->set_next(Smi::FromInt(0)); 679 weakmap->set_next(Smi::FromInt(0));
680 return *weakmap; 680 return *weakmap;
681 } 681 }
682 682
683 683
684 RUNTIME_FUNCTION(MaybeObject*, Runtime_WeakMapGet) { 684 RUNTIME_FUNCTION(MaybeObject*, Runtime_WeakMapGet) {
685 NoHandleAllocation ha; 685 NoHandleAllocation ha;
686 ASSERT(args.length() == 2); 686 ASSERT(args.length() == 2);
687 CONVERT_ARG_CHECKED(JSWeakMap, weakmap, 0); 687 CONVERT_ARG_CHECKED(JSWeakMap, weakmap, 0);
688 // TODO(mstarzinger): Currently we cannot use JSProxy objects as keys 688 CONVERT_ARG_CHECKED(JSReceiver, key, 1);
689 // because they cannot be cast to JSObject to get an identity hash code.
690 CONVERT_ARG_CHECKED(JSObject, key, 1);
691 return weakmap->table()->Lookup(*key); 689 return weakmap->table()->Lookup(*key);
692 } 690 }
693 691
694 692
695 RUNTIME_FUNCTION(MaybeObject*, Runtime_WeakMapSet) { 693 RUNTIME_FUNCTION(MaybeObject*, Runtime_WeakMapSet) {
696 HandleScope scope(isolate); 694 HandleScope scope(isolate);
697 ASSERT(args.length() == 3); 695 ASSERT(args.length() == 3);
698 CONVERT_ARG_CHECKED(JSWeakMap, weakmap, 0); 696 CONVERT_ARG_CHECKED(JSWeakMap, weakmap, 0);
699 // TODO(mstarzinger): See Runtime_WeakMapGet above. 697 CONVERT_ARG_CHECKED(JSReceiver, key, 1);
700 CONVERT_ARG_CHECKED(JSObject, key, 1);
701 Handle<Object> value(args[2]); 698 Handle<Object> value(args[2]);
702 Handle<ObjectHashTable> table(weakmap->table()); 699 Handle<ObjectHashTable> table(weakmap->table());
703 Handle<ObjectHashTable> new_table = PutIntoObjectHashTable(table, key, value); 700 Handle<ObjectHashTable> new_table = PutIntoObjectHashTable(table, key, value);
704 weakmap->set_table(*new_table); 701 weakmap->set_table(*new_table);
705 return *value; 702 return *value;
706 } 703 }
707 704
708 705
709 RUNTIME_FUNCTION(MaybeObject*, Runtime_ClassOf) { 706 RUNTIME_FUNCTION(MaybeObject*, Runtime_ClassOf) {
710 NoHandleAllocation ha; 707 NoHandleAllocation ha;
(...skipping 12171 matching lines...) Expand 10 before | Expand all | Expand 10 after
12882 } else { 12879 } else {
12883 // Handle last resort GC and make sure to allow future allocations 12880 // Handle last resort GC and make sure to allow future allocations
12884 // to grow the heap without causing GCs (if possible). 12881 // to grow the heap without causing GCs (if possible).
12885 isolate->counters()->gc_last_resort_from_js()->Increment(); 12882 isolate->counters()->gc_last_resort_from_js()->Increment();
12886 isolate->heap()->CollectAllGarbage(false); 12883 isolate->heap()->CollectAllGarbage(false);
12887 } 12884 }
12888 } 12885 }
12889 12886
12890 12887
12891 } } // namespace v8::internal 12888 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects-printer.cc ('k') | test/mjsunit/harmony/proxies.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698