| 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);
|
| }
|
| }
|
|
|
|
|