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 1661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1672 } | 1672 } |
1673 return current; | 1673 return current; |
1674 } | 1674 } |
1675 | 1675 |
1676 | 1676 |
1677 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetPrototype) { | 1677 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetPrototype) { |
1678 HandleScope scope(isolate); | 1678 HandleScope scope(isolate); |
1679 ASSERT(args.length() == 2); | 1679 ASSERT(args.length() == 2); |
1680 CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0); | 1680 CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0); |
1681 CONVERT_ARG_HANDLE_CHECKED(Object, prototype, 1); | 1681 CONVERT_ARG_HANDLE_CHECKED(Object, prototype, 1); |
| 1682 if (obj->IsAccessCheckNeeded() && |
| 1683 !isolate->MayNamedAccessWrapper(obj, |
| 1684 isolate->factory()->proto_string(), |
| 1685 v8::ACCESS_SET)) { |
| 1686 isolate->ReportFailedAccessCheckWrapper(obj, v8::ACCESS_SET); |
| 1687 RETURN_IF_SCHEDULED_EXCEPTION(isolate); |
| 1688 return isolate->heap()->undefined_value(); |
| 1689 } |
1682 if (obj->map()->is_observed()) { | 1690 if (obj->map()->is_observed()) { |
1683 Handle<Object> old_value( | 1691 Handle<Object> old_value( |
1684 GetPrototypeSkipHiddenPrototypes(isolate, *obj), isolate); | 1692 GetPrototypeSkipHiddenPrototypes(isolate, *obj), isolate); |
1685 | 1693 |
1686 Handle<Object> result = JSObject::SetPrototype(obj, prototype, true); | 1694 Handle<Object> result = JSObject::SetPrototype(obj, prototype, true); |
1687 RETURN_IF_EMPTY_HANDLE(isolate, result); | 1695 RETURN_IF_EMPTY_HANDLE(isolate, result); |
1688 | 1696 |
1689 Handle<Object> new_value( | 1697 Handle<Object> new_value( |
1690 GetPrototypeSkipHiddenPrototypes(isolate, *obj), isolate); | 1698 GetPrototypeSkipHiddenPrototypes(isolate, *obj), isolate); |
1691 if (!new_value->SameValue(*old_value)) { | 1699 if (!new_value->SameValue(*old_value)) { |
(...skipping 13325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15017 // Handle last resort GC and make sure to allow future allocations | 15025 // Handle last resort GC and make sure to allow future allocations |
15018 // to grow the heap without causing GCs (if possible). | 15026 // to grow the heap without causing GCs (if possible). |
15019 isolate->counters()->gc_last_resort_from_js()->Increment(); | 15027 isolate->counters()->gc_last_resort_from_js()->Increment(); |
15020 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 15028 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
15021 "Runtime::PerformGC"); | 15029 "Runtime::PerformGC"); |
15022 } | 15030 } |
15023 } | 15031 } |
15024 | 15032 |
15025 | 15033 |
15026 } } // namespace v8::internal | 15034 } } // namespace v8::internal |
OLD | NEW |