Commit cade0f4b authored by gsathya's avatar gsathya Committed by Commit bot

[promises] move PromiseResolveThenableJob debugging code to runtime function

Moving the rest of the debugging code is blocked on making IsPromise inlinable.

BUG=v8:5343

Review-Url: https://chromiumcodereview.appspot.com/2431793003
Cr-Commit-Position: refs/heads/master@{#40440}
parent 91c99de0
......@@ -60,6 +60,7 @@
V(dot_result_string, ".result") \
V(dot_string, ".") \
V(entries_string, "entries") \
V(enqueue_string, "enqueue") \
V(enumerable_string, "enumerable") \
V(era_string, "era") \
V(Error_string, "Error") \
......@@ -125,6 +126,7 @@
V(preventExtensions_string, "preventExtensions") \
V(private_api_string, "private_api") \
V(Promise_string, "Promise") \
V(PromiseResolveThenableJob_string, "PromiseResolveThenableJob") \
V(proto_string, "__proto__") \
V(prototype_string, "prototype") \
V(Proxy_string, "Proxy") \
......
......@@ -295,18 +295,12 @@ function ResolvePromise(promise, resolution) {
if (IS_CALLABLE(then)) {
var callbacks = CreateResolvingFunctions(promise, false);
var id, name, instrumenting = DEBUG_IS_ACTIVE;
if (instrumenting) {
if (IsPromise(resolution)) {
if (DEBUG_IS_ACTIVE && IsPromise(resolution)) {
// Mark the dependency of the new promise on the resolution
SET_PRIVATE(resolution, promiseHandledBySymbol, promise);
}
id = %DebugNextMicrotaskId();
name = "PromiseResolveThenableJob";
%DebugAsyncTaskEvent("enqueue", id, name);
SET_PRIVATE(resolution, promiseHandledBySymbol, promise);
}
%EnqueuePromiseResolveThenableJob(
resolution, then, callbacks.resolve, callbacks.reject, id, name);
resolution, then, callbacks.resolve, callbacks.reject);
return;
}
}
......
......@@ -589,13 +589,24 @@ RUNTIME_FUNCTION(Runtime_EnqueuePromiseReactionJob) {
RUNTIME_FUNCTION(Runtime_EnqueuePromiseResolveThenableJob) {
HandleScope scope(isolate);
DCHECK(args.length() == 6);
DCHECK(args.length() == 4);
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, resolution, 0);
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, then, 1);
CONVERT_ARG_HANDLE_CHECKED(JSFunction, resolve, 2);
CONVERT_ARG_HANDLE_CHECKED(JSFunction, reject, 3);
CONVERT_ARG_HANDLE_CHECKED(Object, debug_id, 4);
CONVERT_ARG_HANDLE_CHECKED(Object, debug_name, 5);
Handle<Object> debug_id;
Handle<Object> debug_name;
if (isolate->debug()->is_active()) {
debug_id =
handle(Smi::FromInt(isolate->GetNextDebugMicrotaskId()), isolate);
debug_name = isolate->factory()->PromiseResolveThenableJob_string();
isolate->debug()->OnAsyncTaskEvent(isolate->factory()->enqueue_string(),
debug_id,
Handle<String>::cast(debug_name));
} else {
debug_id = isolate->factory()->undefined_value();
debug_name = isolate->factory()->undefined_value();
}
Handle<PromiseResolveThenableJobInfo> info =
isolate->factory()->NewPromiseResolveThenableJobInfo(
resolution, then, resolve, reject, debug_id, debug_name);
......
......@@ -291,7 +291,7 @@ namespace internal {
F(CreateListFromArrayLike, 1, 1) \
F(EnqueueMicrotask, 1, 1) \
F(EnqueuePromiseReactionJob, 5, 1) \
F(EnqueuePromiseResolveThenableJob, 6, 1) \
F(EnqueuePromiseResolveThenableJob, 4, 1) \
F(GetAndResetRuntimeCallStats, -1 /* <= 2 */, 1) \
F(ExportExperimentalFromRuntime, 1, 1) \
F(ExportFromRuntime, 1, 1) \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment