| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 1665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1676 } | 1676 } |
| 1677 return current; | 1677 return current; |
| 1678 } | 1678 } |
| 1679 | 1679 |
| 1680 | 1680 |
| 1681 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetPrototype) { | 1681 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetPrototype) { |
| 1682 HandleScope scope(isolate); | 1682 HandleScope scope(isolate); |
| 1683 ASSERT(args.length() == 2); | 1683 ASSERT(args.length() == 2); |
| 1684 CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0); | 1684 CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0); |
| 1685 CONVERT_ARG_HANDLE_CHECKED(Object, prototype, 1); | 1685 CONVERT_ARG_HANDLE_CHECKED(Object, prototype, 1); |
| 1686 if (obj->IsAccessCheckNeeded() && |
| 1687 !isolate->MayNamedAccessWrapper(obj, |
| 1688 isolate->factory()->proto_string(), |
| 1689 v8::ACCESS_SET)) { |
| 1690 isolate->ReportFailedAccessCheck(*obj, v8::ACCESS_SET); |
| 1691 RETURN_IF_SCHEDULED_EXCEPTION(isolate); |
| 1692 return isolate->heap()->undefined_value(); |
| 1693 } |
| 1686 if (FLAG_harmony_observation && obj->map()->is_observed()) { | 1694 if (FLAG_harmony_observation && obj->map()->is_observed()) { |
| 1687 Handle<Object> old_value( | 1695 Handle<Object> old_value( |
| 1688 GetPrototypeSkipHiddenPrototypes(isolate, *obj), isolate); | 1696 GetPrototypeSkipHiddenPrototypes(isolate, *obj), isolate); |
| 1689 | 1697 |
| 1690 Handle<Object> result = JSObject::SetPrototype(obj, prototype, true); | 1698 Handle<Object> result = JSObject::SetPrototype(obj, prototype, true); |
| 1691 RETURN_IF_EMPTY_HANDLE(isolate, result); | 1699 RETURN_IF_EMPTY_HANDLE(isolate, result); |
| 1692 | 1700 |
| 1693 Handle<Object> new_value( | 1701 Handle<Object> new_value( |
| 1694 GetPrototypeSkipHiddenPrototypes(isolate, *obj), isolate); | 1702 GetPrototypeSkipHiddenPrototypes(isolate, *obj), isolate); |
| 1695 if (!new_value->SameValue(*old_value)) { | 1703 if (!new_value->SameValue(*old_value)) { |
| (...skipping 13211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14907 // Handle last resort GC and make sure to allow future allocations | 14915 // Handle last resort GC and make sure to allow future allocations |
| 14908 // to grow the heap without causing GCs (if possible). | 14916 // to grow the heap without causing GCs (if possible). |
| 14909 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14917 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 14910 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14918 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
| 14911 "Runtime::PerformGC"); | 14919 "Runtime::PerformGC"); |
| 14912 } | 14920 } |
| 14913 } | 14921 } |
| 14914 | 14922 |
| 14915 | 14923 |
| 14916 } } // namespace v8::internal | 14924 } } // namespace v8::internal |
| OLD | NEW |