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 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
676 ASSERT(args.length() == 1); | 676 ASSERT(args.length() == 1); |
677 Object* obj = args[0]; | 677 Object* obj = args[0]; |
678 if (!obj->IsJSObject()) return isolate->heap()->null_value(); | 678 if (!obj->IsJSObject()) return isolate->heap()->null_value(); |
679 return JSObject::cast(obj)->class_name(); | 679 return JSObject::cast(obj)->class_name(); |
680 } | 680 } |
681 | 681 |
682 | 682 |
683 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetPrototype) { | 683 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetPrototype) { |
684 NoHandleAllocation ha; | 684 NoHandleAllocation ha; |
685 ASSERT(args.length() == 1); | 685 ASSERT(args.length() == 1); |
686 Object* obj = args[0]; | 686 CONVERT_CHECKED(JSReceiver, input_obj, args[0]); |
| 687 Object* obj = input_obj; |
| 688 // We don't expect access checks to be needed on JSProxy objects. |
| 689 ASSERT(!obj->IsAccessCheckNeeded() || obj->IsJSObject()); |
687 do { | 690 do { |
| 691 if (obj->IsAccessCheckNeeded() && |
| 692 !isolate->MayNamedAccess(JSObject::cast(obj), |
| 693 isolate->heap()->Proto_symbol(), |
| 694 v8::ACCESS_GET)) { |
| 695 isolate->ReportFailedAccessCheck(JSObject::cast(obj), v8::ACCESS_GET); |
| 696 return isolate->heap()->undefined_value(); |
| 697 } |
688 obj = obj->GetPrototype(); | 698 obj = obj->GetPrototype(); |
689 } while (obj->IsJSObject() && | 699 } while (obj->IsJSObject() && |
690 JSObject::cast(obj)->map()->is_hidden_prototype()); | 700 JSObject::cast(obj)->map()->is_hidden_prototype()); |
691 return obj; | 701 return obj; |
692 } | 702 } |
693 | 703 |
694 | 704 |
695 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsInPrototypeChain) { | 705 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsInPrototypeChain) { |
696 NoHandleAllocation ha; | 706 NoHandleAllocation ha; |
697 ASSERT(args.length() == 2); | 707 ASSERT(args.length() == 2); |
(...skipping 12232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12930 } else { | 12940 } else { |
12931 // Handle last resort GC and make sure to allow future allocations | 12941 // Handle last resort GC and make sure to allow future allocations |
12932 // to grow the heap without causing GCs (if possible). | 12942 // to grow the heap without causing GCs (if possible). |
12933 isolate->counters()->gc_last_resort_from_js()->Increment(); | 12943 isolate->counters()->gc_last_resort_from_js()->Increment(); |
12934 isolate->heap()->CollectAllGarbage(false); | 12944 isolate->heap()->CollectAllGarbage(false); |
12935 } | 12945 } |
12936 } | 12946 } |
12937 | 12947 |
12938 | 12948 |
12939 } } // namespace v8::internal | 12949 } } // namespace v8::internal |
OLD | NEW |