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

Side by Side Diff: src/global-handles.cc

Issue 1034473002: run phantom handle callbacks first (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/api.h" 7 #include "src/api.h"
8 #include "src/global-handles.h" 8 #include "src/global-handles.h"
9 9
10 #include "src/vm-state-inl.h" 10 #include "src/vm-state-inl.h"
(...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after
849 } 849 }
850 850
851 851
852 int GlobalHandles::PostGarbageCollectionProcessing(GarbageCollector collector) { 852 int GlobalHandles::PostGarbageCollectionProcessing(GarbageCollector collector) {
853 // Process weak global handle callbacks. This must be done after the 853 // Process weak global handle callbacks. This must be done after the
854 // GC is completely done, because the callbacks may invoke arbitrary 854 // GC is completely done, because the callbacks may invoke arbitrary
855 // API functions. 855 // API functions.
856 DCHECK(isolate_->heap()->gc_state() == Heap::NOT_IN_GC); 856 DCHECK(isolate_->heap()->gc_state() == Heap::NOT_IN_GC);
857 const int initial_post_gc_processing_count = ++post_gc_processing_count_; 857 const int initial_post_gc_processing_count = ++post_gc_processing_count_;
858 int freed_nodes = 0; 858 int freed_nodes = 0;
859 freed_nodes += DispatchPendingPhantomCallbacks();
860 if (initial_post_gc_processing_count != post_gc_processing_count_) {
861 // If the callbacks caused a nested GC, then return. See comment in
862 // PostScavengeProcessing.
863 return freed_nodes;
864 }
859 if (collector == SCAVENGER) { 865 if (collector == SCAVENGER) {
860 freed_nodes = PostScavengeProcessing(initial_post_gc_processing_count); 866 freed_nodes = PostScavengeProcessing(initial_post_gc_processing_count);
861 } else { 867 } else {
862 freed_nodes = PostMarkSweepProcessing(initial_post_gc_processing_count); 868 freed_nodes = PostMarkSweepProcessing(initial_post_gc_processing_count);
863 } 869 }
864 if (initial_post_gc_processing_count != post_gc_processing_count_) { 870 if (initial_post_gc_processing_count != post_gc_processing_count_) {
865 // If the callbacks caused a nested GC, then return. See comment in 871 // If the callbacks caused a nested GC, then return. See comment in
866 // PostScavengeProcessing. 872 // PostScavengeProcessing.
867 return freed_nodes; 873 return freed_nodes;
868 } 874 }
869 freed_nodes += DispatchPendingPhantomCallbacks();
870 if (initial_post_gc_processing_count == post_gc_processing_count_) { 875 if (initial_post_gc_processing_count == post_gc_processing_count_) {
871 UpdateListOfNewSpaceNodes(); 876 UpdateListOfNewSpaceNodes();
872 } 877 }
873 return freed_nodes; 878 return freed_nodes;
874 } 879 }
875 880
876 881
877 void GlobalHandles::PendingPhantomCallback::invoke() { 882 void GlobalHandles::PendingPhantomCallback::invoke() {
878 if (node_->state() == Node::FREE) return; 883 if (node_->state() == Node::FREE) return;
879 DCHECK(node_->state() == Node::NEAR_DEATH); 884 DCHECK(node_->state() == Node::NEAR_DEATH);
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
1239 DCHECK_EQ(isolate->heap()->the_hole_value(), blocks_[block][offset]); 1244 DCHECK_EQ(isolate->heap()->the_hole_value(), blocks_[block][offset]);
1240 blocks_[block][offset] = object; 1245 blocks_[block][offset] = object;
1241 if (isolate->heap()->InNewSpace(object)) { 1246 if (isolate->heap()->InNewSpace(object)) {
1242 new_space_indices_.Add(size_); 1247 new_space_indices_.Add(size_);
1243 } 1248 }
1244 *index = size_++; 1249 *index = size_++;
1245 } 1250 }
1246 1251
1247 1252
1248 } } // namespace v8::internal 1253 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698