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 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 Handle<ObjectHashTable> table = isolate->factory()->NewObjectHashTable(0); | 643 Handle<ObjectHashTable> table = isolate->factory()->NewObjectHashTable(0); |
644 weakmap->set_table(*table); | 644 weakmap->set_table(*table); |
645 return *weakmap; | 645 return *weakmap; |
646 } | 646 } |
647 | 647 |
648 | 648 |
649 RUNTIME_FUNCTION(MaybeObject*, Runtime_WeakMapGet) { | 649 RUNTIME_FUNCTION(MaybeObject*, Runtime_WeakMapGet) { |
650 NoHandleAllocation ha; | 650 NoHandleAllocation ha; |
651 ASSERT(args.length() == 2); | 651 ASSERT(args.length() == 2); |
652 CONVERT_ARG_CHECKED(JSWeakMap, weakmap, 0); | 652 CONVERT_ARG_CHECKED(JSWeakMap, weakmap, 0); |
653 // TODO (mstarzinger): Currently we cannot use JSProxy objects as keys | 653 // TODO(mstarzinger): Currently we cannot use JSProxy objects as keys |
654 // because they cannot be cast to JSObject to get an identity hash code. | 654 // because they cannot be cast to JSObject to get an identity hash code. |
655 CONVERT_ARG_CHECKED(JSObject, key, 1); | 655 CONVERT_ARG_CHECKED(JSObject, key, 1); |
656 return weakmap->table()->Lookup(*key); | 656 return weakmap->table()->Lookup(*key); |
657 } | 657 } |
658 | 658 |
659 | 659 |
660 RUNTIME_FUNCTION(MaybeObject*, Runtime_WeakMapSet) { | 660 RUNTIME_FUNCTION(MaybeObject*, Runtime_WeakMapSet) { |
661 HandleScope scope(isolate); | 661 HandleScope scope(isolate); |
662 ASSERT(args.length() == 3); | 662 ASSERT(args.length() == 3); |
663 CONVERT_ARG_CHECKED(JSWeakMap, weakmap, 0); | 663 CONVERT_ARG_CHECKED(JSWeakMap, weakmap, 0); |
664 // TODO (mstarzinger): See Runtime_WeakMapGet above. | 664 // TODO(mstarzinger): See Runtime_WeakMapGet above. |
665 CONVERT_ARG_CHECKED(JSObject, key, 1); | 665 CONVERT_ARG_CHECKED(JSObject, key, 1); |
666 Handle<Object> value(args[2]); | 666 Handle<Object> value(args[2]); |
667 Handle<ObjectHashTable> table(weakmap->table()); | 667 Handle<ObjectHashTable> table(weakmap->table()); |
668 weakmap->set_table(*PutIntoObjectHashTable(table, key, value)); | 668 weakmap->set_table(*PutIntoObjectHashTable(table, key, value)); |
669 return *value; | 669 return *value; |
670 } | 670 } |
671 | 671 |
672 | 672 |
673 RUNTIME_FUNCTION(MaybeObject*, Runtime_ClassOf) { | 673 RUNTIME_FUNCTION(MaybeObject*, Runtime_ClassOf) { |
674 NoHandleAllocation ha; | 674 NoHandleAllocation ha; |
(...skipping 12127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12802 } else { | 12802 } else { |
12803 // Handle last resort GC and make sure to allow future allocations | 12803 // Handle last resort GC and make sure to allow future allocations |
12804 // to grow the heap without causing GCs (if possible). | 12804 // to grow the heap without causing GCs (if possible). |
12805 isolate->counters()->gc_last_resort_from_js()->Increment(); | 12805 isolate->counters()->gc_last_resort_from_js()->Increment(); |
12806 isolate->heap()->CollectAllGarbage(false); | 12806 isolate->heap()->CollectAllGarbage(false); |
12807 } | 12807 } |
12808 } | 12808 } |
12809 | 12809 |
12810 | 12810 |
12811 } } // namespace v8::internal | 12811 } } // namespace v8::internal |
OLD | NEW |