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

Unified Diff: src/runtime/runtime-debug.cc

Issue 2578923002: [inspector] async stacks for Promise.then calls... (Closed)
Patch Set: avoid calling functions Created 3 years, 11 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/runtime/runtime.h ('k') | src/runtime/runtime-promise.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-debug.cc
diff --git a/src/runtime/runtime-debug.cc b/src/runtime/runtime-debug.cc
index fe8ae95d3b85d97abc1159e64f6c2a113eb363dd..59ae9d49b8ec200be613a1de8845d38d069c2d12 100644
--- a/src/runtime/runtime-debug.cc
+++ b/src/runtime/runtime-debug.cc
@@ -1889,24 +1889,43 @@ RUNTIME_FUNCTION(Runtime_DebugPopPromise) {
return isolate->heap()->undefined_value();
}
-RUNTIME_FUNCTION(Runtime_DebugNextMicrotaskId) {
+RUNTIME_FUNCTION(Runtime_DebugNextAsyncTaskId) {
HandleScope scope(isolate);
- DCHECK_EQ(0, args.length());
- return Smi::FromInt(isolate->GetNextDebugMicrotaskId());
+ DCHECK_EQ(1, args.length());
+ CONVERT_ARG_HANDLE_CHECKED(JSObject, promise, 0);
+ return Smi::FromInt(isolate->debug()->NextAsyncTaskId(promise));
}
-RUNTIME_FUNCTION(Runtime_DebugAsyncTaskEvent) {
- DCHECK_EQ(3, args.length());
+RUNTIME_FUNCTION(Runtime_DebugAsyncFunctionPromiseCreated) {
+ DCHECK_EQ(1, args.length());
HandleScope scope(isolate);
- CONVERT_SMI_ARG_CHECKED(type, 0);
- CONVERT_SMI_ARG_CHECKED(id, 1);
- CONVERT_SMI_ARG_CHECKED(name, 2);
- isolate->debug()->OnAsyncTaskEvent(static_cast<PromiseDebugActionType>(type),
- id,
- static_cast<PromiseDebugActionName>(name));
+ CONVERT_ARG_HANDLE_CHECKED(JSObject, promise, 0);
+ isolate->PushPromise(promise);
+ int id = isolate->debug()->NextAsyncTaskId(promise);
+ Handle<Symbol> async_stack_id_symbol =
+ isolate->factory()->promise_async_stack_id_symbol();
+ JSObject::SetProperty(promise, async_stack_id_symbol,
+ handle(Smi::FromInt(id), isolate), STRICT)
+ .Assert();
+ isolate->debug()->OnAsyncTaskEvent(debug::kDebugEnqueueRecurring, id,
+ kDebugAsyncFunction);
return isolate->heap()->undefined_value();
}
+RUNTIME_FUNCTION(Runtime_DebugAsyncEventEnqueueRecurring) {
+ HandleScope scope(isolate);
+ DCHECK_EQ(2, args.length());
+ CONVERT_ARG_HANDLE_CHECKED(JSPromise, promise, 0);
+ CONVERT_SMI_ARG_CHECKED(status, 1);
+ if (isolate->debug()->is_active()) {
+ isolate->debug()->OnAsyncTaskEvent(
+ debug::kDebugEnqueueRecurring,
+ isolate->debug()->NextAsyncTaskId(promise),
+ status == v8::Promise::kFulfilled ? kDebugPromiseResolve
+ : kDebugPromiseReject);
+ }
+ return isolate->heap()->undefined_value();
+}
RUNTIME_FUNCTION(Runtime_DebugIsActive) {
SealHandleScope shs(isolate);
« no previous file with comments | « src/runtime/runtime.h ('k') | src/runtime/runtime-promise.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698