| 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 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 635 } | 635 } |
| 636 | 636 |
| 637 | 637 |
| 638 RUNTIME_FUNCTION(MaybeObject*, Runtime_WeakMapInitialize) { | 638 RUNTIME_FUNCTION(MaybeObject*, Runtime_WeakMapInitialize) { |
| 639 HandleScope scope(isolate); | 639 HandleScope scope(isolate); |
| 640 ASSERT(args.length() == 1); | 640 ASSERT(args.length() == 1); |
| 641 CONVERT_ARG_CHECKED(JSWeakMap, weakmap, 0); | 641 CONVERT_ARG_CHECKED(JSWeakMap, weakmap, 0); |
| 642 ASSERT(weakmap->map()->inobject_properties() == 0); | 642 ASSERT(weakmap->map()->inobject_properties() == 0); |
| 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 weakmap->set_next(Smi::FromInt(0)); |
| 645 return *weakmap; | 646 return *weakmap; |
| 646 } | 647 } |
| 647 | 648 |
| 648 | 649 |
| 649 RUNTIME_FUNCTION(MaybeObject*, Runtime_WeakMapGet) { | 650 RUNTIME_FUNCTION(MaybeObject*, Runtime_WeakMapGet) { |
| 650 NoHandleAllocation ha; | 651 NoHandleAllocation ha; |
| 651 ASSERT(args.length() == 2); | 652 ASSERT(args.length() == 2); |
| 652 CONVERT_ARG_CHECKED(JSWeakMap, weakmap, 0); | 653 CONVERT_ARG_CHECKED(JSWeakMap, weakmap, 0); |
| 653 // TODO (mstarzinger): Currently we cannot use JSProxy objects as keys | 654 // TODO (mstarzinger): Currently we cannot use JSProxy objects as keys |
| 654 // because they cannot be cast to JSObject to get an identity hash code. | 655 // because they cannot be cast to JSObject to get an identity hash code. |
| (...skipping 12143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12798 } else { | 12799 } else { |
| 12799 // Handle last resort GC and make sure to allow future allocations | 12800 // Handle last resort GC and make sure to allow future allocations |
| 12800 // to grow the heap without causing GCs (if possible). | 12801 // to grow the heap without causing GCs (if possible). |
| 12801 isolate->counters()->gc_last_resort_from_js()->Increment(); | 12802 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 12802 isolate->heap()->CollectAllGarbage(false); | 12803 isolate->heap()->CollectAllGarbage(false); |
| 12803 } | 12804 } |
| 12804 } | 12805 } |
| 12805 | 12806 |
| 12806 | 12807 |
| 12807 } } // namespace v8::internal | 12808 } } // namespace v8::internal |
| OLD | NEW |