| 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 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 628 | 628 |
| 629 | 629 |
| 630 RUNTIME_FUNCTION(MaybeObject*, Runtime_Fix) { | 630 RUNTIME_FUNCTION(MaybeObject*, Runtime_Fix) { |
| 631 ASSERT(args.length() == 1); | 631 ASSERT(args.length() == 1); |
| 632 CONVERT_CHECKED(JSProxy, proxy, args[0]); | 632 CONVERT_CHECKED(JSProxy, proxy, args[0]); |
| 633 proxy->Fix(); | 633 proxy->Fix(); |
| 634 return isolate->heap()->undefined_value(); | 634 return isolate->heap()->undefined_value(); |
| 635 } | 635 } |
| 636 | 636 |
| 637 | 637 |
| 638 RUNTIME_FUNCTION(MaybeObject*, Runtime_WeakMapInitialize) { |
| 639 HandleScope scope(isolate); |
| 640 ASSERT(args.length() == 1); |
| 641 CONVERT_ARG_CHECKED(JSWeakMap, weakmap, 0); |
| 642 ASSERT(weakmap->map()->inobject_properties() == 0); |
| 643 Handle<ObjectHashTable> table = isolate->factory()->NewObjectHashTable(0); |
| 644 weakmap->set_table(*table); |
| 645 return *weakmap; |
| 646 } |
| 647 |
| 648 |
| 649 RUNTIME_FUNCTION(MaybeObject*, Runtime_WeakMapGet) { |
| 650 NoHandleAllocation ha; |
| 651 ASSERT(args.length() == 2); |
| 652 CONVERT_ARG_CHECKED(JSWeakMap, weakmap, 0); |
| 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. |
| 655 CONVERT_ARG_CHECKED(JSObject, key, 1); |
| 656 return weakmap->table()->Lookup(*key); |
| 657 } |
| 658 |
| 659 |
| 660 RUNTIME_FUNCTION(MaybeObject*, Runtime_WeakMapSet) { |
| 661 HandleScope scope(isolate); |
| 662 ASSERT(args.length() == 3); |
| 663 CONVERT_ARG_CHECKED(JSWeakMap, weakmap, 0); |
| 664 // TODO (mstarzinger): See Runtime_WeakMapGet above. |
| 665 CONVERT_ARG_CHECKED(JSObject, key, 1); |
| 666 Handle<Object> value(args[2]); |
| 667 Handle<ObjectHashTable> table(weakmap->table()); |
| 668 weakmap->set_table(*PutIntoObjectHashTable(table, key, value)); |
| 669 return *value; |
| 670 } |
| 671 |
| 672 |
| 638 RUNTIME_FUNCTION(MaybeObject*, Runtime_ClassOf) { | 673 RUNTIME_FUNCTION(MaybeObject*, Runtime_ClassOf) { |
| 639 NoHandleAllocation ha; | 674 NoHandleAllocation ha; |
| 640 ASSERT(args.length() == 1); | 675 ASSERT(args.length() == 1); |
| 641 Object* obj = args[0]; | 676 Object* obj = args[0]; |
| 642 if (!obj->IsJSObject()) return isolate->heap()->null_value(); | 677 if (!obj->IsJSObject()) return isolate->heap()->null_value(); |
| 643 return JSObject::cast(obj)->class_name(); | 678 return JSObject::cast(obj)->class_name(); |
| 644 } | 679 } |
| 645 | 680 |
| 646 | 681 |
| 647 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetPrototype) { | 682 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetPrototype) { |
| (...skipping 12115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12763 } else { | 12798 } else { |
| 12764 // Handle last resort GC and make sure to allow future allocations | 12799 // Handle last resort GC and make sure to allow future allocations |
| 12765 // to grow the heap without causing GCs (if possible). | 12800 // to grow the heap without causing GCs (if possible). |
| 12766 isolate->counters()->gc_last_resort_from_js()->Increment(); | 12801 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 12767 isolate->heap()->CollectAllGarbage(false); | 12802 isolate->heap()->CollectAllGarbage(false); |
| 12768 } | 12803 } |
| 12769 } | 12804 } |
| 12770 | 12805 |
| 12771 | 12806 |
| 12772 } } // namespace v8::internal | 12807 } } // namespace v8::internal |
| OLD | NEW |