Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(302)

Side by Side Diff: src/api.cc

Issue 2020363002: Revert of [heap] Do not invoke GC to make heap iterable. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/debug/debug.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/api.h" 5 #include "src/api.h"
6 6
7 #include <string.h> // For memcpy, strlen. 7 #include <string.h> // For memcpy, strlen.
8 #ifdef V8_USE_ADDRESS_SANITIZER 8 #ifdef V8_USE_ADDRESS_SANITIZER
9 #include <sanitizer/asan_interface.h> 9 #include <sanitizer/asan_interface.h>
10 #endif // V8_USE_ADDRESS_SANITIZER 10 #endif // V8_USE_ADDRESS_SANITIZER
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 390
391 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); 391 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
392 392
393 // If we don't do this then we end up with a stray root pointing at the 393 // If we don't do this then we end up with a stray root pointing at the
394 // context even after we have disposed of the context. 394 // context even after we have disposed of the context.
395 internal_isolate->heap()->CollectAllAvailableGarbage("mksnapshot"); 395 internal_isolate->heap()->CollectAllAvailableGarbage("mksnapshot");
396 396
397 // GC may have cleared weak cells, so compact any WeakFixedArrays 397 // GC may have cleared weak cells, so compact any WeakFixedArrays
398 // found on the heap. 398 // found on the heap.
399 i::HeapIterator iterator(internal_isolate->heap(), 399 i::HeapIterator iterator(internal_isolate->heap(),
400 i::HeapObjectsFiltering::kFilterUnreachable); 400 i::HeapIterator::kFilterUnreachable);
401 for (i::HeapObject* o = iterator.next(); o != NULL; o = iterator.next()) { 401 for (i::HeapObject* o = iterator.next(); o != NULL; o = iterator.next()) {
402 if (o->IsPrototypeInfo()) { 402 if (o->IsPrototypeInfo()) {
403 i::Object* prototype_users = i::PrototypeInfo::cast(o)->prototype_users(); 403 i::Object* prototype_users = i::PrototypeInfo::cast(o)->prototype_users();
404 if (prototype_users->IsWeakFixedArray()) { 404 if (prototype_users->IsWeakFixedArray()) {
405 i::WeakFixedArray* array = i::WeakFixedArray::cast(prototype_users); 405 i::WeakFixedArray* array = i::WeakFixedArray::cast(prototype_users);
406 array->Compact<i::JSObject::PrototypeRegistryCompactionCallback>(); 406 array->Compact<i::JSObject::PrototypeRegistryCompactionCallback>();
407 } 407 }
408 } else if (o->IsScript()) { 408 } else if (o->IsScript()) {
409 i::Object* shared_list = i::Script::cast(o)->shared_function_infos(); 409 i::Object* shared_list = i::Script::cast(o)->shared_function_infos();
410 if (shared_list->IsWeakFixedArray()) { 410 if (shared_list->IsWeakFixedArray()) {
(...skipping 8387 matching lines...) Expand 10 before | Expand all | Expand 10 after
8798 Address callback_address = 8798 Address callback_address =
8799 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 8799 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
8800 VMState<EXTERNAL> state(isolate); 8800 VMState<EXTERNAL> state(isolate);
8801 ExternalCallbackScope call_scope(isolate, callback_address); 8801 ExternalCallbackScope call_scope(isolate, callback_address);
8802 callback(info); 8802 callback(info);
8803 } 8803 }
8804 8804
8805 8805
8806 } // namespace internal 8806 } // namespace internal
8807 } // namespace v8 8807 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/debug/debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698