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 1619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1630 } | 1630 } |
1631 return current; | 1631 return current; |
1632 } | 1632 } |
1633 | 1633 |
1634 | 1634 |
1635 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetPrototype) { | 1635 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetPrototype) { |
1636 HandleScope scope(isolate); | 1636 HandleScope scope(isolate); |
1637 ASSERT(args.length() == 2); | 1637 ASSERT(args.length() == 2); |
1638 CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0); | 1638 CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0); |
1639 CONVERT_ARG_HANDLE_CHECKED(Object, prototype, 1); | 1639 CONVERT_ARG_HANDLE_CHECKED(Object, prototype, 1); |
1640 if (obj->map()->is_observed()) { | 1640 if (FLAG_harmony_observation && obj->map()->is_observed()) { |
1641 Handle<Object> old_value( | 1641 Handle<Object> old_value( |
1642 GetPrototypeSkipHiddenPrototypes(isolate, *obj), isolate); | 1642 GetPrototypeSkipHiddenPrototypes(isolate, *obj), isolate); |
1643 | 1643 |
1644 Handle<Object> result = JSObject::SetPrototype(obj, prototype, true); | 1644 Handle<Object> result = JSObject::SetPrototype(obj, prototype, true); |
1645 RETURN_IF_EMPTY_HANDLE(isolate, result); | 1645 RETURN_IF_EMPTY_HANDLE(isolate, result); |
1646 | 1646 |
1647 Handle<Object> new_value( | 1647 Handle<Object> new_value( |
1648 GetPrototypeSkipHiddenPrototypes(isolate, *obj), isolate); | 1648 GetPrototypeSkipHiddenPrototypes(isolate, *obj), isolate); |
1649 if (!new_value->SameValue(*old_value)) { | 1649 if (!new_value->SameValue(*old_value)) { |
1650 JSObject::EnqueueChangeRecord(obj, "setPrototype", | 1650 JSObject::EnqueueChangeRecord(obj, "setPrototype", |
(...skipping 13319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14970 // Handle last resort GC and make sure to allow future allocations | 14970 // Handle last resort GC and make sure to allow future allocations |
14971 // to grow the heap without causing GCs (if possible). | 14971 // to grow the heap without causing GCs (if possible). |
14972 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14972 isolate->counters()->gc_last_resort_from_js()->Increment(); |
14973 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14973 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
14974 "Runtime::PerformGC"); | 14974 "Runtime::PerformGC"); |
14975 } | 14975 } |
14976 } | 14976 } |
14977 | 14977 |
14978 | 14978 |
14979 } } // namespace v8::internal | 14979 } } // namespace v8::internal |
OLD | NEW |