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

Unified Diff: src/isolate.cc

Issue 1125383007: Postpone counters triggered during GC, and use a HandleScope when calling back. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Codereview feedback Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/heap/heap.cc ('k') | test/cctest/test-heap.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/isolate.cc
diff --git a/src/isolate.cc b/src/isolate.cc
index d53d0d8d327829cd50abe69e6ae4213546008648..69a4f8d274d6cba4db56e5520f1b3505bc6bf8a3 100644
--- a/src/isolate.cc
+++ b/src/isolate.cc
@@ -2669,8 +2669,15 @@ void Isolate::SetUseCounterCallback(v8::Isolate::UseCounterCallback callback) {
void Isolate::CountUsage(v8::Isolate::UseCounterFeature feature) {
- if (use_counter_callback_) {
- use_counter_callback_(reinterpret_cast<v8::Isolate*>(this), feature);
+ // The counter callback may cause the embedder to call into V8, which is not
+ // generally possible during GC.
+ if (heap_.gc_state() == Heap::NOT_IN_GC) {
+ if (use_counter_callback_) {
+ HandleScope handle_scope(this);
+ use_counter_callback_(reinterpret_cast<v8::Isolate*>(this), feature);
+ }
+ } else {
+ heap_.IncrementDeferredCount(feature);
}
}
« no previous file with comments | « src/heap/heap.cc ('k') | test/cctest/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698