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 @@ ...@@ -11,6 +11,8 @@
namespace v8 { namespace v8 {
namespace internal { namespace internal {
class MicrotaskQueue;
template <typename T> template <typename T>
class Handle; class Handle;
...@@ -50,12 +52,11 @@ class Execution final : public AllStatic { ...@@ -50,12 +52,11 @@ class Execution final : public AllStatic {
Handle<Object> receiver, int argc, Handle<Object> receiver, int argc,
Handle<Object> argv[], Handle<Object> argv[],
MessageHandling message_handling, MessageHandling message_handling,
MaybeHandle<Object>* exception_out, MaybeHandle<Object>* exception_out);
Target target = Target::kCallable);
// Convenience method for performing RunMicrotasks // Convenience method for performing RunMicrotasks
static MaybeHandle<Object> RunMicrotasks(Isolate* isolate, static MaybeHandle<Object> TryRunMicrotasks(
MessageHandling message_handling, Isolate* isolate, MicrotaskQueue* microtask_queue,
MaybeHandle<Object>* exception_out); MaybeHandle<Object>* exception_out);
}; };
......
...@@ -88,12 +88,8 @@ void MicrotaskQueue::EnqueueMicrotask(Microtask microtask) { ...@@ -88,12 +88,8 @@ void MicrotaskQueue::EnqueueMicrotask(Microtask microtask) {
int MicrotaskQueue::RunMicrotasks(Isolate* isolate) { int MicrotaskQueue::RunMicrotasks(Isolate* isolate) {
HandleScope scope(isolate); HandleScope scope(isolate);
MaybeHandle<Object> maybe_exception; MaybeHandle<Object> maybe_exception;
MaybeHandle<Object> maybe_result =
// TODO(tzik): Execution::RunMicrotasks() runs default_microtask_queue. Execution::TryRunMicrotasks(isolate, this, &maybe_exception);
// 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);
// If execution is terminating, clean up and propagate that to the caller. // If execution is terminating, clean up and propagate that to the caller.
if (maybe_result.is_null() && maybe_exception.is_null()) { if (maybe_result.is_null() && maybe_exception.is_null()) {
......
...@@ -19222,8 +19222,7 @@ void JSWeakFactory::Cleanup(Handle<JSWeakFactory> weak_factory, ...@@ -19222,8 +19222,7 @@ void JSWeakFactory::Cleanup(Handle<JSWeakFactory> weak_factory,
Execution::TryCall( Execution::TryCall(
isolate, cleanup, isolate, cleanup,
handle(ReadOnlyRoots(isolate).undefined_value(), isolate), 1, args, handle(ReadOnlyRoots(isolate).undefined_value(), isolate), 1, args,
Execution::MessageHandling::kReport, &exception, Execution::MessageHandling::kReport, &exception),
Execution::Target::kCallable),
&result); &result);
// TODO(marja): (spec): What if there's an exception? // TODO(marja): (spec): What if there's an exception?
USE(has_pending_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