OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/objects.h" | 5 #include "src/objects.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 #include <iomanip> | 8 #include <iomanip> |
9 #include <memory> | 9 #include <memory> |
10 #include <sstream> | 10 #include <sstream> |
(...skipping 12333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12344 Object* maybe_cell = proto_info->validity_cell(); | 12344 Object* maybe_cell = proto_info->validity_cell(); |
12345 if (maybe_cell->IsCell()) { | 12345 if (maybe_cell->IsCell()) { |
12346 // Just set the value; the cell will be replaced lazily. | 12346 // Just set the value; the cell will be replaced lazily. |
12347 Cell* cell = Cell::cast(maybe_cell); | 12347 Cell* cell = Cell::cast(maybe_cell); |
12348 cell->set_value(Smi::FromInt(Map::kPrototypeChainInvalid)); | 12348 cell->set_value(Smi::FromInt(Map::kPrototypeChainInvalid)); |
12349 } | 12349 } |
12350 | 12350 |
12351 WeakFixedArray::Iterator iterator(proto_info->prototype_users()); | 12351 WeakFixedArray::Iterator iterator(proto_info->prototype_users()); |
12352 // For now, only maps register themselves as users. | 12352 // For now, only maps register themselves as users. |
12353 Map* user; | 12353 Map* user; |
12354 while ((user = iterator.Next<Map>())) { | 12354 while ((user = iterator.Next<Map>()) != nullptr) { |
12355 // Walk the prototype chain (backwards, towards leaf objects) if necessary. | 12355 // Walk the prototype chain (backwards, towards leaf objects) if necessary. |
12356 InvalidatePrototypeChainsInternal(user); | 12356 InvalidatePrototypeChainsInternal(user); |
12357 } | 12357 } |
12358 } | 12358 } |
12359 | 12359 |
12360 | 12360 |
12361 // static | 12361 // static |
12362 void JSObject::InvalidatePrototypeChains(Map* map) { | 12362 void JSObject::InvalidatePrototypeChains(Map* map) { |
12363 DisallowHeapAllocation no_gc; | 12363 DisallowHeapAllocation no_gc; |
12364 InvalidatePrototypeChainsInternal(map); | 12364 InvalidatePrototypeChainsInternal(map); |
(...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13326 #endif | 13326 #endif |
13327 Handle<WeakCell> cell = isolate->factory()->NewWeakCell(shared); | 13327 Handle<WeakCell> cell = isolate->factory()->NewWeakCell(shared); |
13328 list->set(shared->function_literal_id(), *cell); | 13328 list->set(shared->function_literal_id(), *cell); |
13329 } else { | 13329 } else { |
13330 Handle<Object> list = isolate->factory()->noscript_shared_function_infos(); | 13330 Handle<Object> list = isolate->factory()->noscript_shared_function_infos(); |
13331 | 13331 |
13332 #ifdef DEBUG | 13332 #ifdef DEBUG |
13333 if (FLAG_enable_slow_asserts) { | 13333 if (FLAG_enable_slow_asserts) { |
13334 WeakFixedArray::Iterator iterator(*list); | 13334 WeakFixedArray::Iterator iterator(*list); |
13335 SharedFunctionInfo* next; | 13335 SharedFunctionInfo* next; |
13336 while ((next = iterator.Next<SharedFunctionInfo>())) { | 13336 while ((next = iterator.Next<SharedFunctionInfo>()) != nullptr) { |
13337 DCHECK_NE(next, *shared); | 13337 DCHECK_NE(next, *shared); |
13338 } | 13338 } |
13339 } | 13339 } |
13340 #endif // DEBUG | 13340 #endif // DEBUG |
13341 | 13341 |
13342 list = WeakFixedArray::Add(list, shared); | 13342 list = WeakFixedArray::Add(list, shared); |
13343 | 13343 |
13344 isolate->heap()->SetRootNoScriptSharedFunctionInfos(*list); | 13344 isolate->heap()->SetRootNoScriptSharedFunctionInfos(*list); |
13345 } | 13345 } |
13346 | 13346 |
(...skipping 6940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
20287 // depend on this. | 20287 // depend on this. |
20288 return DICTIONARY_ELEMENTS; | 20288 return DICTIONARY_ELEMENTS; |
20289 } | 20289 } |
20290 DCHECK_LE(kind, LAST_ELEMENTS_KIND); | 20290 DCHECK_LE(kind, LAST_ELEMENTS_KIND); |
20291 return kind; | 20291 return kind; |
20292 } | 20292 } |
20293 } | 20293 } |
20294 | 20294 |
20295 } // namespace internal | 20295 } // namespace internal |
20296 } // namespace v8 | 20296 } // namespace v8 |
OLD | NEW |