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 1630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1641 } | 1641 } |
1642 return current; | 1642 return current; |
1643 } | 1643 } |
1644 | 1644 |
1645 | 1645 |
1646 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetPrototype) { | 1646 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetPrototype) { |
1647 HandleScope scope(isolate); | 1647 HandleScope scope(isolate); |
1648 ASSERT(args.length() == 2); | 1648 ASSERT(args.length() == 2); |
1649 CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0); | 1649 CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0); |
1650 CONVERT_ARG_HANDLE_CHECKED(Object, prototype, 1); | 1650 CONVERT_ARG_HANDLE_CHECKED(Object, prototype, 1); |
1651 if (FLAG_harmony_observation && obj->map()->is_observed()) { | 1651 if (obj->map()->is_observed()) { |
1652 Handle<Object> old_value( | 1652 Handle<Object> old_value( |
1653 GetPrototypeSkipHiddenPrototypes(isolate, *obj), isolate); | 1653 GetPrototypeSkipHiddenPrototypes(isolate, *obj), isolate); |
1654 | 1654 |
1655 Handle<Object> result = JSObject::SetPrototype(obj, prototype, true); | 1655 Handle<Object> result = JSObject::SetPrototype(obj, prototype, true); |
1656 RETURN_IF_EMPTY_HANDLE(isolate, result); | 1656 RETURN_IF_EMPTY_HANDLE(isolate, result); |
1657 | 1657 |
1658 Handle<Object> new_value( | 1658 Handle<Object> new_value( |
1659 GetPrototypeSkipHiddenPrototypes(isolate, *obj), isolate); | 1659 GetPrototypeSkipHiddenPrototypes(isolate, *obj), isolate); |
1660 if (!new_value->SameValue(*old_value)) { | 1660 if (!new_value->SameValue(*old_value)) { |
1661 JSObject::EnqueueChangeRecord(obj, "setPrototype", | 1661 JSObject::EnqueueChangeRecord(obj, "setPrototype", |
(...skipping 13331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14993 // Handle last resort GC and make sure to allow future allocations | 14993 // Handle last resort GC and make sure to allow future allocations |
14994 // to grow the heap without causing GCs (if possible). | 14994 // to grow the heap without causing GCs (if possible). |
14995 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14995 isolate->counters()->gc_last_resort_from_js()->Increment(); |
14996 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14996 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
14997 "Runtime::PerformGC"); | 14997 "Runtime::PerformGC"); |
14998 } | 14998 } |
14999 } | 14999 } |
15000 | 15000 |
15001 | 15001 |
15002 } } // namespace v8::internal | 15002 } } // namespace v8::internal |
OLD | NEW |