Commit 07011cc4 authored by tzik's avatar tzik Committed by Commit Bot

Replace %RunMicrotasks with %PerformMicrotaskCheckpoint

This replaces Runtime_RunMicrotasks with Runtime_PerformMicrotaskCheckpoint.

RunMicrotasks forcibly runs Microtasks even when the microtasks are suppressed,
and may causes nested Microtasks in a problematic way. E.g. that confuses
v8::MicrotasksScope::IsRunningMicrotasks() and GetEnteredOrMicrotaskContext().

OTOH, PerformMicrotaskCheckpoint() doesn't run cause the failure as it
respects the microtask suppressions.

As all existing tests don't call RunMicrotasks() in the suppressed situation
(like Promise.resolve().then(()=>{%RunMicrotasks();})), this change should
not affect to these tests.

Change-Id: Ib043a0cc8e482e022d375084d65ea98a6f54ef3d
Reviewed-on: https://chromium-review.googlesource.com/c/1360095Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
Commit-Queue: Taiju Tsuiki <tzik@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58068}
parent 157af788
...@@ -80,10 +80,10 @@ RUNTIME_FUNCTION(Runtime_EnqueueMicrotask) { ...@@ -80,10 +80,10 @@ RUNTIME_FUNCTION(Runtime_EnqueueMicrotask) {
return ReadOnlyRoots(isolate).undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
RUNTIME_FUNCTION(Runtime_RunMicrotasks) { RUNTIME_FUNCTION(Runtime_PerformMicrotaskCheckpoint) {
HandleScope scope(isolate); HandleScope scope(isolate);
DCHECK_EQ(0, args.length()); DCHECK_EQ(0, args.length());
isolate->RunMicrotasks(); MicrotasksScope::PerformCheckpoint(reinterpret_cast<v8::Isolate*>(isolate));
return ReadOnlyRoots(isolate).undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
......
...@@ -230,7 +230,7 @@ namespace internal { ...@@ -230,7 +230,7 @@ namespace internal {
F(ReportMessage, 1, 1) \ F(ReportMessage, 1, 1) \
F(ReThrow, 1, 1) \ F(ReThrow, 1, 1) \
F(RunMicrotaskCallback, 2, 1) \ F(RunMicrotaskCallback, 2, 1) \
F(RunMicrotasks, 0, 1) \ F(PerformMicrotaskCheckpoint, 0, 1) \
F(StackGuard, 0, 1) \ F(StackGuard, 0, 1) \
F(Throw, 1, 1) \ F(Throw, 1, 1) \
F(ThrowApplyNonFunction, 1, 1) \ F(ThrowApplyNonFunction, 1, 1) \
......
...@@ -51,7 +51,7 @@ LogX("start")(); ...@@ -51,7 +51,7 @@ LogX("start")();
// Make sure that the debug event listener was invoked. // Make sure that the debug event listener was invoked.
assertTrue(listenerComplete); assertTrue(listenerComplete);
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
var expectation = var expectation =
[ "[0] debugger", "[1] start", "[1] then 1", [ "[0] debugger", "[1] start", "[1] then 1",
......
...@@ -39,4 +39,4 @@ function listener(event, exec_state, event_data, data) {} ...@@ -39,4 +39,4 @@ function listener(event, exec_state, event_data, data) {}
Debug.setBreakOnUncaughtException(); Debug.setBreakOnUncaughtException();
Debug.setListener(listener); Debug.setListener(listener);
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
...@@ -40,22 +40,22 @@ function bar(a,b) { ...@@ -40,22 +40,22 @@ function bar(a,b) {
} }
foo(); foo();
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
foo(); foo();
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
%OptimizeFunctionOnNextCall(foo); %OptimizeFunctionOnNextCall(foo);
// bar likely gets inlined into foo. // bar likely gets inlined into foo.
foo(); foo();
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
%NeverOptimizeFunction(bar); %NeverOptimizeFunction(bar);
%OptimizeFunctionOnNextCall(foo); %OptimizeFunctionOnNextCall(foo);
// bar does not get inlined into foo. // bar does not get inlined into foo.
foo(); foo();
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertEquals(0, expected_events); assertEquals(0, expected_events);
...@@ -57,7 +57,7 @@ async function foo() { ...@@ -57,7 +57,7 @@ async function foo() {
foo(); foo();
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
Debug.setListener(null); Debug.setListener(null);
Debug.clearBreakOnException(); Debug.clearBreakOnException();
......
...@@ -197,7 +197,7 @@ function runPart(n) { ...@@ -197,7 +197,7 @@ function runPart(n) {
events = 0; events = 0;
consumer(producer); consumer(producer);
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
Debug.setListener(null); Debug.setListener(null);
if (caught) { if (caught) {
......
...@@ -37,7 +37,7 @@ log = []; ...@@ -37,7 +37,7 @@ log = [];
Debug.setListener(listener); Debug.setListener(listener);
Debug.setBreakOnException(); Debug.setBreakOnException();
caught_throw(); caught_throw();
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
Debug.setListener(null); Debug.setListener(null);
Debug.clearBreakOnException(); Debug.clearBreakOnException();
assertEquals(["a"], log); assertEquals(["a"], log);
...@@ -48,7 +48,7 @@ log = []; ...@@ -48,7 +48,7 @@ log = [];
Debug.setListener(listener); Debug.setListener(listener);
Debug.setBreakOnUncaughtException(); Debug.setBreakOnUncaughtException();
caught_throw(); caught_throw();
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
Debug.setListener(null); Debug.setListener(null);
Debug.clearBreakOnUncaughtException(); Debug.clearBreakOnUncaughtException();
assertEquals([], log); assertEquals([], log);
...@@ -69,7 +69,7 @@ log = []; ...@@ -69,7 +69,7 @@ log = [];
Debug.setListener(listener); Debug.setListener(listener);
Debug.setBreakOnException(); Debug.setBreakOnException();
caught_reject(); caught_reject();
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
Debug.setListener(null); Debug.setListener(null);
Debug.clearBreakOnException(); Debug.clearBreakOnException();
assertEquals([], log); assertEquals([], log);
...@@ -80,7 +80,7 @@ log = []; ...@@ -80,7 +80,7 @@ log = [];
Debug.setListener(listener); Debug.setListener(listener);
Debug.setBreakOnUncaughtException(); Debug.setBreakOnUncaughtException();
caught_reject(); caught_reject();
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
Debug.setListener(null); Debug.setListener(null);
Debug.clearBreakOnUncaughtException(); Debug.clearBreakOnUncaughtException();
assertEquals([], log); assertEquals([], log);
...@@ -95,7 +95,7 @@ async function propagate_inner() { return thrower(); } ...@@ -95,7 +95,7 @@ async function propagate_inner() { return thrower(); }
async function propagate_outer() { return propagate_inner(); } async function propagate_outer() { return propagate_inner(); }
propagate_outer(); propagate_outer();
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertEquals(["a"], log); assertEquals(["a"], log);
assertNull(exception); assertNull(exception);
...@@ -104,7 +104,7 @@ log = []; ...@@ -104,7 +104,7 @@ log = [];
async function propagate_await() { await 1; return thrower(); } async function propagate_await() { await 1; return thrower(); }
async function propagate_await_outer() { return propagate_await(); } async function propagate_await_outer() { return propagate_await(); }
propagate_await_outer(); propagate_await_outer();
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertEquals(["a"], log); assertEquals(["a"], log);
assertNull(exception); assertNull(exception);
...@@ -113,7 +113,7 @@ Debug.setBreakOnUncaughtException(); ...@@ -113,7 +113,7 @@ Debug.setBreakOnUncaughtException();
log = []; log = [];
Promise.resolve().then(() => Promise.reject()).catch(() => log.push("d")); // Exception c Promise.resolve().then(() => Promise.reject()).catch(() => log.push("d")); // Exception c
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertEquals(["d"], log); assertEquals(["d"], log);
assertNull(exception); assertNull(exception);
......
...@@ -48,6 +48,6 @@ debugger; // B3 StepNext ...@@ -48,6 +48,6 @@ debugger; // B3 StepNext
late_resolve(3); // B4 Continue late_resolve(3); // B4 Continue
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertEquals(5, step_count); assertEquals(5, step_count);
...@@ -48,6 +48,6 @@ debugger; // B3 Continue ...@@ -48,6 +48,6 @@ debugger; // B3 Continue
late_resolve(3); late_resolve(3);
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertEquals(5, step_count); assertEquals(5, step_count);
...@@ -44,6 +44,6 @@ f(); ...@@ -44,6 +44,6 @@ f();
late_resolve(3); late_resolve(3);
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertEquals(4, step_count); assertEquals(4, step_count);
...@@ -44,6 +44,6 @@ f(); ...@@ -44,6 +44,6 @@ f();
late_resolve(3); late_resolve(3);
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertEquals(4, step_count); assertEquals(4, step_count);
...@@ -44,6 +44,6 @@ f().then(value => assertEquals(4, value)); ...@@ -44,6 +44,6 @@ f().then(value => assertEquals(4, value));
late_resolve(3); late_resolve(3);
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertEquals(7, step_count); assertEquals(7, step_count);
...@@ -51,6 +51,6 @@ f1(); ...@@ -51,6 +51,6 @@ f1();
late_resolve(3); late_resolve(3);
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertEquals(6, step_count); assertEquals(6, step_count);
...@@ -32,6 +32,6 @@ async function f() { ...@@ -32,6 +32,6 @@ async function f() {
f(); f();
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertEquals(3, step_count); assertEquals(3, step_count);
...@@ -44,6 +44,6 @@ f(); ...@@ -44,6 +44,6 @@ f();
late_resolve(3); late_resolve(3);
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertEquals(3, step_count); assertEquals(3, step_count);
...@@ -42,6 +42,6 @@ f(); ...@@ -42,6 +42,6 @@ f();
late_resolve(3); // B2 Continue late_resolve(3); // B2 Continue
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertEquals(3, step_count); assertEquals(3, step_count);
...@@ -21,7 +21,7 @@ function assertEqualsAsync(expected, run, msg) { ...@@ -21,7 +21,7 @@ function assertEqualsAsync(expected, run, msg) {
assertFalse(hadValue || hadError); assertFalse(hadValue || hadError);
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
if (hadError) throw actual; if (hadError) throw actual;
...@@ -67,7 +67,7 @@ function setbreaks() { ...@@ -67,7 +67,7 @@ function setbreaks() {
f(); f();
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertEqualsAsync(2, async () => break_count); assertEqualsAsync(2, async () => break_count);
assertEqualsAsync(null, async () => exception); assertEqualsAsync(null, async () => exception);
......
...@@ -21,7 +21,7 @@ function assertEqualsAsync(expected, run, msg) { ...@@ -21,7 +21,7 @@ function assertEqualsAsync(expected, run, msg) {
assertFalse(hadValue || hadError); assertFalse(hadValue || hadError);
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
if (hadError) throw actual; if (hadError) throw actual;
...@@ -65,7 +65,7 @@ Debug.setBreakPoint(f, 5); ...@@ -65,7 +65,7 @@ Debug.setBreakPoint(f, 5);
f(); f();
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertEqualsAsync(3, async () => break_count); assertEqualsAsync(3, async () => break_count);
assertEqualsAsync(null, async () => exception); assertEqualsAsync(null, async () => exception);
......
...@@ -94,7 +94,7 @@ function patch(fun, from, to) { ...@@ -94,7 +94,7 @@ function patch(fun, from, to) {
assertPromiseValue("Cat", promise); assertPromiseValue("Cat", promise);
assertTrue(patch_attempted); assertTrue(patch_attempted);
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
// At this point one iterator is live, but closed, so the patch will succeed. // At this point one iterator is live, but closed, so the patch will succeed.
patch(asyncfn, "'Cat'", "'Capybara'"); patch(asyncfn, "'Cat'", "'Capybara'");
...@@ -143,4 +143,4 @@ function patch(fun, from, to) { ...@@ -143,4 +143,4 @@ function patch(fun, from, to) {
})); }));
})(); })();
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
...@@ -35,7 +35,7 @@ Promise.resolve() ...@@ -35,7 +35,7 @@ Promise.resolve()
.finally(() => thenable) .finally(() => thenable)
.catch(e => caughtException = e); .catch(e => caughtException = e);
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
Debug.setListener(null); Debug.setListener(null);
Debug.clearBreakOnException(); Debug.clearBreakOnException();
......
...@@ -160,10 +160,10 @@ function Setup() { ...@@ -160,10 +160,10 @@ function Setup() {
return a; return a;
})(); })();
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
} }
function Basic() { function Basic() {
a(); a();
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
} }
...@@ -34,7 +34,7 @@ function Setup() { ...@@ -34,7 +34,7 @@ function Setup() {
b = function b(p) { return p; }; b = function b(p) { return p; };
a = function a(p) { return p; }; a = function a(p) { return p; };
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
} }
function Basic() { function Basic() {
...@@ -48,5 +48,5 @@ function Basic() { ...@@ -48,5 +48,5 @@ function Basic() {
.then(c) .then(c)
.then(b) .then(b)
.then(a); .then(a);
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
} }
...@@ -34,10 +34,10 @@ function Setup() { ...@@ -34,10 +34,10 @@ function Setup() {
b = async function b() { return c(); }; b = async function b() { return c(); };
a = async function a() { return b(); }; a = async function a() { return b(); };
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
} }
function Basic() { function Basic() {
a(); a();
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
} }
...@@ -69,7 +69,7 @@ function AsyncStacksInstrumentation() { ...@@ -69,7 +69,7 @@ function AsyncStacksInstrumentation() {
p = p.then(nopCallback); p = p.then(nopCallback);
} }
p = p.then(() => done = true); p = p.then(() => done = true);
while (!done) %RunMicrotasks(); while (!done) %PerformMicrotaskCheckpoint();
} }
})(); })();
...@@ -23,21 +23,21 @@ const iterations = 10000; ...@@ -23,21 +23,21 @@ const iterations = 10000;
function BasicExport() { function BasicExport() {
let success = false; let success = false;
import("basic-export.js").then(m => { m.bench(); success = true; }); import("basic-export.js").then(m => { m.bench(); success = true; });
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
if (!success) throw new Error(666); if (!success) throw new Error(666);
} }
function BasicImport() { function BasicImport() {
let success = false; let success = false;
import("basic-import.js").then(m => { m.bench(); success = true; }); import("basic-import.js").then(m => { m.bench(); success = true; });
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
if (!success) throw new Error(666); if (!success) throw new Error(666);
} }
function BasicNamespace() { function BasicNamespace() {
let success = false; let success = false;
import("basic-namespace.js").then(m => { m.bench(); success = true; }); import("basic-namespace.js").then(m => { m.bench(); success = true; });
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
if (!success) throw new Error(666); if (!success) throw new Error(666);
} }
......
...@@ -213,7 +213,7 @@ TestCoverage( ...@@ -213,7 +213,7 @@ TestCoverage(
nop(); // 0100 nop(); // 0100
} // 0150 } // 0150
}(); // 0200 }(); // 0200
%RunMicrotasks(); // 0250 %PerformMicrotaskCheckpoint(); // 0250
`, `,
[{"start":0,"end":299,"count":1}, [{"start":0,"end":299,"count":1},
{"start":1,"end":201,"count":6}, // TODO(jgruber): Invocation count is off. {"start":1,"end":201,"count":6}, // TODO(jgruber): Invocation count is off.
...@@ -662,7 +662,7 @@ async function f() { // 0000 ...@@ -662,7 +662,7 @@ async function f() { // 0000
await 42; // 0100 await 42; // 0100
}; // 0150 }; // 0150
f(); // 0200 f(); // 0200
%RunMicrotasks(); // 0250 %PerformMicrotaskCheckpoint(); // 0250
`, `,
[{"start":0,"end":299,"count":1}, [{"start":0,"end":299,"count":1},
{"start":0,"end":151,"count":3}, {"start":0,"end":151,"count":3},
......
...@@ -40,7 +40,7 @@ function assertArrayValues(expected, actual) { ...@@ -40,7 +40,7 @@ function assertArrayValues(expected, actual) {
} }
function assertOrdering(expected) { function assertOrdering(expected) {
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertArrayValues(expected, ordering); assertArrayValues(expected, ordering);
} }
......
...@@ -21,7 +21,7 @@ function assertEqualsAsync(expected, run, msg) { ...@@ -21,7 +21,7 @@ function assertEqualsAsync(expected, run, msg) {
assertFalse(hadValue || hadError); assertFalse(hadValue || hadError);
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
if (hadError) throw actual; if (hadError) throw actual;
......
...@@ -21,7 +21,7 @@ function assertEqualsAsync(expected, run, msg) { ...@@ -21,7 +21,7 @@ function assertEqualsAsync(expected, run, msg) {
assertFalse(hadValue || hadError); assertFalse(hadValue || hadError);
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
if (hadError) throw actual; if (hadError) throw actual;
......
...@@ -21,7 +21,7 @@ function assertEqualsAsync(expected, run, msg) { ...@@ -21,7 +21,7 @@ function assertEqualsAsync(expected, run, msg) {
assertFalse(hadValue || hadError); assertFalse(hadValue || hadError);
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
if (hadError) throw actual; if (hadError) throw actual;
......
...@@ -21,7 +21,7 @@ function assertEqualsAsync(expected, run, msg) { ...@@ -21,7 +21,7 @@ function assertEqualsAsync(expected, run, msg) {
assertFalse(hadValue || hadError); assertFalse(hadValue || hadError);
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
if (hadError) throw actual; if (hadError) throw actual;
......
...@@ -23,7 +23,7 @@ function assertThrowsAsync(run, errorType, message) { ...@@ -23,7 +23,7 @@ function assertThrowsAsync(run, errorType, message) {
assertFalse(hadValue || hadError); assertFalse(hadValue || hadError);
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
if (!hadError) { if (!hadError) {
throw new MjsUnitAssertionError( throw new MjsUnitAssertionError(
...@@ -57,7 +57,7 @@ function assertEqualsAsync(expected, run, msg) { ...@@ -57,7 +57,7 @@ function assertEqualsAsync(expected, run, msg) {
assertFalse(hadValue || hadError); assertFalse(hadValue || hadError);
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
if (hadError) throw actual; if (hadError) throw actual;
...@@ -402,7 +402,7 @@ assertDoesNotThrow(gaga); ...@@ -402,7 +402,7 @@ assertDoesNotThrow(gaga);
} }
} }
foo().then(() => log.push("c")); foo().then(() => log.push("c"));
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertEquals(["b", "a", "c"], log); assertEquals(["b", "a", "c"], log);
} }
...@@ -416,7 +416,7 @@ assertDoesNotThrow(gaga); ...@@ -416,7 +416,7 @@ assertDoesNotThrow(gaga);
} }
} }
foo().then(() => log.push("c")); foo().then(() => log.push("c"));
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertEquals(["b", "a", "c"], log); assertEquals(["b", "a", "c"], log);
} }
...@@ -430,7 +430,7 @@ assertDoesNotThrow(gaga); ...@@ -430,7 +430,7 @@ assertDoesNotThrow(gaga);
} }
} }
foo().then(() => log.push("c")); foo().then(() => log.push("c"));
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertEquals(["a", "b", "c"], log); assertEquals(["a", "b", "c"], log);
} }
...@@ -445,7 +445,7 @@ assertDoesNotThrow(gaga); ...@@ -445,7 +445,7 @@ assertDoesNotThrow(gaga);
} }
} }
foo().then(() => log.push("c")); foo().then(() => log.push("c"));
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertEquals(["b", "c", "a"], log); assertEquals(["b", "c", "a"], log);
} }
...@@ -459,7 +459,7 @@ assertDoesNotThrow(gaga); ...@@ -459,7 +459,7 @@ assertDoesNotThrow(gaga);
} }
} }
foo().then(() => log.push("c")); foo().then(() => log.push("c"));
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertEquals(["b", "a", "c"], log); assertEquals(["b", "a", "c"], log);
} }
...@@ -473,7 +473,7 @@ assertDoesNotThrow(gaga); ...@@ -473,7 +473,7 @@ assertDoesNotThrow(gaga);
} }
} }
foo().then(() => log.push("c")); foo().then(() => log.push("c"));
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertEquals(["a", "b", "c"], log); assertEquals(["a", "b", "c"], log);
} }
...@@ -488,7 +488,7 @@ assertDoesNotThrow(gaga); ...@@ -488,7 +488,7 @@ assertDoesNotThrow(gaga);
} }
} }
foo().then(() => log.push("c")); foo().then(() => log.push("c"));
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertEquals(["b", "a", "c"], log); assertEquals(["b", "a", "c"], log);
} }
...@@ -502,7 +502,7 @@ assertDoesNotThrow(gaga); ...@@ -502,7 +502,7 @@ assertDoesNotThrow(gaga);
} }
} }
foo().then(() => log.push("c")); foo().then(() => log.push("c"));
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertEquals(["b", "a", "c"], log); assertEquals(["b", "a", "c"], log);
} }
...@@ -516,7 +516,7 @@ assertDoesNotThrow(gaga); ...@@ -516,7 +516,7 @@ assertDoesNotThrow(gaga);
} }
} }
foo().then(() => log.push("c")); foo().then(() => log.push("c"));
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertEquals(["a", "b", "c"], log); assertEquals(["a", "b", "c"], log);
} }
...@@ -531,7 +531,7 @@ assertDoesNotThrow(gaga); ...@@ -531,7 +531,7 @@ assertDoesNotThrow(gaga);
} }
} }
foo().then(() => log.push("c")); foo().then(() => log.push("c"));
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertEquals(["b", "c", "a"], log); assertEquals(["b", "c", "a"], log);
} }
...@@ -545,7 +545,7 @@ assertDoesNotThrow(gaga); ...@@ -545,7 +545,7 @@ assertDoesNotThrow(gaga);
} }
} }
foo().then(() => log.push("c")); foo().then(() => log.push("c"));
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertEquals(["b", "c", "a"], log); assertEquals(["b", "c", "a"], log);
} }
...@@ -559,7 +559,7 @@ assertDoesNotThrow(gaga); ...@@ -559,7 +559,7 @@ assertDoesNotThrow(gaga);
} }
} }
foo().then(() => log.push("c")); foo().then(() => log.push("c"));
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertEquals(["a", "b", "c"], log); assertEquals(["a", "b", "c"], log);
} }
...@@ -585,7 +585,7 @@ assertDoesNotThrow(gaga); ...@@ -585,7 +585,7 @@ assertDoesNotThrow(gaga);
var ans; var ans;
f2().then(x => ans = x).catch(e => ans = e); f2().then(x => ans = x).catch(e => ans = e);
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertEquals([0], ans); assertEquals([0], ans);
} }
......
...@@ -23,5 +23,5 @@ async function bar() { ...@@ -23,5 +23,5 @@ async function bar() {
foo(); foo();
bar(); bar();
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertEquals(2, count); assertEquals(2, count);
...@@ -21,7 +21,7 @@ function assertEqualsAsync(expected, run, msg) { ...@@ -21,7 +21,7 @@ function assertEqualsAsync(expected, run, msg) {
assertFalse(hadValue || hadError); assertFalse(hadValue || hadError);
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
if (hadError) throw actual; if (hadError) throw actual;
......
...@@ -21,7 +21,7 @@ function assertThrowsAsync(run, errorType, message) { ...@@ -21,7 +21,7 @@ function assertThrowsAsync(run, errorType, message) {
assertFalse(hadValue || hadError); assertFalse(hadValue || hadError);
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
if (!hadError) { if (!hadError) {
throw new MjsUnitAssertionError( throw new MjsUnitAssertionError(
...@@ -55,7 +55,7 @@ function assertEqualsAsync(expected, run, msg) { ...@@ -55,7 +55,7 @@ function assertEqualsAsync(expected, run, msg) {
assertFalse(hadValue || hadError); assertFalse(hadValue || hadError);
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
if (hadError) throw actual; if (hadError) throw actual;
...@@ -77,7 +77,7 @@ function assertEqualsAsync(expected, run, msg) { ...@@ -77,7 +77,7 @@ function assertEqualsAsync(expected, run, msg) {
assertEquals(1, y); assertEquals(1, y);
assertEquals(1, z); assertEquals(1, z);
assertEquals(0, w); assertEquals(0, w);
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertEquals(1, y); assertEquals(1, y);
assertEquals(1, z); assertEquals(1, z);
assertEquals(1, w); assertEquals(1, w);
......
...@@ -21,7 +21,7 @@ function assertThrowsAsync(run, errorType, message) { ...@@ -21,7 +21,7 @@ function assertThrowsAsync(run, errorType, message) {
assertFalse(hadValue || hadError); assertFalse(hadValue || hadError);
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
if (!hadError) { if (!hadError) {
throw new MjsUnitAssertionError( throw new MjsUnitAssertionError(
...@@ -55,7 +55,7 @@ function assertEqualsAsync(expected, run, msg) { ...@@ -55,7 +55,7 @@ function assertEqualsAsync(expected, run, msg) {
assertFalse(hadValue || hadError); assertFalse(hadValue || hadError);
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
if (hadError) throw actual; if (hadError) throw actual;
......
...@@ -24,7 +24,7 @@ function assertThrowsAsync(run, errorType, message) { ...@@ -24,7 +24,7 @@ function assertThrowsAsync(run, errorType, message) {
assertFalse(hadValue || hadError); assertFalse(hadValue || hadError);
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
if (!hadError) { if (!hadError) {
throw new MjsUnitAssertionError( throw new MjsUnitAssertionError(
...@@ -185,7 +185,7 @@ class MyError extends Error {}; ...@@ -185,7 +185,7 @@ class MyError extends Error {};
testFailure = error; testFailure = error;
}); });
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
if (testFailed) { if (testFailed) {
throw testFailure; throw testFailure;
} }
...@@ -619,7 +619,7 @@ if (testFailed) { ...@@ -619,7 +619,7 @@ if (testFailed) {
testFailure = error; testFailure = error;
}); });
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
if (testFailed) { if (testFailed) {
throw testFailure; throw testFailure;
} }
...@@ -663,7 +663,7 @@ if (testFailed) { ...@@ -663,7 +663,7 @@ if (testFailed) {
// Cycle through `f` to extract iterator methods // Cycle through `f` to extract iterator methods
f().catch(function() { %AbortJS("No error should have occurred"); }); f().catch(function() { %AbortJS("No error should have occurred"); });
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertEquals(typeof extractedNext, "function"); assertEquals(typeof extractedNext, "function");
assertThrowsAsync(() => extractedNext.call(undefined), TypeError); assertThrowsAsync(() => extractedNext.call(undefined), TypeError);
......
...@@ -21,7 +21,7 @@ function assertThrowsAsync(run, errorType, message) { ...@@ -21,7 +21,7 @@ function assertThrowsAsync(run, errorType, message) {
assertFalse(hadValue || hadError); assertFalse(hadValue || hadError);
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
if (!hadError) { if (!hadError) {
throw new MjsUnitAssertionError( throw new MjsUnitAssertionError(
...@@ -55,7 +55,7 @@ function assertEqualsAsync(expected, run, msg) { ...@@ -55,7 +55,7 @@ function assertEqualsAsync(expected, run, msg) {
assertFalse(hadValue || hadError); assertFalse(hadValue || hadError);
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
if (hadError) throw actual; if (hadError) throw actual;
...@@ -448,7 +448,7 @@ async function* asyncGeneratorForNestedResumeNext() { ...@@ -448,7 +448,7 @@ async function* asyncGeneratorForNestedResumeNext() {
} }
it = asyncGeneratorForNestedResumeNext(); it = asyncGeneratorForNestedResumeNext();
it.next().then(logIterResult, AbortUnreachable); it.next().then(logIterResult, AbortUnreachable);
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertEquals([ assertEquals([
{ value: "rootbeer", done: false }, { value: "rootbeer", done: false },
{ value: "float", done: false }, { value: "float", done: false },
...@@ -464,7 +464,7 @@ let asyncGeneratorExprForNestedResumeNext = async function*() { ...@@ -464,7 +464,7 @@ let asyncGeneratorExprForNestedResumeNext = async function*() {
}; };
it = asyncGeneratorExprForNestedResumeNext(); it = asyncGeneratorExprForNestedResumeNext();
it.next().then(logIterResult, AbortUnreachable); it.next().then(logIterResult, AbortUnreachable);
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertEquals([ assertEquals([
{ value: "first", done: false }, { value: "first", done: false },
{ value: "second", done: false }, { value: "second", done: false },
...@@ -482,7 +482,7 @@ let asyncGeneratorMethodForNestedResumeNext = ({ ...@@ -482,7 +482,7 @@ let asyncGeneratorMethodForNestedResumeNext = ({
}).method; }).method;
it = asyncGeneratorMethodForNestedResumeNext(); it = asyncGeneratorMethodForNestedResumeNext();
it.next().then(logIterResult, AbortUnreachable); it.next().then(logIterResult, AbortUnreachable);
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertEquals([ assertEquals([
{ value: "remember", done: false }, { value: "remember", done: false },
{ value: "the cant!", done: false }, { value: "the cant!", done: false },
...@@ -498,7 +498,7 @@ let asyncGeneratorCallEvalForNestedResumeNext = ...@@ -498,7 +498,7 @@ let asyncGeneratorCallEvalForNestedResumeNext =
yield await Resolver("rainbow!");`); yield await Resolver("rainbow!");`);
it = asyncGeneratorCallEvalForNestedResumeNext(); it = asyncGeneratorCallEvalForNestedResumeNext();
it.next().then(logIterResult, AbortUnreachable); it.next().then(logIterResult, AbortUnreachable);
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertEquals([ assertEquals([
{ value: "reading", done: false }, { value: "reading", done: false },
{ value: "rainbow!", done: false }, { value: "rainbow!", done: false },
...@@ -514,7 +514,7 @@ let asyncGeneratorNewEvalForNestedResumeNext = ...@@ -514,7 +514,7 @@ let asyncGeneratorNewEvalForNestedResumeNext =
yield await Resolver("BB!");`); yield await Resolver("BB!");`);
it = asyncGeneratorNewEvalForNestedResumeNext(); it = asyncGeneratorNewEvalForNestedResumeNext();
it.next().then(logIterResult, AbortUnreachable); it.next().then(logIterResult, AbortUnreachable);
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertEquals([ assertEquals([
{ value: 731, done: false }, { value: 731, done: false },
{ value: "BB!", done: false }, { value: "BB!", done: false },
...@@ -536,7 +536,7 @@ async function* asyncGeneratorForNestedResumeThrow() { ...@@ -536,7 +536,7 @@ async function* asyncGeneratorForNestedResumeThrow() {
} }
it = asyncGeneratorForNestedResumeThrow(); it = asyncGeneratorForNestedResumeThrow();
it.next().then(logIterResult, logError); it.next().then(logIterResult, logError);
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertEquals([ assertEquals([
"throw1", "throw1",
"throw2", "throw2",
...@@ -556,7 +556,7 @@ let asyncGeneratorExprForNestedResumeThrow = async function*() { ...@@ -556,7 +556,7 @@ let asyncGeneratorExprForNestedResumeThrow = async function*() {
}; };
it = asyncGeneratorExprForNestedResumeThrow(); it = asyncGeneratorExprForNestedResumeThrow();
it.next().then(logIterResult, logError); it.next().then(logIterResult, logError);
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertEquals([ assertEquals([
"throw3", "throw3",
"throw4", "throw4",
...@@ -578,7 +578,7 @@ let asyncGeneratorMethodForNestedResumeThrow = ({ ...@@ -578,7 +578,7 @@ let asyncGeneratorMethodForNestedResumeThrow = ({
}).method; }).method;
it = asyncGeneratorMethodForNestedResumeThrow(); it = asyncGeneratorMethodForNestedResumeThrow();
it.next().then(logIterResult, logError); it.next().then(logIterResult, logError);
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertEquals([ assertEquals([
"throw5", "throw5",
"throw6", "throw6",
...@@ -598,7 +598,7 @@ let asyncGeneratorCallEvalForNestedResumeThrow = ...@@ -598,7 +598,7 @@ let asyncGeneratorCallEvalForNestedResumeThrow =
AbortUnreachable();`); AbortUnreachable();`);
it = asyncGeneratorCallEvalForNestedResumeThrow(); it = asyncGeneratorCallEvalForNestedResumeThrow();
it.next().then(logIterResult, logError); it.next().then(logIterResult, logError);
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertEquals([ assertEquals([
"throw7", "throw7",
"throw8", "throw8",
...@@ -618,7 +618,7 @@ let asyncGeneratorNewEvalForNestedResumeThrow = ...@@ -618,7 +618,7 @@ let asyncGeneratorNewEvalForNestedResumeThrow =
AbortUnreachable();`); AbortUnreachable();`);
it = asyncGeneratorNewEvalForNestedResumeThrow(); it = asyncGeneratorNewEvalForNestedResumeThrow();
it.next().then(logIterResult, logError); it.next().then(logIterResult, logError);
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertEquals([ assertEquals([
"throw9", "throw9",
"throw10", "throw10",
...@@ -636,7 +636,7 @@ async function* asyncGeneratorForNestedResumeReturn() { ...@@ -636,7 +636,7 @@ async function* asyncGeneratorForNestedResumeReturn() {
} }
it = asyncGeneratorForNestedResumeReturn(); it = asyncGeneratorForNestedResumeReturn();
it.next().then(logIterResult, logError); it.next().then(logIterResult, logError);
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertEquals([ assertEquals([
{ value: "step1", done: false }, { value: "step1", done: false },
{ value: "step2", done: true }, { value: "step2", done: true },
...@@ -651,7 +651,7 @@ let asyncGeneratorExprForNestedResumeReturn = async function*() { ...@@ -651,7 +651,7 @@ let asyncGeneratorExprForNestedResumeReturn = async function*() {
}; };
it = asyncGeneratorExprForNestedResumeReturn(); it = asyncGeneratorExprForNestedResumeReturn();
it.next().then(logIterResult, logError); it.next().then(logIterResult, logError);
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertEquals([ assertEquals([
{ value: "step3", done: false }, { value: "step3", done: false },
{ value: "step4", done: true }, { value: "step4", done: true },
...@@ -668,7 +668,7 @@ let asyncGeneratorMethodForNestedResumeReturn = ({ ...@@ -668,7 +668,7 @@ let asyncGeneratorMethodForNestedResumeReturn = ({
}).method; }).method;
it = asyncGeneratorMethodForNestedResumeReturn(); it = asyncGeneratorMethodForNestedResumeReturn();
it.next().then(logIterResult, logError); it.next().then(logIterResult, logError);
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertEquals([ assertEquals([
{ value: "step5", done: false }, { value: "step5", done: false },
{ value: "step6", done: true }, { value: "step6", done: true },
...@@ -683,7 +683,7 @@ let asyncGeneratorCallEvalForNestedResumeReturn = ...@@ -683,7 +683,7 @@ let asyncGeneratorCallEvalForNestedResumeReturn =
yield "step7";`); yield "step7";`);
it = asyncGeneratorCallEvalForNestedResumeReturn(); it = asyncGeneratorCallEvalForNestedResumeReturn();
it.next().then(logIterResult, logError); it.next().then(logIterResult, logError);
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertEquals([ assertEquals([
{ value: "step7", done: false }, { value: "step7", done: false },
{ value: "step8", done: true }, { value: "step8", done: true },
...@@ -698,7 +698,7 @@ let asyncGeneratorNewEvalForNestedResumeReturn = ...@@ -698,7 +698,7 @@ let asyncGeneratorNewEvalForNestedResumeReturn =
yield "step9";`); yield "step9";`);
it = asyncGeneratorNewEvalForNestedResumeReturn(); it = asyncGeneratorNewEvalForNestedResumeReturn();
it.next().then(logIterResult, logError); it.next().then(logIterResult, logError);
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertEquals([ assertEquals([
{ value: "step9", done: false }, { value: "step9", done: false },
{ value: "step10", done: true }, { value: "step10", done: true },
......
...@@ -1257,7 +1257,7 @@ let testFailure; ...@@ -1257,7 +1257,7 @@ let testFailure;
testFailure = error; testFailure = error;
}); });
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
if (testFailed) { if (testFailed) {
throw testFailure; throw testFailure;
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
var error1, error2; var error1, error2;
import('modules-skip-12.js').catch(e => error1 = e); import('modules-skip-12.js').catch(e => error1 = e);
import('modules-skip-12.js').catch(e => error2 = e); import('modules-skip-12.js').catch(e => error2 = e);
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertEquals(error1, error2); assertEquals(error1, error2);
assertInstanceof(error1, SyntaxError); assertInstanceof(error1, SyntaxError);
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
var error1, error2; var error1, error2;
import('modules-skip-11.js').catch(e => error1 = e); import('modules-skip-11.js').catch(e => error1 = e);
import('modules-skip-11.js').catch(e => error2 = e); import('modules-skip-11.js').catch(e => error2 = e);
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertEquals(error1, error2); assertEquals(error1, error2);
assertEquals(typeof error1, "symbol"); assertEquals(typeof error1, "symbol");
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
var error1, error2; var error1, error2;
import('no-such-file').catch(e => error1 = e); import('no-such-file').catch(e => error1 = e);
import('no-such-file').catch(e => error2 = e); import('no-such-file').catch(e => error2 = e);
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertEquals(error1, error2); assertEquals(error1, error2);
assertEquals(typeof error1, "string"); assertEquals(typeof error1, "string");
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
var error1, error2; var error1, error2;
import('modules-skip-10.js').catch(e => error1 = e); import('modules-skip-10.js').catch(e => error1 = e);
import('modules-skip-10.js').catch(e => error2 = e); import('modules-skip-10.js').catch(e => error2 = e);
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertEquals(error1, error2); assertEquals(error1, error2);
assertInstanceof(error1, SyntaxError); assertInstanceof(error1, SyntaxError);
...@@ -7,6 +7,6 @@ ...@@ -7,6 +7,6 @@
var life; var life;
import('modules-skip-1.js').then(namespace => life = namespace.life()); import('modules-skip-1.js').then(namespace => life = namespace.life());
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertEquals(42, life); assertEquals(42, life);
...@@ -9,7 +9,7 @@ import('modules-skip-6.js').then(namespace => life = namespace.life); ...@@ -9,7 +9,7 @@ import('modules-skip-6.js').then(namespace => life = namespace.life);
assertEquals(undefined, Object.life); assertEquals(undefined, Object.life);
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertEquals(42, Object.life); assertEquals(42, Object.life);
assertEquals("42", life); assertEquals("42", life);
...@@ -18,5 +18,5 @@ async function test() { ...@@ -18,5 +18,5 @@ async function test() {
} }
test(); test();
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertTrue(ran); assertTrue(ran);
...@@ -15,5 +15,5 @@ async function test() { ...@@ -15,5 +15,5 @@ async function test() {
} }
test(); test();
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertTrue(ran); assertTrue(ran);
...@@ -19,7 +19,7 @@ async function test1() { ...@@ -19,7 +19,7 @@ async function test1() {
} }
test1(); test1();
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertTrue(ran); assertTrue(ran);
ran = false; ran = false;
...@@ -36,5 +36,5 @@ async function test2() { ...@@ -36,5 +36,5 @@ async function test2() {
} }
test2(); test2();
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertTrue(ran); assertTrue(ran);
...@@ -22,5 +22,5 @@ async function test() { ...@@ -22,5 +22,5 @@ async function test() {
} }
test(); test();
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertTrue(ran); assertTrue(ran);
...@@ -17,7 +17,7 @@ async function test1() { ...@@ -17,7 +17,7 @@ async function test1() {
} }
test1(); test1();
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertTrue(ran); assertTrue(ran);
ran = false; ran = false;
...@@ -37,7 +37,7 @@ async function test2() { ...@@ -37,7 +37,7 @@ async function test2() {
} }
test2(); test2();
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertTrue(ran); assertTrue(ran);
ran = false; ran = false;
...@@ -53,5 +53,5 @@ async function test3() { ...@@ -53,5 +53,5 @@ async function test3() {
} }
test3(); test3();
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertTrue(ran); assertTrue(ran);
...@@ -12,7 +12,7 @@ var body = "import('modules-skip-1.js').then(ns => { x = ns.life();" + ...@@ -12,7 +12,7 @@ var body = "import('modules-skip-1.js').then(ns => { x = ns.life();" +
var func = new Function(body); var func = new Function(body);
func(); func();
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertEquals(42, x); assertEquals(42, x);
assertTrue(ran); assertTrue(ran);
...@@ -21,7 +21,7 @@ var body = "import('modules-skip-1.js').then(ns => { x = ns.life();" + ...@@ -21,7 +21,7 @@ var body = "import('modules-skip-1.js').then(ns => { x = ns.life();" +
" ran = true;} ).catch(err => %AbortJS(err))" " ran = true;} ).catch(err => %AbortJS(err))"
eval("var func = new Function(body); func();"); eval("var func = new Function(body); func();");
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertEquals(42, x); assertEquals(42, x);
assertTrue(ran); assertTrue(ran);
...@@ -31,6 +31,6 @@ var body = "eval(import('modules-skip-1.js').then(ns => { x = ns.life();" + ...@@ -31,6 +31,6 @@ var body = "eval(import('modules-skip-1.js').then(ns => { x = ns.life();" +
var func = new Function(body); var func = new Function(body);
func(); func();
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertEquals(42, x); assertEquals(42, x);
assertTrue(ran); assertTrue(ran);
...@@ -6,6 +6,6 @@ ...@@ -6,6 +6,6 @@
var ns; var ns;
import('modules-skip-13.js').then(x => ns = x); import('modules-skip-13.js').then(x => ns = x);
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertEquals(42, ns.default); assertEquals(42, ns.default);
assertEquals(ns, ns.self); assertEquals(ns, ns.self);
...@@ -12,7 +12,7 @@ import('modules-skip-2.js').catch(err => msg = err.message); ...@@ -12,7 +12,7 @@ import('modules-skip-2.js').catch(err => msg = err.message);
assertEquals(undefined, life); assertEquals(undefined, life);
assertEquals(undefined, msg); assertEquals(undefined, msg);
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertEquals(42, life); assertEquals(42, life);
assertEquals('42 is not the answer', msg); assertEquals('42 is not the answer', msg);
...@@ -17,6 +17,6 @@ async function foo () { ...@@ -17,6 +17,6 @@ async function foo () {
foo(); foo();
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertTrue(ran); assertTrue(ran);
...@@ -9,5 +9,5 @@ let x = 'modules-skip-1.js'; ...@@ -9,5 +9,5 @@ let x = 'modules-skip-1.js';
import(x).then(namespace => life = namespace.life()); import(x).then(namespace => life = namespace.life());
x = 'modules-skip-2.js'; x = 'modules-skip-2.js';
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertEquals(42, life); assertEquals(42, life);
...@@ -25,5 +25,5 @@ async function test() { ...@@ -25,5 +25,5 @@ async function test() {
test(); test();
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertTrue(ran); assertTrue(ran);
...@@ -19,6 +19,6 @@ async function test() { ...@@ -19,6 +19,6 @@ async function test() {
test(); test();
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertTrue(ran); assertTrue(ran);
...@@ -43,7 +43,7 @@ async function test1() { ...@@ -43,7 +43,7 @@ async function test1() {
test1(); test1();
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertTrue(ran); assertTrue(ran);
...@@ -66,7 +66,7 @@ async function test2() { ...@@ -66,7 +66,7 @@ async function test2() {
test2(); test2();
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertTrue(ran); assertTrue(ran);
...@@ -86,6 +86,6 @@ async function test3() { ...@@ -86,6 +86,6 @@ async function test3() {
test3(); test3();
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertTrue(ran); assertTrue(ran);
...@@ -18,5 +18,5 @@ async function test() { ...@@ -18,5 +18,5 @@ async function test() {
} }
test(); test();
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertTrue(ran); assertTrue(ran);
...@@ -25,7 +25,7 @@ let weak_ref; ...@@ -25,7 +25,7 @@ let weak_ref;
})(); })();
// Clear the KeepDuringJob set. // Clear the KeepDuringJob set.
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
weak_ref.deref(); weak_ref.deref();
o = null; o = null;
...@@ -37,7 +37,7 @@ gc(); ...@@ -37,7 +37,7 @@ gc();
wf.cleanupSome(); wf.cleanupSome();
assertEquals(0, cleanup_count); assertEquals(0, cleanup_count);
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
// Next turn. // Next turn.
// This GC detects the WeakRef as dirty. // This GC detects the WeakRef as dirty.
......
...@@ -25,7 +25,7 @@ let weak_ref; ...@@ -25,7 +25,7 @@ let weak_ref;
})(); })();
// Clear the KeepDuringJob set. // Clear the KeepDuringJob set.
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
weak_ref.deref(); weak_ref.deref();
o = null; o = null;
...@@ -37,7 +37,7 @@ gc(); ...@@ -37,7 +37,7 @@ gc();
wf.cleanupSome(); wf.cleanupSome();
assertEquals(0, cleanup_count); assertEquals(0, cleanup_count);
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
// Next turn. // Next turn.
// Now the WeakRef can be cleared. // Now the WeakRef can be cleared.
...@@ -51,7 +51,7 @@ assertEquals(weak_ref, cleanup_cells[0]); ...@@ -51,7 +51,7 @@ assertEquals(weak_ref, cleanup_cells[0]);
// The cleanup task is not executed again since all WeakCells have been // The cleanup task is not executed again since all WeakCells have been
// processed. // processed.
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
// Next turn. // Next turn.
assertEquals(1, cleanup_count); assertEquals(1, cleanup_count);
...@@ -31,7 +31,7 @@ gc(); ...@@ -31,7 +31,7 @@ gc();
wf.cleanupSome(); wf.cleanupSome();
assertEquals(0, cleanup_count); assertEquals(0, cleanup_count);
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
// Next turn. // Next turn.
// Now the WeakRef can be cleared. // Now the WeakRef can be cleared.
......
...@@ -28,7 +28,7 @@ let wr; ...@@ -28,7 +28,7 @@ let wr;
gc(); gc();
assertNotEquals(undefined, wr.deref()); assertNotEquals(undefined, wr.deref());
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
// New turn. // New turn.
let o = wr.deref(); let o = wr.deref();
......
...@@ -38,7 +38,7 @@ gc(); ...@@ -38,7 +38,7 @@ gc();
assertNotEquals(undefined, wr2.deref()); assertNotEquals(undefined, wr2.deref());
})(); })();
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
// New turn. // New turn.
assertEquals(0, cleanup_count); assertEquals(0, cleanup_count);
...@@ -47,7 +47,7 @@ wr1.deref(); ...@@ -47,7 +47,7 @@ wr1.deref();
o1 = null; o1 = null;
gc(); // deref makes sure we don't clean up wr1 gc(); // deref makes sure we don't clean up wr1
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
// New turn. // New turn.
assertEquals(0, cleanup_count); assertEquals(0, cleanup_count);
...@@ -56,7 +56,7 @@ wr2.deref(); ...@@ -56,7 +56,7 @@ wr2.deref();
o2 = null; o2 = null;
gc(); // deref makes sure we don't clean up wr2 gc(); // deref makes sure we don't clean up wr2
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
// New turn. // New turn.
assertEquals(1, cleanup_count); assertEquals(1, cleanup_count);
...@@ -64,7 +64,7 @@ assertEquals(wr1, cleared_cells1[0]); ...@@ -64,7 +64,7 @@ assertEquals(wr1, cleared_cells1[0]);
gc(); gc();
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
// New turn. // New turn.
assertEquals(2, cleanup_count); assertEquals(2, cleanup_count);
......
...@@ -34,12 +34,12 @@ gc(); ...@@ -34,12 +34,12 @@ gc();
assertNotEquals(undefined, weak_ref.deref()); assertNotEquals(undefined, weak_ref.deref());
})(); })();
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
// Next turn. // Next turn.
gc(); gc();
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
// Next turn. // Next turn.
assertTrue(cleanup_called); assertTrue(cleanup_called);
...@@ -33,14 +33,14 @@ gc(); ...@@ -33,14 +33,14 @@ gc();
assertNotEquals(undefined, wr.deref()); assertNotEquals(undefined, wr.deref());
})(); })();
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
// Next turn. // Next turn.
assertFalse(cleanup_called); assertFalse(cleanup_called);
gc(); gc();
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
// Next turn. // Next turn.
assertTrue(cleanup_called); assertTrue(cleanup_called);
...@@ -29,12 +29,12 @@ let strong = {a: wr.deref(), b: wr_control.deref()}; ...@@ -29,12 +29,12 @@ let strong = {a: wr.deref(), b: wr_control.deref()};
gc(); gc();
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
// Next turn. // Next turn.
gc(); gc();
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
// Next turn. // Next turn.
// We have a strong reference to the objects, so the WeakRefs are not cleared yet. // We have a strong reference to the objects, so the WeakRefs are not cleared yet.
...@@ -57,7 +57,7 @@ gc(); ...@@ -57,7 +57,7 @@ gc();
assertEquals(undefined, wr_control.deref()); assertEquals(undefined, wr_control.deref());
})(); })();
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
// Next turn. // Next turn.
assertEquals(1, cleanup_count); assertEquals(1, cleanup_count);
...@@ -66,7 +66,7 @@ assertEquals(wc, cleanup_cells[0]); ...@@ -66,7 +66,7 @@ assertEquals(wc, cleanup_cells[0]);
gc(); gc();
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
// Next turn. // Next turn.
assertEquals(2, cleanup_count); assertEquals(2, cleanup_count);
......
...@@ -11,7 +11,7 @@ let log = []; ...@@ -11,7 +11,7 @@ let log = [];
return 10; return 10;
} }
})(); })();
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
(function() { (function() {
with ({get ['.new.target']() { log.push('new.target') }}) { with ({get ['.new.target']() { log.push('new.target') }}) {
......
...@@ -18,6 +18,6 @@ Promise.resolve(Promise.resolve()).then(() => log += "|fast-resolve"); ...@@ -18,6 +18,6 @@ Promise.resolve(Promise.resolve()).then(() => log += "|fast-resolve");
(class extends Promise {}).resolve(Promise.resolve()).then(() => log += "|slow-resolve"); (class extends Promise {}).resolve(Promise.resolve()).then(() => log += "|slow-resolve");
log += "|start"; log += "|start";
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertEquals("|start|turn1|fast-resolve|turn2|turn3|slow-resolve|turn4\n\ assertEquals("|start|turn1|fast-resolve|turn2|turn3|slow-resolve|turn4\n\
|start|turn1|fast-resolve|turn2|turn3|slow-resolve|turn4", result); |start|turn1|fast-resolve|turn2|turn3|slow-resolve|turn4", result);
...@@ -9,5 +9,5 @@ function f() { ...@@ -9,5 +9,5 @@ function f() {
success = (f.caller === null); success = (f.caller === null);
} }
Promise.resolve().then(f); Promise.resolve().then(f);
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertTrue(success); assertTrue(success);
...@@ -17,6 +17,6 @@ var error; ...@@ -17,6 +17,6 @@ var error;
var promise = __f_0(); var promise = __f_0();
promise.then(assertUnreachable, promise.then(assertUnreachable,
err => { done = true; error = err }); err => { done = true; error = err });
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertTrue(error.startsWith('Error reading')); assertTrue(error.startsWith('Error reading'));
assertTrue(done); assertTrue(done);
...@@ -17,7 +17,7 @@ function TryToLoadModule(filename, expect_error, token) { ...@@ -17,7 +17,7 @@ function TryToLoadModule(filename, expect_error, token) {
} }
import(filename).catch(SetError); import(filename).catch(SetError);
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
if (expect_error) { if (expect_error) {
assertTrue(caught_error instanceof SyntaxError); assertTrue(caught_error instanceof SyntaxError);
......
...@@ -27,5 +27,5 @@ function g() { ...@@ -27,5 +27,5 @@ function g() {
let namespace = Promise.resolve().then(importUndefined); let namespace = Promise.resolve().then(importUndefined);
} }
g(); g();
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assertEquals(list, [1,2]); assertEquals(list, [1,2]);
...@@ -80,7 +80,7 @@ var testAsync; ...@@ -80,7 +80,7 @@ var testAsync;
} }
drainMicrotasks() { drainMicrotasks() {
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
} }
done_() { done_() {
...@@ -111,7 +111,7 @@ var testAsync; ...@@ -111,7 +111,7 @@ var testAsync;
testAsync = function(test, name) { testAsync = function(test, name) {
let assert = new AsyncAssertion(test, name); let assert = new AsyncAssertion(test, name);
test(assert); test(assert);
%RunMicrotasks(); %PerformMicrotaskCheckpoint();
assert.done_(); assert.done_();
} }
})(); })();
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