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 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
605 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateJSProxy) { | 605 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateJSProxy) { |
606 ASSERT(args.length() == 2); | 606 ASSERT(args.length() == 2); |
607 Object* handler = args[0]; | 607 Object* handler = args[0]; |
608 Object* prototype = args[1]; | 608 Object* prototype = args[1]; |
609 Object* used_prototype = | 609 Object* used_prototype = |
610 prototype->IsJSReceiver() ? prototype : isolate->heap()->null_value(); | 610 prototype->IsJSReceiver() ? prototype : isolate->heap()->null_value(); |
611 return isolate->heap()->AllocateJSProxy(handler, used_prototype); | 611 return isolate->heap()->AllocateJSProxy(handler, used_prototype); |
612 } | 612 } |
613 | 613 |
614 | 614 |
615 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateJSFunctionProxy) { | |
616 ASSERT(args.length() == 4); | |
617 Object* handler = args[0]; | |
618 Object* call_trap = args[1]; | |
619 Object* construct_trap = args[2]; | |
620 Object* prototype = args[3]; | |
621 Object* used_prototype = | |
622 prototype->IsJSReceiver() ? prototype : isolate->heap()->null_value(); | |
623 return isolate->heap()->AllocateJSFunctionProxy( | |
624 handler, call_trap, construct_trap, used_prototype); | |
625 } | |
626 | |
627 | |
615 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsJSProxy) { | 628 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsJSProxy) { |
616 ASSERT(args.length() == 1); | 629 ASSERT(args.length() == 1); |
617 Object* obj = args[0]; | 630 Object* obj = args[0]; |
618 return isolate->heap()->ToBoolean(obj->IsJSProxy()); | 631 return isolate->heap()->ToBoolean(obj->IsJSProxy()); |
619 } | 632 } |
620 | 633 |
621 | 634 |
635 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsJSFunctionProxy) { | |
636 ASSERT(args.length() == 1); | |
637 Object* obj = args[0]; | |
638 return obj->IsJSFunctionProxy() | |
639 ? isolate->heap()->true_value() : isolate->heap()->false_value(); | |
Kevin Millikin (Chromium)
2011/09/08 17:30:40
return isolate->heap()->ToBoolean(obj->IsJSFunctio
rossberg
2011/09/09 17:05:30
Done.
| |
640 } | |
641 | |
642 | |
622 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetHandler) { | 643 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetHandler) { |
623 ASSERT(args.length() == 1); | 644 ASSERT(args.length() == 1); |
624 CONVERT_CHECKED(JSProxy, proxy, args[0]); | 645 CONVERT_CHECKED(JSProxy, proxy, args[0]); |
625 return proxy->handler(); | 646 return proxy->handler(); |
626 } | 647 } |
627 | 648 |
628 | 649 |
650 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetCallTrap) { | |
651 ASSERT(args.length() == 1); | |
652 CONVERT_CHECKED(JSFunctionProxy, proxy, args[0]); | |
653 return proxy->call_trap(); | |
654 } | |
655 | |
656 | |
657 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetConstructTrap) { | |
658 ASSERT(args.length() == 1); | |
659 CONVERT_CHECKED(JSFunctionProxy, proxy, args[0]); | |
660 return proxy->construct_trap(); | |
661 } | |
662 | |
663 | |
629 RUNTIME_FUNCTION(MaybeObject*, Runtime_Fix) { | 664 RUNTIME_FUNCTION(MaybeObject*, Runtime_Fix) { |
630 ASSERT(args.length() == 1); | 665 ASSERT(args.length() == 1); |
631 CONVERT_CHECKED(JSProxy, proxy, args[0]); | 666 CONVERT_CHECKED(JSProxy, proxy, args[0]); |
632 proxy->Fix(); | 667 proxy->Fix(); |
633 return isolate->heap()->undefined_value(); | 668 return isolate->heap()->undefined_value(); |
634 } | 669 } |
635 | 670 |
636 | 671 |
637 RUNTIME_FUNCTION(MaybeObject*, Runtime_WeakMapInitialize) { | 672 RUNTIME_FUNCTION(MaybeObject*, Runtime_WeakMapInitialize) { |
638 HandleScope scope(isolate); | 673 HandleScope scope(isolate); |
(...skipping 4214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4853 return isolate->heap()->boolean_symbol(); | 4888 return isolate->heap()->boolean_symbol(); |
4854 } | 4889 } |
4855 if (heap_obj->IsNull()) { | 4890 if (heap_obj->IsNull()) { |
4856 return FLAG_harmony_typeof | 4891 return FLAG_harmony_typeof |
4857 ? isolate->heap()->null_symbol() | 4892 ? isolate->heap()->null_symbol() |
4858 : isolate->heap()->object_symbol(); | 4893 : isolate->heap()->object_symbol(); |
4859 } | 4894 } |
4860 ASSERT(heap_obj->IsUndefined()); | 4895 ASSERT(heap_obj->IsUndefined()); |
4861 return isolate->heap()->undefined_symbol(); | 4896 return isolate->heap()->undefined_symbol(); |
4862 case JS_FUNCTION_TYPE: | 4897 case JS_FUNCTION_TYPE: |
4898 case JS_FUNCTION_PROXY_TYPE: | |
4863 return isolate->heap()->function_symbol(); | 4899 return isolate->heap()->function_symbol(); |
4864 default: | 4900 default: |
4865 // For any kind of object not handled above, the spec rule for | 4901 // For any kind of object not handled above, the spec rule for |
4866 // host objects gives that it is okay to return "object" | 4902 // host objects gives that it is okay to return "object" |
4867 return isolate->heap()->object_symbol(); | 4903 return isolate->heap()->object_symbol(); |
4868 } | 4904 } |
4869 } | 4905 } |
4870 | 4906 |
4871 | 4907 |
4872 static bool AreDigits(const char*s, int from, int to) { | 4908 static bool AreDigits(const char*s, int from, int to) { |
(...skipping 7966 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
12839 } else { | 12875 } else { |
12840 // Handle last resort GC and make sure to allow future allocations | 12876 // Handle last resort GC and make sure to allow future allocations |
12841 // to grow the heap without causing GCs (if possible). | 12877 // to grow the heap without causing GCs (if possible). |
12842 isolate->counters()->gc_last_resort_from_js()->Increment(); | 12878 isolate->counters()->gc_last_resort_from_js()->Increment(); |
12843 isolate->heap()->CollectAllGarbage(false); | 12879 isolate->heap()->CollectAllGarbage(false); |
12844 } | 12880 } |
12845 } | 12881 } |
12846 | 12882 |
12847 | 12883 |
12848 } } // namespace v8::internal | 12884 } } // namespace v8::internal |
OLD | NEW |