OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
747 | 747 |
748 | 748 |
749 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetAdd) { | 749 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetAdd) { |
750 HandleScope scope(isolate); | 750 HandleScope scope(isolate); |
751 ASSERT(args.length() == 2); | 751 ASSERT(args.length() == 2); |
752 CONVERT_ARG_HANDLE_CHECKED(JSSet, holder, 0); | 752 CONVERT_ARG_HANDLE_CHECKED(JSSet, holder, 0); |
753 Handle<Object> key(args[1]); | 753 Handle<Object> key(args[1]); |
754 Handle<ObjectHashSet> table(ObjectHashSet::cast(holder->table())); | 754 Handle<ObjectHashSet> table(ObjectHashSet::cast(holder->table())); |
755 table = ObjectHashSetAdd(table, key); | 755 table = ObjectHashSetAdd(table, key); |
756 holder->set_table(*table); | 756 holder->set_table(*table); |
757 return isolate->heap()->undefined_symbol(); | 757 return isolate->heap()->undefined_value(); |
rossberg
2012/06/19 15:16:49
Oops! :)
| |
758 } | 758 } |
759 | 759 |
760 | 760 |
761 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetHas) { | 761 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetHas) { |
762 HandleScope scope(isolate); | 762 HandleScope scope(isolate); |
763 ASSERT(args.length() == 2); | 763 ASSERT(args.length() == 2); |
764 CONVERT_ARG_HANDLE_CHECKED(JSSet, holder, 0); | 764 CONVERT_ARG_HANDLE_CHECKED(JSSet, holder, 0); |
765 Handle<Object> key(args[1]); | 765 Handle<Object> key(args[1]); |
766 Handle<ObjectHashSet> table(ObjectHashSet::cast(holder->table())); | 766 Handle<ObjectHashSet> table(ObjectHashSet::cast(holder->table())); |
767 return isolate->heap()->ToBoolean(table->Contains(*key)); | 767 return isolate->heap()->ToBoolean(table->Contains(*key)); |
768 } | 768 } |
769 | 769 |
770 | 770 |
771 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetDelete) { | 771 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetDelete) { |
772 HandleScope scope(isolate); | 772 HandleScope scope(isolate); |
773 ASSERT(args.length() == 2); | 773 ASSERT(args.length() == 2); |
774 CONVERT_ARG_HANDLE_CHECKED(JSSet, holder, 0); | 774 CONVERT_ARG_HANDLE_CHECKED(JSSet, holder, 0); |
775 Handle<Object> key(args[1]); | 775 Handle<Object> key(args[1]); |
776 Handle<ObjectHashSet> table(ObjectHashSet::cast(holder->table())); | 776 Handle<ObjectHashSet> table(ObjectHashSet::cast(holder->table())); |
777 table = ObjectHashSetRemove(table, key); | 777 table = ObjectHashSetRemove(table, key); |
778 holder->set_table(*table); | 778 holder->set_table(*table); |
779 return isolate->heap()->undefined_symbol(); | 779 return isolate->heap()->undefined_value(); |
780 } | 780 } |
781 | 781 |
782 | 782 |
783 RUNTIME_FUNCTION(MaybeObject*, Runtime_MapInitialize) { | 783 RUNTIME_FUNCTION(MaybeObject*, Runtime_MapInitialize) { |
784 HandleScope scope(isolate); | 784 HandleScope scope(isolate); |
785 ASSERT(args.length() == 1); | 785 ASSERT(args.length() == 1); |
786 CONVERT_ARG_HANDLE_CHECKED(JSMap, holder, 0); | 786 CONVERT_ARG_HANDLE_CHECKED(JSMap, holder, 0); |
787 Handle<ObjectHashTable> table = isolate->factory()->NewObjectHashTable(0); | 787 Handle<ObjectHashTable> table = isolate->factory()->NewObjectHashTable(0); |
788 holder->set_table(*table); | 788 holder->set_table(*table); |
789 return *holder; | 789 return *holder; |
(...skipping 11 matching lines...) Expand all Loading... | |
801 | 801 |
802 RUNTIME_FUNCTION(MaybeObject*, Runtime_MapSet) { | 802 RUNTIME_FUNCTION(MaybeObject*, Runtime_MapSet) { |
803 HandleScope scope(isolate); | 803 HandleScope scope(isolate); |
804 ASSERT(args.length() == 3); | 804 ASSERT(args.length() == 3); |
805 CONVERT_ARG_HANDLE_CHECKED(JSMap, holder, 0); | 805 CONVERT_ARG_HANDLE_CHECKED(JSMap, holder, 0); |
806 Handle<Object> key(args[1]); | 806 Handle<Object> key(args[1]); |
807 Handle<Object> value(args[2]); | 807 Handle<Object> value(args[2]); |
808 Handle<ObjectHashTable> table(ObjectHashTable::cast(holder->table())); | 808 Handle<ObjectHashTable> table(ObjectHashTable::cast(holder->table())); |
809 Handle<ObjectHashTable> new_table = PutIntoObjectHashTable(table, key, value); | 809 Handle<ObjectHashTable> new_table = PutIntoObjectHashTable(table, key, value); |
810 holder->set_table(*new_table); | 810 holder->set_table(*new_table); |
811 return *value; | 811 return isolate->heap()->undefined_value(); |
812 } | 812 } |
813 | 813 |
814 | 814 |
815 RUNTIME_FUNCTION(MaybeObject*, Runtime_WeakMapInitialize) { | 815 RUNTIME_FUNCTION(MaybeObject*, Runtime_WeakMapInitialize) { |
816 HandleScope scope(isolate); | 816 HandleScope scope(isolate); |
817 ASSERT(args.length() == 1); | 817 ASSERT(args.length() == 1); |
818 CONVERT_ARG_HANDLE_CHECKED(JSWeakMap, weakmap, 0); | 818 CONVERT_ARG_HANDLE_CHECKED(JSWeakMap, weakmap, 0); |
819 ASSERT(weakmap->map()->inobject_properties() == 0); | 819 ASSERT(weakmap->map()->inobject_properties() == 0); |
820 Handle<ObjectHashTable> table = isolate->factory()->NewObjectHashTable(0); | 820 Handle<ObjectHashTable> table = isolate->factory()->NewObjectHashTable(0); |
821 weakmap->set_table(*table); | 821 weakmap->set_table(*table); |
(...skipping 13 matching lines...) Expand all Loading... | |
835 | 835 |
836 RUNTIME_FUNCTION(MaybeObject*, Runtime_WeakMapSet) { | 836 RUNTIME_FUNCTION(MaybeObject*, Runtime_WeakMapSet) { |
837 HandleScope scope(isolate); | 837 HandleScope scope(isolate); |
838 ASSERT(args.length() == 3); | 838 ASSERT(args.length() == 3); |
839 CONVERT_ARG_HANDLE_CHECKED(JSWeakMap, weakmap, 0); | 839 CONVERT_ARG_HANDLE_CHECKED(JSWeakMap, weakmap, 0); |
840 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, key, 1); | 840 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, key, 1); |
841 Handle<Object> value(args[2]); | 841 Handle<Object> value(args[2]); |
842 Handle<ObjectHashTable> table(ObjectHashTable::cast(weakmap->table())); | 842 Handle<ObjectHashTable> table(ObjectHashTable::cast(weakmap->table())); |
843 Handle<ObjectHashTable> new_table = PutIntoObjectHashTable(table, key, value); | 843 Handle<ObjectHashTable> new_table = PutIntoObjectHashTable(table, key, value); |
844 weakmap->set_table(*new_table); | 844 weakmap->set_table(*new_table); |
845 return *value; | 845 return isolate->heap()->undefined_value(); |
846 } | 846 } |
847 | 847 |
848 | 848 |
849 RUNTIME_FUNCTION(MaybeObject*, Runtime_ClassOf) { | 849 RUNTIME_FUNCTION(MaybeObject*, Runtime_ClassOf) { |
850 NoHandleAllocation ha; | 850 NoHandleAllocation ha; |
851 ASSERT(args.length() == 1); | 851 ASSERT(args.length() == 1); |
852 Object* obj = args[0]; | 852 Object* obj = args[0]; |
853 if (!obj->IsJSObject()) return isolate->heap()->null_value(); | 853 if (!obj->IsJSObject()) return isolate->heap()->null_value(); |
854 return JSObject::cast(obj)->class_name(); | 854 return JSObject::cast(obj)->class_name(); |
855 } | 855 } |
(...skipping 12790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
13646 // Handle last resort GC and make sure to allow future allocations | 13646 // Handle last resort GC and make sure to allow future allocations |
13647 // to grow the heap without causing GCs (if possible). | 13647 // to grow the heap without causing GCs (if possible). |
13648 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13648 isolate->counters()->gc_last_resort_from_js()->Increment(); |
13649 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 13649 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
13650 "Runtime::PerformGC"); | 13650 "Runtime::PerformGC"); |
13651 } | 13651 } |
13652 } | 13652 } |
13653 | 13653 |
13654 | 13654 |
13655 } } // namespace v8::internal | 13655 } } // namespace v8::internal |
OLD | NEW |