Index: Source/bindings/v8/V8RecursionScope.cpp |
diff --git a/Source/bindings/v8/V8RecursionScope.cpp b/Source/bindings/v8/V8RecursionScope.cpp |
index ab09a3b70d3bd1ec6c8d96bd238075d32a0784e5..9d0489248a5c952f315f18f0709d68ee9a75c661 100644 |
--- a/Source/bindings/v8/V8RecursionScope.cpp |
+++ b/Source/bindings/v8/V8RecursionScope.cpp |
@@ -32,6 +32,8 @@ |
#include "bindings/v8/V8RecursionScope.h" |
#include "core/dom/Microtask.h" |
+#include "core/inspector/InspectorInstrumentation.h" |
+#include "core/inspector/ScriptCallStack.h" |
#include "modules/indexeddb/IDBPendingTransactionMonitor.h" |
namespace WebCore { |
@@ -45,4 +47,17 @@ void V8RecursionScope::didLeaveScriptContext() |
IDBPendingTransactionMonitor::from(*m_executionContext).deactivateNewTransactions(); |
} |
+void V8RecursionScope::trackStackDepth(V8PerIsolateData* isolateData) |
+{ |
+ StackTraceTimestampTracker* tracker = isolateData->stackTraceTimestampTracker(); |
+ // FIXMEDART: implement a more efficient way to measure the current V8 |
+ // stack trace depth than calling v8::StackTrace::CurrentStackTrace. |
+ // The current implementation will not slow down V8 when the |
+ // devtools are closed but could have a significant performance impact |
+ // when the devtools are open for code that dispatches a lot of synchronous |
+ // messages or relies heavily on Dart-JS interop. |
+ tracker->incrementRecursionLevel(InspectorInstrumentation::hasFrontends() && tracker->recursionLevel() > 0 ? |
+ v8::StackTrace::CurrentStackTrace(m_isolate, ScriptCallStack::maxCallStackSizeToCapture)->GetFrameCount() : 0); |
+} |
+ |
} // namespace WebCore |