Commit 75bacb4a authored by tzik's avatar tzik Committed by Commit Bot

Reorganize parameters of Execution functions

This adds a MicrotaskQueue parameter to Execution::RunMicrotasks, and
propagate it to Invoke(). Also, reorganizes the existing and newly added
parameters into a struct.

Change-Id: Ib98009b97681fdb554c0a8d469be962aea4138bd
Reviewed-on: https://chromium-review.googlesource.com/c/1373210
Commit-Queue: Taiju Tsuiki <tzik@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58299}
parent cc494cd3
This diff is collapsed.
......@@ -11,6 +11,8 @@
namespace v8 {
namespace internal {
class MicrotaskQueue;
template <typename T>
class Handle;
......@@ -50,12 +52,11 @@ class Execution final : public AllStatic {
Handle<Object> receiver, int argc,
Handle<Object> argv[],
MessageHandling message_handling,
MaybeHandle<Object>* exception_out,
Target target = Target::kCallable);
MaybeHandle<Object>* exception_out);
// Convenience method for performing RunMicrotasks
static MaybeHandle<Object> RunMicrotasks(Isolate* isolate,
MessageHandling message_handling,
MaybeHandle<Object>* exception_out);
static MaybeHandle<Object> TryRunMicrotasks(
Isolate* isolate, MicrotaskQueue* microtask_queue,
MaybeHandle<Object>* exception_out);
};
......
......@@ -88,12 +88,8 @@ void MicrotaskQueue::EnqueueMicrotask(Microtask microtask) {
int MicrotaskQueue::RunMicrotasks(Isolate* isolate) {
HandleScope scope(isolate);
MaybeHandle<Object> maybe_exception;
// TODO(tzik): Execution::RunMicrotasks() runs default_microtask_queue.
// Give it as a parameter to support non-default MicrotaskQueue.
DCHECK_EQ(this, isolate->default_microtask_queue());
MaybeHandle<Object> maybe_result = Execution::RunMicrotasks(
isolate, Execution::MessageHandling::kReport, &maybe_exception);
MaybeHandle<Object> maybe_result =
Execution::TryRunMicrotasks(isolate, this, &maybe_exception);
// If execution is terminating, clean up and propagate that to the caller.
if (maybe_result.is_null() && maybe_exception.is_null()) {
......
......@@ -19222,8 +19222,7 @@ void JSWeakFactory::Cleanup(Handle<JSWeakFactory> weak_factory,
Execution::TryCall(
isolate, cleanup,
handle(ReadOnlyRoots(isolate).undefined_value(), isolate), 1, args,
Execution::MessageHandling::kReport, &exception,
Execution::Target::kCallable),
Execution::MessageHandling::kReport, &exception),
&result);
// TODO(marja): (spec): What if there's an exception?
USE(has_pending_exception);
......
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