OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/factory.h" | 5 #include "src/factory.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/allocation-site-scopes.h" | 8 #include "src/allocation-site-scopes.h" |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 2201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2212 | 2212 |
2213 void Factory::ReinitializeJSGlobalProxy(Handle<JSGlobalProxy> object, | 2213 void Factory::ReinitializeJSGlobalProxy(Handle<JSGlobalProxy> object, |
2214 Handle<JSFunction> constructor) { | 2214 Handle<JSFunction> constructor) { |
2215 DCHECK(constructor->has_initial_map()); | 2215 DCHECK(constructor->has_initial_map()); |
2216 Handle<Map> map(constructor->initial_map(), isolate()); | 2216 Handle<Map> map(constructor->initial_map(), isolate()); |
2217 Handle<Map> old_map(object->map(), isolate()); | 2217 Handle<Map> old_map(object->map(), isolate()); |
2218 | 2218 |
2219 // The proxy's hash should be retained across reinitialization. | 2219 // The proxy's hash should be retained across reinitialization. |
2220 Handle<Object> hash(object->hash(), isolate()); | 2220 Handle<Object> hash(object->hash(), isolate()); |
2221 | 2221 |
2222 JSObject::InvalidatePrototypeChains(*old_map); | |
2223 if (old_map->is_prototype_map()) { | 2222 if (old_map->is_prototype_map()) { |
2224 map = Map::Copy(map, "CopyAsPrototypeForJSGlobalProxy"); | 2223 map = Map::Copy(map, "CopyAsPrototypeForJSGlobalProxy"); |
2225 map->set_is_prototype_map(true); | 2224 map->set_is_prototype_map(true); |
2226 } | 2225 } |
2227 JSObject::UpdatePrototypeUserRegistration(old_map, map, isolate()); | 2226 JSObject::NotifyMapChange(old_map, map, isolate()); |
2228 | 2227 |
2229 // Check that the already allocated object has the same size and type as | 2228 // Check that the already allocated object has the same size and type as |
2230 // objects allocated using the constructor. | 2229 // objects allocated using the constructor. |
2231 DCHECK(map->instance_size() == old_map->instance_size()); | 2230 DCHECK(map->instance_size() == old_map->instance_size()); |
2232 DCHECK(map->instance_type() == old_map->instance_type()); | 2231 DCHECK(map->instance_type() == old_map->instance_type()); |
2233 | 2232 |
2234 // Allocate the backing storage for the properties. | 2233 // Allocate the backing storage for the properties. |
2235 Handle<FixedArray> properties = empty_fixed_array(); | 2234 Handle<FixedArray> properties = empty_fixed_array(); |
2236 | 2235 |
2237 // In order to keep heap in consistent state there must be no allocations | 2236 // In order to keep heap in consistent state there must be no allocations |
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2727 Handle<JSFixedArrayIterator>::cast(NewJSObjectFromMap(map)); | 2726 Handle<JSFixedArrayIterator>::cast(NewJSObjectFromMap(map)); |
2728 iterator->set_initial_next(*next); | 2727 iterator->set_initial_next(*next); |
2729 iterator->set_array(*array); | 2728 iterator->set_array(*array); |
2730 iterator->set_index(0); | 2729 iterator->set_index(0); |
2731 iterator->InObjectPropertyAtPut(JSFixedArrayIterator::kNextIndex, *next); | 2730 iterator->InObjectPropertyAtPut(JSFixedArrayIterator::kNextIndex, *next); |
2732 return iterator; | 2731 return iterator; |
2733 } | 2732 } |
2734 | 2733 |
2735 } // namespace internal | 2734 } // namespace internal |
2736 } // namespace v8 | 2735 } // namespace v8 |
OLD | NEW |