OLD | NEW |
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 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
710 | 710 |
711 | 711 |
712 RUNTIME_FUNCTION(MaybeObject*, Runtime_Fix) { | 712 RUNTIME_FUNCTION(MaybeObject*, Runtime_Fix) { |
713 ASSERT(args.length() == 1); | 713 ASSERT(args.length() == 1); |
714 CONVERT_CHECKED(JSProxy, proxy, args[0]); | 714 CONVERT_CHECKED(JSProxy, proxy, args[0]); |
715 proxy->Fix(); | 715 proxy->Fix(); |
716 return isolate->heap()->undefined_value(); | 716 return isolate->heap()->undefined_value(); |
717 } | 717 } |
718 | 718 |
719 | 719 |
| 720 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetInitialize) { |
| 721 HandleScope scope(isolate); |
| 722 ASSERT(args.length() == 1); |
| 723 CONVERT_ARG_CHECKED(JSSet, holder, 0); |
| 724 Handle<ObjectHashSet> table = isolate->factory()->NewObjectHashSet(0); |
| 725 holder->set_table(*table); |
| 726 return *holder; |
| 727 } |
| 728 |
| 729 |
| 730 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetAdd) { |
| 731 HandleScope scope(isolate); |
| 732 ASSERT(args.length() == 2); |
| 733 CONVERT_ARG_CHECKED(JSSet, holder, 0); |
| 734 Handle<Object> key(args[1]); |
| 735 Handle<ObjectHashSet> table(ObjectHashSet::cast(holder->table())); |
| 736 table = ObjectHashSetAdd(table, key); |
| 737 holder->set_table(*table); |
| 738 return isolate->heap()->undefined_symbol(); |
| 739 } |
| 740 |
| 741 |
| 742 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetHas) { |
| 743 HandleScope scope(isolate); |
| 744 ASSERT(args.length() == 2); |
| 745 CONVERT_ARG_CHECKED(JSSet, holder, 0); |
| 746 Handle<Object> key(args[1]); |
| 747 Handle<ObjectHashSet> table(ObjectHashSet::cast(holder->table())); |
| 748 return isolate->heap()->ToBoolean(table->Contains(*key)); |
| 749 } |
| 750 |
| 751 |
| 752 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetDelete) { |
| 753 HandleScope scope(isolate); |
| 754 ASSERT(args.length() == 2); |
| 755 CONVERT_ARG_CHECKED(JSSet, holder, 0); |
| 756 Handle<Object> key(args[1]); |
| 757 Handle<ObjectHashSet> table(ObjectHashSet::cast(holder->table())); |
| 758 table = ObjectHashSetRemove(table, key); |
| 759 holder->set_table(*table); |
| 760 return isolate->heap()->undefined_symbol(); |
| 761 } |
| 762 |
| 763 |
| 764 RUNTIME_FUNCTION(MaybeObject*, Runtime_MapInitialize) { |
| 765 HandleScope scope(isolate); |
| 766 ASSERT(args.length() == 1); |
| 767 CONVERT_ARG_CHECKED(JSMap, holder, 0); |
| 768 Handle<ObjectHashTable> table = isolate->factory()->NewObjectHashTable(0); |
| 769 holder->set_table(*table); |
| 770 return *holder; |
| 771 } |
| 772 |
| 773 |
| 774 RUNTIME_FUNCTION(MaybeObject*, Runtime_MapGet) { |
| 775 HandleScope scope(isolate); |
| 776 ASSERT(args.length() == 2); |
| 777 CONVERT_ARG_CHECKED(JSMap, holder, 0); |
| 778 Handle<Object> key(args[1]); |
| 779 return ObjectHashTable::cast(holder->table())->Lookup(*key); |
| 780 } |
| 781 |
| 782 |
| 783 RUNTIME_FUNCTION(MaybeObject*, Runtime_MapSet) { |
| 784 HandleScope scope(isolate); |
| 785 ASSERT(args.length() == 3); |
| 786 CONVERT_ARG_CHECKED(JSMap, holder, 0); |
| 787 Handle<Object> key(args[1]); |
| 788 Handle<Object> value(args[2]); |
| 789 Handle<ObjectHashTable> table(ObjectHashTable::cast(holder->table())); |
| 790 Handle<ObjectHashTable> new_table = PutIntoObjectHashTable(table, key, value); |
| 791 holder->set_table(*new_table); |
| 792 return *value; |
| 793 } |
| 794 |
| 795 |
720 RUNTIME_FUNCTION(MaybeObject*, Runtime_WeakMapInitialize) { | 796 RUNTIME_FUNCTION(MaybeObject*, Runtime_WeakMapInitialize) { |
721 HandleScope scope(isolate); | 797 HandleScope scope(isolate); |
722 ASSERT(args.length() == 1); | 798 ASSERT(args.length() == 1); |
723 CONVERT_ARG_CHECKED(JSWeakMap, weakmap, 0); | 799 CONVERT_ARG_CHECKED(JSWeakMap, weakmap, 0); |
724 ASSERT(weakmap->map()->inobject_properties() == 0); | 800 ASSERT(weakmap->map()->inobject_properties() == 0); |
725 Handle<ObjectHashTable> table = isolate->factory()->NewObjectHashTable(0); | 801 Handle<ObjectHashTable> table = isolate->factory()->NewObjectHashTable(0); |
726 weakmap->set_table(*table); | 802 weakmap->set_table(*table); |
727 weakmap->set_next(Smi::FromInt(0)); | 803 weakmap->set_next(Smi::FromInt(0)); |
728 return *weakmap; | 804 return *weakmap; |
729 } | 805 } |
(...skipping 12656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13386 } else { | 13462 } else { |
13387 // Handle last resort GC and make sure to allow future allocations | 13463 // Handle last resort GC and make sure to allow future allocations |
13388 // to grow the heap without causing GCs (if possible). | 13464 // to grow the heap without causing GCs (if possible). |
13389 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13465 isolate->counters()->gc_last_resort_from_js()->Increment(); |
13390 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags); | 13466 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags); |
13391 } | 13467 } |
13392 } | 13468 } |
13393 | 13469 |
13394 | 13470 |
13395 } } // namespace v8::internal | 13471 } } // namespace v8::internal |
OLD | NEW |