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/1360095
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Taiju Tsuiki <tzik@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58068}
This commit is contained in:
tzik 2018-12-04 15:12:49 +09:00 committed by Commit Bot
parent 157af78881
commit 07011cc4f0
75 changed files with 149 additions and 149 deletions

View File

@ -80,10 +80,10 @@ RUNTIME_FUNCTION(Runtime_EnqueueMicrotask) {
return ReadOnlyRoots(isolate).undefined_value();
}
RUNTIME_FUNCTION(Runtime_RunMicrotasks) {
RUNTIME_FUNCTION(Runtime_PerformMicrotaskCheckpoint) {
HandleScope scope(isolate);
DCHECK_EQ(0, args.length());
isolate->RunMicrotasks();
MicrotasksScope::PerformCheckpoint(reinterpret_cast<v8::Isolate*>(isolate));
return ReadOnlyRoots(isolate).undefined_value();
}

View File

@ -230,7 +230,7 @@ namespace internal {
F(ReportMessage, 1, 1) \
F(ReThrow, 1, 1) \
F(RunMicrotaskCallback, 2, 1) \
F(RunMicrotasks, 0, 1) \
F(PerformMicrotaskCheckpoint, 0, 1) \
F(StackGuard, 0, 1) \
F(Throw, 1, 1) \
F(ThrowApplyNonFunction, 1, 1) \

View File

@ -51,7 +51,7 @@ LogX("start")();
// Make sure that the debug event listener was invoked.
assertTrue(listenerComplete);
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
var expectation =
[ "[0] debugger", "[1] start", "[1] then 1",

View File

@ -39,4 +39,4 @@ function listener(event, exec_state, event_data, data) {}
Debug.setBreakOnUncaughtException();
Debug.setListener(listener);
%RunMicrotasks();
%PerformMicrotaskCheckpoint();

View File

@ -40,22 +40,22 @@ function bar(a,b) {
}
foo();
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
foo();
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
%OptimizeFunctionOnNextCall(foo);
// bar likely gets inlined into foo.
foo();
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
%NeverOptimizeFunction(bar);
%OptimizeFunctionOnNextCall(foo);
// bar does not get inlined into foo.
foo();
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertEquals(0, expected_events);

View File

@ -57,7 +57,7 @@ async function foo() {
foo();
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
Debug.setListener(null);
Debug.clearBreakOnException();

View File

@ -197,7 +197,7 @@ function runPart(n) {
events = 0;
consumer(producer);
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
Debug.setListener(null);
if (caught) {

View File

@ -37,7 +37,7 @@ log = [];
Debug.setListener(listener);
Debug.setBreakOnException();
caught_throw();
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
Debug.setListener(null);
Debug.clearBreakOnException();
assertEquals(["a"], log);
@ -48,7 +48,7 @@ log = [];
Debug.setListener(listener);
Debug.setBreakOnUncaughtException();
caught_throw();
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
Debug.setListener(null);
Debug.clearBreakOnUncaughtException();
assertEquals([], log);
@ -69,7 +69,7 @@ log = [];
Debug.setListener(listener);
Debug.setBreakOnException();
caught_reject();
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
Debug.setListener(null);
Debug.clearBreakOnException();
assertEquals([], log);
@ -80,7 +80,7 @@ log = [];
Debug.setListener(listener);
Debug.setBreakOnUncaughtException();
caught_reject();
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
Debug.setListener(null);
Debug.clearBreakOnUncaughtException();
assertEquals([], log);
@ -95,7 +95,7 @@ async function propagate_inner() { return thrower(); }
async function propagate_outer() { return propagate_inner(); }
propagate_outer();
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertEquals(["a"], log);
assertNull(exception);
@ -104,7 +104,7 @@ log = [];
async function propagate_await() { await 1; return thrower(); }
async function propagate_await_outer() { return propagate_await(); }
propagate_await_outer();
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertEquals(["a"], log);
assertNull(exception);
@ -113,7 +113,7 @@ Debug.setBreakOnUncaughtException();
log = [];
Promise.resolve().then(() => Promise.reject()).catch(() => log.push("d")); // Exception c
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertEquals(["d"], log);
assertNull(exception);

View File

@ -48,6 +48,6 @@ debugger; // B3 StepNext
late_resolve(3); // B4 Continue
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertEquals(5, step_count);

View File

@ -48,6 +48,6 @@ debugger; // B3 Continue
late_resolve(3);
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertEquals(5, step_count);

View File

@ -44,6 +44,6 @@ f();
late_resolve(3);
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertEquals(4, step_count);

View File

@ -44,6 +44,6 @@ f();
late_resolve(3);
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertEquals(4, step_count);

View File

@ -44,6 +44,6 @@ f().then(value => assertEquals(4, value));
late_resolve(3);
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertEquals(7, step_count);

View File

@ -51,6 +51,6 @@ f1();
late_resolve(3);
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertEquals(6, step_count);

View File

@ -32,6 +32,6 @@ async function f() {
f();
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertEquals(3, step_count);

View File

@ -44,6 +44,6 @@ f();
late_resolve(3);
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertEquals(3, step_count);

View File

@ -42,6 +42,6 @@ f();
late_resolve(3); // B2 Continue
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertEquals(3, step_count);

View File

@ -21,7 +21,7 @@ function assertEqualsAsync(expected, run, msg) {
assertFalse(hadValue || hadError);
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
if (hadError) throw actual;
@ -67,7 +67,7 @@ function setbreaks() {
f();
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertEqualsAsync(2, async () => break_count);
assertEqualsAsync(null, async () => exception);

View File

@ -21,7 +21,7 @@ function assertEqualsAsync(expected, run, msg) {
assertFalse(hadValue || hadError);
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
if (hadError) throw actual;
@ -65,7 +65,7 @@ Debug.setBreakPoint(f, 5);
f();
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertEqualsAsync(3, async () => break_count);
assertEqualsAsync(null, async () => exception);

View File

@ -94,7 +94,7 @@ function patch(fun, from, to) {
assertPromiseValue("Cat", promise);
assertTrue(patch_attempted);
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
// At this point one iterator is live, but closed, so the patch will succeed.
patch(asyncfn, "'Cat'", "'Capybara'");
@ -143,4 +143,4 @@ function patch(fun, from, to) {
}));
})();
%RunMicrotasks();
%PerformMicrotaskCheckpoint();

View File

@ -35,7 +35,7 @@ Promise.resolve()
.finally(() => thenable)
.catch(e => caughtException = e);
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
Debug.setListener(null);
Debug.clearBreakOnException();

View File

@ -160,10 +160,10 @@ function Setup() {
return a;
})();
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
}
function Basic() {
a();
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
}

View File

@ -34,7 +34,7 @@ function Setup() {
b = function b(p) { return p; };
a = function a(p) { return p; };
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
}
function Basic() {
@ -48,5 +48,5 @@ function Basic() {
.then(c)
.then(b)
.then(a);
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
}

View File

@ -34,10 +34,10 @@ function Setup() {
b = async function b() { return c(); };
a = async function a() { return b(); };
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
}
function Basic() {
a();
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
}

View File

@ -69,7 +69,7 @@ function AsyncStacksInstrumentation() {
p = p.then(nopCallback);
}
p = p.then(() => done = true);
while (!done) %RunMicrotasks();
while (!done) %PerformMicrotaskCheckpoint();
}
})();

View File

@ -23,21 +23,21 @@ const iterations = 10000;
function BasicExport() {
let success = false;
import("basic-export.js").then(m => { m.bench(); success = true; });
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
if (!success) throw new Error(666);
}
function BasicImport() {
let success = false;
import("basic-import.js").then(m => { m.bench(); success = true; });
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
if (!success) throw new Error(666);
}
function BasicNamespace() {
let success = false;
import("basic-namespace.js").then(m => { m.bench(); success = true; });
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
if (!success) throw new Error(666);
}

View File

@ -213,7 +213,7 @@ TestCoverage(
nop(); // 0100
} // 0150
}(); // 0200
%RunMicrotasks(); // 0250
%PerformMicrotaskCheckpoint(); // 0250
`,
[{"start":0,"end":299,"count":1},
{"start":1,"end":201,"count":6}, // TODO(jgruber): Invocation count is off.
@ -662,7 +662,7 @@ async function f() { // 0000
await 42; // 0100
}; // 0150
f(); // 0200
%RunMicrotasks(); // 0250
%PerformMicrotaskCheckpoint(); // 0250
`,
[{"start":0,"end":299,"count":1},
{"start":0,"end":151,"count":3},

View File

@ -40,7 +40,7 @@ function assertArrayValues(expected, actual) {
}
function assertOrdering(expected) {
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertArrayValues(expected, ordering);
}

View File

@ -21,7 +21,7 @@ function assertEqualsAsync(expected, run, msg) {
assertFalse(hadValue || hadError);
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
if (hadError) throw actual;

View File

@ -21,7 +21,7 @@ function assertEqualsAsync(expected, run, msg) {
assertFalse(hadValue || hadError);
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
if (hadError) throw actual;

View File

@ -21,7 +21,7 @@ function assertEqualsAsync(expected, run, msg) {
assertFalse(hadValue || hadError);
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
if (hadError) throw actual;

View File

@ -21,7 +21,7 @@ function assertEqualsAsync(expected, run, msg) {
assertFalse(hadValue || hadError);
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
if (hadError) throw actual;

View File

@ -23,7 +23,7 @@ function assertThrowsAsync(run, errorType, message) {
assertFalse(hadValue || hadError);
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
if (!hadError) {
throw new MjsUnitAssertionError(
@ -57,7 +57,7 @@ function assertEqualsAsync(expected, run, msg) {
assertFalse(hadValue || hadError);
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
if (hadError) throw actual;
@ -402,7 +402,7 @@ assertDoesNotThrow(gaga);
}
}
foo().then(() => log.push("c"));
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertEquals(["b", "a", "c"], log);
}
@ -416,7 +416,7 @@ assertDoesNotThrow(gaga);
}
}
foo().then(() => log.push("c"));
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertEquals(["b", "a", "c"], log);
}
@ -430,7 +430,7 @@ assertDoesNotThrow(gaga);
}
}
foo().then(() => log.push("c"));
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertEquals(["a", "b", "c"], log);
}
@ -445,7 +445,7 @@ assertDoesNotThrow(gaga);
}
}
foo().then(() => log.push("c"));
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertEquals(["b", "c", "a"], log);
}
@ -459,7 +459,7 @@ assertDoesNotThrow(gaga);
}
}
foo().then(() => log.push("c"));
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertEquals(["b", "a", "c"], log);
}
@ -473,7 +473,7 @@ assertDoesNotThrow(gaga);
}
}
foo().then(() => log.push("c"));
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertEquals(["a", "b", "c"], log);
}
@ -488,7 +488,7 @@ assertDoesNotThrow(gaga);
}
}
foo().then(() => log.push("c"));
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertEquals(["b", "a", "c"], log);
}
@ -502,7 +502,7 @@ assertDoesNotThrow(gaga);
}
}
foo().then(() => log.push("c"));
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertEquals(["b", "a", "c"], log);
}
@ -516,7 +516,7 @@ assertDoesNotThrow(gaga);
}
}
foo().then(() => log.push("c"));
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertEquals(["a", "b", "c"], log);
}
@ -531,7 +531,7 @@ assertDoesNotThrow(gaga);
}
}
foo().then(() => log.push("c"));
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertEquals(["b", "c", "a"], log);
}
@ -545,7 +545,7 @@ assertDoesNotThrow(gaga);
}
}
foo().then(() => log.push("c"));
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertEquals(["b", "c", "a"], log);
}
@ -559,7 +559,7 @@ assertDoesNotThrow(gaga);
}
}
foo().then(() => log.push("c"));
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertEquals(["a", "b", "c"], log);
}
@ -585,7 +585,7 @@ assertDoesNotThrow(gaga);
var ans;
f2().then(x => ans = x).catch(e => ans = e);
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertEquals([0], ans);
}

