OLD | NEW |
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 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 public: | 500 public: |
501 // Takes ownership of the contents of pending_phantom_callbacks, leaving it in | 501 // Takes ownership of the contents of pending_phantom_callbacks, leaving it in |
502 // the same state it would be after a call to Clear(). | 502 // the same state it would be after a call to Clear(). |
503 PendingPhantomCallbacksSecondPassTask( | 503 PendingPhantomCallbacksSecondPassTask( |
504 List<PendingPhantomCallback>* pending_phantom_callbacks, Isolate* isolate) | 504 List<PendingPhantomCallback>* pending_phantom_callbacks, Isolate* isolate) |
505 : CancelableTask(isolate) { | 505 : CancelableTask(isolate) { |
506 pending_phantom_callbacks_.Swap(pending_phantom_callbacks); | 506 pending_phantom_callbacks_.Swap(pending_phantom_callbacks); |
507 } | 507 } |
508 | 508 |
509 void RunInternal() override { | 509 void RunInternal() override { |
| 510 isolate_->heap()->CallGCPrologueCallbacks( |
| 511 GCType::kGCTypeProcessWeakCallbacks, kNoGCCallbackFlags); |
510 InvokeSecondPassPhantomCallbacks(&pending_phantom_callbacks_, isolate_); | 512 InvokeSecondPassPhantomCallbacks(&pending_phantom_callbacks_, isolate_); |
| 513 isolate_->heap()->CallGCEpilogueCallbacks( |
| 514 GCType::kGCTypeProcessWeakCallbacks, kNoGCCallbackFlags); |
511 } | 515 } |
512 | 516 |
513 private: | 517 private: |
514 List<PendingPhantomCallback> pending_phantom_callbacks_; | 518 List<PendingPhantomCallback> pending_phantom_callbacks_; |
515 | 519 |
516 DISALLOW_COPY_AND_ASSIGN(PendingPhantomCallbacksSecondPassTask); | 520 DISALLOW_COPY_AND_ASSIGN(PendingPhantomCallbacksSecondPassTask); |
517 }; | 521 }; |
518 | 522 |
519 | 523 |
520 GlobalHandles::GlobalHandles(Isolate* isolate) | 524 GlobalHandles::GlobalHandles(Isolate* isolate) |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
834 i != pending_phantom_callbacks_.end(); ++i) { | 838 i != pending_phantom_callbacks_.end(); ++i) { |
835 auto callback = i; | 839 auto callback = i; |
836 // Skip callbacks that have already been processed once. | 840 // Skip callbacks that have already been processed once. |
837 if (callback->node() == nullptr) continue; | 841 if (callback->node() == nullptr) continue; |
838 callback->Invoke(isolate()); | 842 callback->Invoke(isolate()); |
839 freed_nodes++; | 843 freed_nodes++; |
840 } | 844 } |
841 } | 845 } |
842 if (pending_phantom_callbacks_.length() > 0) { | 846 if (pending_phantom_callbacks_.length() > 0) { |
843 if (FLAG_optimize_for_size || FLAG_predictable || synchronous_second_pass) { | 847 if (FLAG_optimize_for_size || FLAG_predictable || synchronous_second_pass) { |
| 848 isolate()->heap()->CallGCPrologueCallbacks( |
| 849 GCType::kGCTypeProcessWeakCallbacks, kNoGCCallbackFlags); |
844 InvokeSecondPassPhantomCallbacks(&pending_phantom_callbacks_, isolate()); | 850 InvokeSecondPassPhantomCallbacks(&pending_phantom_callbacks_, isolate()); |
| 851 isolate()->heap()->CallGCEpilogueCallbacks( |
| 852 GCType::kGCTypeProcessWeakCallbacks, kNoGCCallbackFlags); |
845 } else { | 853 } else { |
846 auto task = new PendingPhantomCallbacksSecondPassTask( | 854 auto task = new PendingPhantomCallbacksSecondPassTask( |
847 &pending_phantom_callbacks_, isolate()); | 855 &pending_phantom_callbacks_, isolate()); |
848 V8::GetCurrentPlatform()->CallOnForegroundThread( | 856 V8::GetCurrentPlatform()->CallOnForegroundThread( |
849 reinterpret_cast<v8::Isolate*>(isolate()), task); | 857 reinterpret_cast<v8::Isolate*>(isolate()), task); |
850 } | 858 } |
851 } | 859 } |
852 pending_phantom_callbacks_.Clear(); | 860 pending_phantom_callbacks_.Clear(); |
853 return freed_nodes; | 861 return freed_nodes; |
854 } | 862 } |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1267 blocks_[block][offset] = object; | 1275 blocks_[block][offset] = object; |
1268 if (isolate->heap()->InNewSpace(object)) { | 1276 if (isolate->heap()->InNewSpace(object)) { |
1269 new_space_indices_.Add(size_); | 1277 new_space_indices_.Add(size_); |
1270 } | 1278 } |
1271 *index = size_++; | 1279 *index = size_++; |
1272 } | 1280 } |
1273 | 1281 |
1274 | 1282 |
1275 } // namespace internal | 1283 } // namespace internal |
1276 } // namespace v8 | 1284 } // namespace v8 |
OLD | NEW |