Chromium Code Reviews| 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_WeakMapCreate) { | |
|
rossberg
2011/08/02 12:33:38
Since unlike the others, this function does not ac
Michael Starzinger
2011/08/02 14:05:22
Done.
| |
| 639 HandleScope scope(isolate); | |
| 640 ASSERT(args.length() == 1); | |
| 641 CONVERT_ARG_CHECKED(JSWeakMap, weakmap, 0); | |
| 642 Handle<ObjectHashTable> table = isolate->factory()->NewObjectHashTable(0); | |
| 643 weakmap->set_table(*table); | |
| 644 return *weakmap; | |
| 645 } | |
| 646 | |
| 647 | |
| 648 RUNTIME_FUNCTION(MaybeObject*, Runtime_WeakMapGet) { | |
| 649 NoHandleAllocation ha; | |
| 650 ASSERT(args.length() == 2); | |
| 651 CONVERT_ARG_CHECKED(JSWeakMap, weakmap, 0); | |
| 652 CONVERT_ARG_CHECKED(JSObject, key, 1); | |
| 653 return weakmap->table()->Lookup(*key); | |
| 654 } | |
| 655 | |
| 656 | |
| 657 RUNTIME_FUNCTION(MaybeObject*, Runtime_WeakMapSet) { | |
| 658 HandleScope scope(isolate); | |
| 659 ASSERT(args.length() == 3); | |
| 660 CONVERT_ARG_CHECKED(JSWeakMap, weakmap, 0); | |
| 661 CONVERT_ARG_CHECKED(JSObject, key, 1); | |
| 662 Handle<Object> value(args[2]); | |
| 663 Handle<ObjectHashTable> table(weakmap->table()); | |
| 664 weakmap->set_table(*PutIntoObjectHashTable(table, key, value)); | |
| 665 return *value; | |
| 666 } | |
| 667 | |
| 668 | |
| 638 RUNTIME_FUNCTION(MaybeObject*, Runtime_ClassOf) { | 669 RUNTIME_FUNCTION(MaybeObject*, Runtime_ClassOf) { |
| 639 NoHandleAllocation ha; | 670 NoHandleAllocation ha; |
| 640 ASSERT(args.length() == 1); | 671 ASSERT(args.length() == 1); |
| 641 Object* obj = args[0]; | 672 Object* obj = args[0]; |
| 642 if (!obj->IsJSObject()) return isolate->heap()->null_value(); | 673 if (!obj->IsJSObject()) return isolate->heap()->null_value(); |
| 643 return JSObject::cast(obj)->class_name(); | 674 return JSObject::cast(obj)->class_name(); |
| 644 } | 675 } |
| 645 | 676 |
| 646 | 677 |
| 647 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetPrototype) { | 678 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetPrototype) { |
| (...skipping 12115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 12763 } else { | 12794 } else { |
| 12764 // Handle last resort GC and make sure to allow future allocations | 12795 // Handle last resort GC and make sure to allow future allocations |
| 12765 // to grow the heap without causing GCs (if possible). | 12796 // to grow the heap without causing GCs (if possible). |
| 12766 isolate->counters()->gc_last_resort_from_js()->Increment(); | 12797 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 12767 isolate->heap()->CollectAllGarbage(false); | 12798 isolate->heap()->CollectAllGarbage(false); |
| 12768 } | 12799 } |
| 12769 } | 12800 } |
| 12770 | 12801 |
| 12771 | 12802 |
| 12772 } } // namespace v8::internal | 12803 } } // namespace v8::internal |
| OLD | NEW |