View File

@ -23,5 +23,5 @@ async function bar() {
foo();
bar();
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertEquals(2, count);

View File

@ -21,7 +21,7 @@ function assertEqualsAsync(expected, run, msg) {
assertFalse(hadValue || hadError);
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
if (hadError) throw actual;

View File

@ -21,7 +21,7 @@ function assertThrowsAsync(run, errorType, message) {
assertFalse(hadValue || hadError);
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
if (!hadError) {
throw new MjsUnitAssertionError(
@ -55,7 +55,7 @@ function assertEqualsAsync(expected, run, msg) {
assertFalse(hadValue || hadError);
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
if (hadError) throw actual;
@ -77,7 +77,7 @@ function assertEqualsAsync(expected, run, msg) {
assertEquals(1, y);
assertEquals(1, z);
assertEquals(0, w);
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertEquals(1, y);
assertEquals(1, z);
assertEquals(1, w);

View File

@ -21,7 +21,7 @@ function assertThrowsAsync(run, errorType, message) {
assertFalse(hadValue || hadError);
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
if (!hadError) {
throw new MjsUnitAssertionError(
@ -55,7 +55,7 @@ function assertEqualsAsync(expected, run, msg) {
assertFalse(hadValue || hadError);
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
if (hadError) throw actual;

View File

@ -24,7 +24,7 @@ function assertThrowsAsync(run, errorType, message) {
assertFalse(hadValue || hadError);
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
if (!hadError) {
throw new MjsUnitAssertionError(
@ -185,7 +185,7 @@ class MyError extends Error {};
testFailure = error;
});
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
if (testFailed) {
throw testFailure;
}
@ -619,7 +619,7 @@ if (testFailed) {
testFailure = error;
});
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
if (testFailed) {
throw testFailure;
}
@ -663,7 +663,7 @@ if (testFailed) {
// Cycle through `f` to extract iterator methods
f().catch(function() { %AbortJS("No error should have occurred"); });
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertEquals(typeof extractedNext, "function");
assertThrowsAsync(() => extractedNext.call(undefined), TypeError);

View File

@ -21,7 +21,7 @@ function assertThrowsAsync(run, errorType, message) {
assertFalse(hadValue || hadError);
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
if (!hadError) {
throw new MjsUnitAssertionError(
@ -55,7 +55,7 @@ function assertEqualsAsync(expected, run, msg) {
assertFalse(hadValue || hadError);
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
if (hadError) throw actual;
@ -448,7 +448,7 @@ async function* asyncGeneratorForNestedResumeNext() {
}
it = asyncGeneratorForNestedResumeNext();
it.next().then(logIterResult, AbortUnreachable);
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertEquals([
{ value: "rootbeer", done: false },
{ value: "float", done: false },
@ -464,7 +464,7 @@ let asyncGeneratorExprForNestedResumeNext = async function*() {
};
it = asyncGeneratorExprForNestedResumeNext();
it.next().then(logIterResult, AbortUnreachable);
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertEquals([
{ value: "first", done: false },
{ value: "second", done: false },
@ -482,7 +482,7 @@ let asyncGeneratorMethodForNestedResumeNext = ({
}).method;
it = asyncGeneratorMethodForNestedResumeNext();
it.next().then(logIterResult, AbortUnreachable);
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertEquals([
{ value: "remember", done: false },
{ value: "the cant!", done: false },
@ -498,7 +498,7 @@ let asyncGeneratorCallEvalForNestedResumeNext =
yield await Resolver("rainbow!");`);
it = asyncGeneratorCallEvalForNestedResumeNext();
it.next().then(logIterResult, AbortUnreachable);
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertEquals([
{ value: "reading", done: false },
{ value: "rainbow!", done: false },
@ -514,7 +514,7 @@ let asyncGeneratorNewEvalForNestedResumeNext =
yield await Resolver("BB!");`);
it = asyncGeneratorNewEvalForNestedResumeNext();
it.next().then(logIterResult, AbortUnreachable);
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertEquals([
{ value: 731, done: false },
{ value: "BB!", done: false },
@ -536,7 +536,7 @@ async function* asyncGeneratorForNestedResumeThrow() {
}
it = asyncGeneratorForNestedResumeThrow();
it.next().then(logIterResult, logError);
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertEquals([
"throw1",
"throw2",
@ -556,7 +556,7 @@ let asyncGeneratorExprForNestedResumeThrow = async function*() {
};
it = asyncGeneratorExprForNestedResumeThrow();
it.next().then(logIterResult, logError);
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertEquals([
"throw3",
"throw4",
@ -578,7 +578,7 @@ let asyncGeneratorMethodForNestedResumeThrow = ({
}).method;
it = asyncGeneratorMethodForNestedResumeThrow();
it.next().then(logIterResult, logError);
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertEquals([
"throw5",
"throw6",
@ -598,7 +598,7 @@ let asyncGeneratorCallEvalForNestedResumeThrow =
AbortUnreachable();`);
it = asyncGeneratorCallEvalForNestedResumeThrow();
it.next().then(logIterResult, logError);
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertEquals([
"throw7",
"throw8",
@ -618,7 +618,7 @@ let asyncGeneratorNewEvalForNestedResumeThrow =
AbortUnreachable();`);
it = asyncGeneratorNewEvalForNestedResumeThrow();
it.next().then(logIterResult, logError);
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertEquals([
"throw9",
"throw10",
@ -636,7 +636,7 @@ async function* asyncGeneratorForNestedResumeReturn() {
}
it = asyncGeneratorForNestedResumeReturn();
it.next().then(logIterResult, logError);
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertEquals([
{ value: "step1", done: false },
{ value: "step2", done: true },
@ -651,7 +651,7 @@ let asyncGeneratorExprForNestedResumeReturn = async function*() {
};
it = asyncGeneratorExprForNestedResumeReturn();
it.next().then(logIterResult, logError);
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertEquals([
{ value: "step3", done: false },
{ value: "step4", done: true },
@ -668,7 +668,7 @@ let asyncGeneratorMethodForNestedResumeReturn = ({
}).method;
it = asyncGeneratorMethodForNestedResumeReturn();
it.next().then(logIterResult, logError);
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertEquals([
{ value: "step5", done: false },
{ value: "step6", done: true },
@ -683,7 +683,7 @@ let asyncGeneratorCallEvalForNestedResumeReturn =
yield "step7";`);
it = asyncGeneratorCallEvalForNestedResumeReturn();
it.next().then(logIterResult, logError);
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertEquals([
{ value: "step7", done: false },
{ value: "step8", done: true },
@ -698,7 +698,7 @@ let asyncGeneratorNewEvalForNestedResumeReturn =
yield "step9";`);
it = asyncGeneratorNewEvalForNestedResumeReturn();
it.next().then(logIterResult, logError);
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertEquals([
{ value: "step9", done: false },
{ value: "step10", done: true },

View File

@ -1257,7 +1257,7 @@ let testFailure;
testFailure = error;
});
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
if (testFailed) {
throw testFailure;

View File

@ -7,7 +7,7 @@
var error1, error2;
import('modules-skip-12.js').catch(e => error1 = e);
import('modules-skip-12.js').catch(e => error2 = e);
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertEquals(error1, error2);
assertInstanceof(error1, SyntaxError);

View File

@ -7,7 +7,7 @@
var error1, error2;
import('modules-skip-11.js').catch(e => error1 = e);
import('modules-skip-11.js').catch(e => error2 = e);
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertEquals(error1, error2);
assertEquals(typeof error1, "symbol");

View File

@ -7,7 +7,7 @@
var error1, error2;
import('no-such-file').catch(e => error1 = e);
import('no-such-file').catch(e => error2 = e);
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertEquals(error1, error2);
assertEquals(typeof error1, "string");

View File

@ -7,7 +7,7 @@
var error1, error2;
import('modules-skip-10.js').catch(e => error1 = e);
import('modules-skip-10.js').catch(e => error2 = e);
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertEquals(error1, error2);
assertInstanceof(error1, SyntaxError);

View File

@ -7,6 +7,6 @@
var life;
import('modules-skip-1.js').then(namespace => life = namespace.life());
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertEquals(42, life);

View File

@ -9,7 +9,7 @@ import('modules-skip-6.js').then(namespace => life = namespace.life);
assertEquals(undefined, Object.life);
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertEquals(42, Object.life);
assertEquals("42", life);

View File

@ -18,5 +18,5 @@ async function test() {
}
test();
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertTrue(ran);

View File

@ -15,5 +15,5 @@ async function test() {
}
test();
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertTrue(ran);

View File

@ -19,7 +19,7 @@ async function test1() {
}
test1();
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertTrue(ran);
ran = false;
@ -36,5 +36,5 @@ async function test2() {
}
test2();
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertTrue(ran);

View File

@ -22,5 +22,5 @@ async function test() {
}
test();
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertTrue(ran);

View File

@ -17,7 +17,7 @@ async function test1() {
}
test1();
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertTrue(ran);
ran = false;
@ -37,7 +37,7 @@ async function test2() {
}
test2();
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertTrue(ran);
ran = false;
@ -53,5 +53,5 @@ async function test3() {
}
test3();
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertTrue(ran);

View File

@ -12,7 +12,7 @@ var body = "import('modules-skip-1.js').then(ns => { x = ns.life();" +
var func = new Function(body);
func();
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertEquals(42, x);
assertTrue(ran);
@ -21,7 +21,7 @@ var body = "import('modules-skip-1.js').then(ns => { x = ns.life();" +
" ran = true;} ).catch(err => %AbortJS(err))"
eval("var func = new Function(body); func();");
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertEquals(42, x);
assertTrue(ran);
@ -31,6 +31,6 @@ var body = "eval(import('modules-skip-1.js').then(ns => { x = ns.life();" +
var func = new Function(body);
func();
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertEquals(42, x);
assertTrue(ran);

View File

@ -6,6 +6,6 @@
var ns;
import('modules-skip-13.js').then(x => ns = x);
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertEquals(42, ns.default);
assertEquals(ns, ns.self);

View File

@ -12,7 +12,7 @@ import('modules-skip-2.js').catch(err => msg = err.message);
assertEquals(undefined, life);
assertEquals(undefined, msg);
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertEquals(42, life);
assertEquals('42 is not the answer', msg);

View File

@ -17,6 +17,6 @@ async function foo () {
foo();
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertTrue(ran);

View File

@ -9,5 +9,5 @@ let x = 'modules-skip-1.js';
import(x).then(namespace => life = namespace.life());
x = 'modules-skip-2.js';
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertEquals(42, life);

View File

@ -25,5 +25,5 @@ async function test() {
test();
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertTrue(ran);

View File

@ -19,6 +19,6 @@ async function test() {
test();
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertTrue(ran);

View File

@ -43,7 +43,7 @@ async function test1() {
test1();
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertTrue(ran);
@ -66,7 +66,7 @@ async function test2() {
test2();
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertTrue(ran);
@ -86,6 +86,6 @@ async function test3() {
test3();
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertTrue(ran);

View File

@ -18,5 +18,5 @@ async function test() {
}
test();
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertTrue(ran);

View File

@ -25,7 +25,7 @@ let weak_ref;
})();
// Clear the KeepDuringJob set.
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
weak_ref.deref();
o = null;
@ -37,7 +37,7 @@ gc();
wf.cleanupSome();
assertEquals(0, cleanup_count);
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
// Next turn.
// This GC detects the WeakRef as dirty.

View File

@ -25,7 +25,7 @@ let weak_ref;
})();
// Clear the KeepDuringJob set.
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
weak_ref.deref();
o = null;
@ -37,7 +37,7 @@ gc();
wf.cleanupSome();
assertEquals(0, cleanup_count);
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
// Next turn.
// Now the WeakRef can be cleared.
@ -51,7 +51,7 @@ assertEquals(weak_ref, cleanup_cells[0]);
// The cleanup task is not executed again since all WeakCells have been
// processed.
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
// Next turn.
assertEquals(1, cleanup_count);

View File

@ -31,7 +31,7 @@ gc();
wf.cleanupSome();
assertEquals(0, cleanup_count);
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
// Next turn.
// Now the WeakRef can be cleared.

View File

@ -28,7 +28,7 @@ let wr;
gc();
assertNotEquals(undefined, wr.deref());
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
// New turn.
let o = wr.deref();

View File

@ -38,7 +38,7 @@ gc();
assertNotEquals(undefined, wr2.deref());
})();
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
// New turn.
assertEquals(0, cleanup_count);
@ -47,7 +47,7 @@ wr1.deref();
o1 = null;
gc(); // deref makes sure we don't clean up wr1
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
// New turn.
assertEquals(0, cleanup_count);
@ -56,7 +56,7 @@ wr2.deref();
o2 = null;
gc(); // deref makes sure we don't clean up wr2
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
// New turn.
assertEquals(1, cleanup_count);
@ -64,7 +64,7 @@ assertEquals(wr1, cleared_cells1[0]);
gc();
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
// New turn.
assertEquals(2, cleanup_count);

View File

@ -34,12 +34,12 @@ gc();
assertNotEquals(undefined, weak_ref.deref());
})();
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
// Next turn.
gc();
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
// Next turn.
assertTrue(cleanup_called);

View File

@ -33,14 +33,14 @@ gc();
assertNotEquals(undefined, wr.deref());
})();
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
// Next turn.
assertFalse(cleanup_called);
gc();
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
// Next turn.
assertTrue(cleanup_called);

View File

@ -29,12 +29,12 @@ let strong = {a: wr.deref(), b: wr_control.deref()};
gc();
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
// Next turn.
gc();
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
// Next turn.
// We have a strong reference to the objects, so the WeakRefs are not cleared yet.
@ -57,7 +57,7 @@ gc();
assertEquals(undefined, wr_control.deref());
})();
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
// Next turn.
assertEquals(1, cleanup_count);
@ -66,7 +66,7 @@ assertEquals(wc, cleanup_cells[0]);
gc();
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
// Next turn.
assertEquals(2, cleanup_count);

View File

@ -11,7 +11,7 @@ let log = [];
return 10;
}
})();
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
(function() {
with ({get ['.new.target']() { log.push('new.target') }}) {

View File

@ -18,6 +18,6 @@ Promise.resolve(Promise.resolve()).then(() => log += "|fast-resolve");
(class extends Promise {}).resolve(Promise.resolve()).then(() => log += "|slow-resolve");
log += "|start";
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertEquals("|start|turn1|fast-resolve|turn2|turn3|slow-resolve|turn4\n\
|start|turn1|fast-resolve|turn2|turn3|slow-resolve|turn4", result);

View File

@ -9,5 +9,5 @@ function f() {
success = (f.caller === null);
}
Promise.resolve().then(f);
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertTrue(success);

View File

@ -17,6 +17,6 @@ var error;
var promise = __f_0();
promise.then(assertUnreachable,
err => { done = true; error = err });
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertTrue(error.startsWith('Error reading'));
assertTrue(done);

View File

@ -17,7 +17,7 @@ function TryToLoadModule(filename, expect_error, token) {
}
import(filename).catch(SetError);
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
if (expect_error) {
assertTrue(caught_error instanceof SyntaxError);

View File

@ -27,5 +27,5 @@ function g() {
let namespace = Promise.resolve().then(importUndefined);
}
g();
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assertEquals(list, [1,2]);

View File

@ -80,7 +80,7 @@ var testAsync;
}
drainMicrotasks() {
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
}
done_() {
@ -111,7 +111,7 @@ var testAsync;
testAsync = function(test, name) {
let assert = new AsyncAssertion(test, name);
test(assert);
%RunMicrotasks();
%PerformMicrotaskCheckpoint();
assert.done_();
}
})();