Remove requirement that ToNumber(value) completes in less than $262.agent.MAX_TIME_EPSILON

$262.agent.MAX_TIME_EPSILON was intended to be used for callers like `Atomics.wait(typedArray, indexNumber, valueNumber, timeoutNumber)` where all parameters with the `Number` suffix denote values which are already Number values. It should not be used for `Atomics.wait(typedArray, indexObject, valueObject, timeoutObject)` where all parameters with the `Object` suffix denote values which are Object values, because in that case we'd require that `ToNumber(objectValue)` (potentially invoked multiple times) completes in less than 100 milliseconds (the default value for MAX_TIME_EPSILON).

Also removes $262.agent.MAX_TIME_EPSILON because it is now no longer used.
This commit is contained in:
André Bargull 2018-08-17 07:48:45 -07:00 committed by Rick Waldron
parent ab436c4651
commit d7d154b3bc
10 changed files with 0 additions and 85 deletions

View File

@ -5,13 +5,6 @@ description: >
Collection of functions used to interact with Atomics.* operations across agent boundaries. Collection of functions used to interact with Atomics.* operations across agent boundaries.
---*/ ---*/
/**
* The amount of slack allowed for testing time-related Atomics methods (i.e. wait and notify).
* The absolute value of the difference of the observed time and the expected time must
* be epsilon-close.
*/
$262.agent.MAX_TIME_EPSILON = 100;
/** /**
* @return {String} A report sent from an agent. * @return {String} A report sent from an agent.
*/ */

View File

@ -35,16 +35,13 @@ $262.agent.start(`
const i64a = new BigInt64Array(sab); const i64a = new BigInt64Array(sab);
Atomics.add(i64a, ${RUNNING}, 1n); Atomics.add(i64a, ${RUNNING}, 1n);
const before = $262.agent.monotonicNow();
const status1 = Atomics.wait(i64a, 0, 0n, false); const status1 = Atomics.wait(i64a, 0, 0n, false);
const status2 = Atomics.wait(i64a, 0, 0n, valueOf); const status2 = Atomics.wait(i64a, 0, 0n, valueOf);
const status3 = Atomics.wait(i64a, 0, 0n, toPrimitive); const status3 = Atomics.wait(i64a, 0, 0n, toPrimitive);
const duration = $262.agent.monotonicNow() - before;
$262.agent.report(status1); $262.agent.report(status1);
$262.agent.report(status2); $262.agent.report(status2);
$262.agent.report(status3); $262.agent.report(status3);
$262.agent.report(duration);
$262.agent.leaving(); $262.agent.leaving();
}); });
`); `);
@ -75,10 +72,4 @@ assert.sameValue(
'$262.agent.getReport() returns "timed-out"' '$262.agent.getReport() returns "timed-out"'
); );
const lapse = $262.agent.getReport();
assert(lapse >= 0, 'The result of `(lapse >= 0)` is true (timeout should be a min of 0ms)');
assert(lapse <= $262.agent.MAX_TIME_EPSILON, 'The result of `(lapse <= $262.agent.MAX_TIME_EPSILON)` is true');
assert.sameValue(Atomics.notify(i64a, 0), 0, 'Atomics.notify(i64a, 0) returns 0'); assert.sameValue(Atomics.notify(i64a, 0), 0, 'Atomics.notify(i64a, 0) returns 0');

View File

@ -35,16 +35,13 @@ $262.agent.start(`
const i32a = new Int32Array(sab); const i32a = new Int32Array(sab);
Atomics.add(i32a, ${RUNNING}, 1); Atomics.add(i32a, ${RUNNING}, 1);
const before = $262.agent.monotonicNow();
const status1 = Atomics.wait(i32a, 0, 0, false); const status1 = Atomics.wait(i32a, 0, 0, false);
const status2 = Atomics.wait(i32a, 0, 0, valueOf); const status2 = Atomics.wait(i32a, 0, 0, valueOf);
const status3 = Atomics.wait(i32a, 0, 0, toPrimitive); const status3 = Atomics.wait(i32a, 0, 0, toPrimitive);
const duration = $262.agent.monotonicNow() - before;
$262.agent.report(status1); $262.agent.report(status1);
$262.agent.report(status2); $262.agent.report(status2);
$262.agent.report(status3); $262.agent.report(status3);
$262.agent.report(duration);
$262.agent.leaving(); $262.agent.leaving();
}); });
`); `);
@ -75,10 +72,4 @@ assert.sameValue(
'$262.agent.getReport() returns "timed-out"' '$262.agent.getReport() returns "timed-out"'
); );
const lapse = $262.agent.getReport();
assert(lapse >= 0, 'The result of `(lapse >= 0)` is true (timeout should be a min of 0ms)');
assert(lapse <= $262.agent.MAX_TIME_EPSILON, 'The result of `(lapse <= $262.agent.MAX_TIME_EPSILON)` is true');
assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0'); assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0');

View File

@ -35,16 +35,13 @@ $262.agent.start(`
const i32a = new Int32Array(sab); const i32a = new Int32Array(sab);
Atomics.add(i32a, ${RUNNING}, 1); Atomics.add(i32a, ${RUNNING}, 1);
const before = $262.agent.monotonicNow();
const status1 = Atomics.wait(i32a, 0, 0, null); const status1 = Atomics.wait(i32a, 0, 0, null);
const status2 = Atomics.wait(i32a, 0, 0, valueOf); const status2 = Atomics.wait(i32a, 0, 0, valueOf);
const status3 = Atomics.wait(i32a, 0, 0, toPrimitive); const status3 = Atomics.wait(i32a, 0, 0, toPrimitive);
const duration = $262.agent.monotonicNow() - before;
$262.agent.report(status1); $262.agent.report(status1);
$262.agent.report(status2); $262.agent.report(status2);
$262.agent.report(status3); $262.agent.report(status3);
$262.agent.report(duration);
$262.agent.leaving(); $262.agent.leaving();
}); });
`); `);
@ -75,10 +72,4 @@ assert.sameValue(
'$262.agent.getReport() returns "timed-out"' '$262.agent.getReport() returns "timed-out"'
); );
const lapse = $262.agent.getReport();
assert(lapse >= 0, 'The result of `(lapse >= 0)` is true (timeout should be a min of 0ms)');
assert(lapse <= $262.agent.MAX_TIME_EPSILON, 'The result of `(lapse <= $262.agent.MAX_TIME_EPSILON)` is true (timeout should be a max of $262.agent.MAX_TIME_EPSILON)');
assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0'); assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0');

View File

@ -41,16 +41,13 @@ $262.agent.start(`
const i32a = new Int32Array(sab); const i32a = new Int32Array(sab);
Atomics.add(i32a, ${RUNNING}, 1); Atomics.add(i32a, ${RUNNING}, 1);
const before = $262.agent.monotonicNow();
const status1 = Atomics.wait(i32a, 0, 0, valueOf); const status1 = Atomics.wait(i32a, 0, 0, valueOf);
const status2 = Atomics.wait(i32a, 0, 0, toString); const status2 = Atomics.wait(i32a, 0, 0, toString);
const status3 = Atomics.wait(i32a, 0, 0, toPrimitive); const status3 = Atomics.wait(i32a, 0, 0, toPrimitive);
const duration = $262.agent.monotonicNow() - before;
$262.agent.report(status1); $262.agent.report(status1);
$262.agent.report(status2); $262.agent.report(status2);
$262.agent.report(status3); $262.agent.report(status3);
$262.agent.report(duration);
$262.agent.leaving(); $262.agent.leaving();
}); });
`); `);
@ -81,10 +78,4 @@ assert.sameValue(
'$262.agent.getReport() returns "timed-out"' '$262.agent.getReport() returns "timed-out"'
); );
const lapse = $262.agent.getReport();
assert(lapse >= 0, 'The result of `(lapse >= 0)` is true (timeout should be a min of 0ms)');
assert(lapse <= $262.agent.MAX_TIME_EPSILON, 'The result of `(lapse <= $262.agent.MAX_TIME_EPSILON)` is true (timeout should be a max of $$262.agent.MAX_TIME_EPSILON)');
assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0'); assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0');

View File

@ -38,7 +38,6 @@ $262.agent.start(`
let status1 = ""; let status1 = "";
let status2 = ""; let status2 = "";
const start = $262.agent.monotonicNow();
try { try {
Atomics.wait(i32a, 0, 0, poisonedValueOf); Atomics.wait(i32a, 0, 0, poisonedValueOf);
} catch (error) { } catch (error) {
@ -49,11 +48,9 @@ $262.agent.start(`
} catch (error) { } catch (error) {
status2 = "poisonedToPrimitive"; status2 = "poisonedToPrimitive";
} }
const duration = $262.agent.monotonicNow() - start;
$262.agent.report(status1); $262.agent.report(status1);
$262.agent.report(status2); $262.agent.report(status2);
$262.agent.report(duration);
$262.agent.leaving(); $262.agent.leaving();
}); });
`); `);
@ -79,10 +76,4 @@ assert.sameValue(
'$262.agent.getReport() returns "poisonedToPrimitive"' '$262.agent.getReport() returns "poisonedToPrimitive"'
); );
const lapse = $262.agent.getReport();
assert(lapse >= 0, 'The result of `(lapse >= 0)` is true (timeout should be a min of 0ms)');
assert(lapse <= $262.agent.MAX_TIME_EPSILON, 'The result of `(lapse <= $262.agent.MAX_TIME_EPSILON)` is true (timeout should be a max of $$262.agent.MAX_TIME_EPSILON)');
assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0'); assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0');

View File

@ -51,7 +51,6 @@ $262.agent.start(`
let status1 = ""; let status1 = "";
let status2 = ""; let status2 = "";
const start = $262.agent.monotonicNow();
try { try {
Atomics.wait(i32a, Symbol("1"), poisonedValueOf, poisonedValueOf); Atomics.wait(i32a, Symbol("1"), poisonedValueOf, poisonedValueOf);
} catch (error) { } catch (error) {
@ -62,11 +61,9 @@ $262.agent.start(`
} catch (error) { } catch (error) {
status2 = 'Symbol("2")'; status2 = 'Symbol("2")';
} }
const duration = $262.agent.monotonicNow() - start;
$262.agent.report(status1); $262.agent.report(status1);
$262.agent.report(status2); $262.agent.report(status2);
$262.agent.report(duration);
$262.agent.leaving(); $262.agent.leaving();
}); });
`); `);
@ -92,9 +89,4 @@ assert.sameValue(
'$262.agent.getReport() returns "Symbol("2")"' '$262.agent.getReport() returns "Symbol("2")"'
); );
const lapse = $262.agent.getReport();
assert(lapse >= 0, 'The result of `(lapse >= 0)` is true (The result of `(lapse >= 0)` is true (timeout should be a min of 0ms))');
assert(lapse <= $262.agent.MAX_TIME_EPSILON, 'The result of `(lapse <= $262.agent.MAX_TIME_EPSILON)` is true (The result of `(lapse <= $262.agent.MAX_TIME_EPSILON)` is true (timeout should be a max of $$262.agent.MAX_TIME_EPSILON))');
assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0'); assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0');

View File

@ -26,7 +26,6 @@ $262.agent.start(`
let status1 = ""; let status1 = "";
let status2 = ""; let status2 = "";
const start = $262.agent.monotonicNow();
try { try {
Atomics.wait(i32a, 0, 0, Symbol("1")); Atomics.wait(i32a, 0, 0, Symbol("1"));
} catch (error) { } catch (error) {
@ -37,11 +36,9 @@ $262.agent.start(`
} catch (error) { } catch (error) {
status2 = 'Symbol("2")'; status2 = 'Symbol("2")';
} }
const duration = $262.agent.monotonicNow() - start;
$262.agent.report(status1); $262.agent.report(status1);
$262.agent.report(status2); $262.agent.report(status2);
$262.agent.report(duration);
$262.agent.leaving(); $262.agent.leaving();
}); });
`); `);
@ -67,9 +64,4 @@ assert.sameValue(
'$262.agent.getReport() returns "Symbol("2")"' '$262.agent.getReport() returns "Symbol("2")"'
); );
const lapse = $262.agent.getReport();
assert(lapse >= 0, 'The result of `(lapse >= 0)` is true (timeout should be a min of 0ms)');
assert(lapse <= $262.agent.MAX_TIME_EPSILON, 'The result of `(lapse <= $262.agent.MAX_TIME_EPSILON)` is true (timeout should be a max of $$262.agent.MAX_TIME_EPSILON)');
assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0'); assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0');

View File

@ -42,7 +42,6 @@ $262.agent.start(`
let status1 = ""; let status1 = "";
let status2 = ""; let status2 = "";
const before = $262.agent.monotonicNow();
try { try {
Atomics.wait(i32a, 0, Symbol("1"), poisonedValueOf); Atomics.wait(i32a, 0, Symbol("1"), poisonedValueOf);
} catch (error) { } catch (error) {
@ -53,11 +52,9 @@ $262.agent.start(`
} catch (error) { } catch (error) {
status2 = 'Symbol("2")'; status2 = 'Symbol("2")';
} }
const duration = $262.agent.monotonicNow() - before;
$262.agent.report(status1); $262.agent.report(status1);
$262.agent.report(status2); $262.agent.report(status2);
$262.agent.report(duration);
$262.agent.leaving(); $262.agent.leaving();
}); });
`); `);
@ -83,9 +80,4 @@ assert.sameValue(
'$262.agent.getReport() returns "Symbol("2")"' '$262.agent.getReport() returns "Symbol("2")"'
); );
const lapse = $262.agent.getReport();
assert(lapse >= 0, 'The result of `(lapse >= 0)` is true (timeout should be a min of 0ms)');
assert(lapse <= $262.agent.MAX_TIME_EPSILON, 'The result of `(lapse <= $262.agent.MAX_TIME_EPSILON)` is true (timeout should be a max of $$262.agent.MAX_TIME_EPSILON)');
assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0'); assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0');

View File

@ -35,16 +35,13 @@ $262.agent.start(`
const i32a = new Int32Array(sab); const i32a = new Int32Array(sab);
Atomics.add(i32a, ${RUNNING}, 1); Atomics.add(i32a, ${RUNNING}, 1);
const start = $262.agent.monotonicNow();
const status1 = Atomics.wait(i32a, 0, 0, true); const status1 = Atomics.wait(i32a, 0, 0, true);
const status2 = Atomics.wait(i32a, 0, 0, valueOf); const status2 = Atomics.wait(i32a, 0, 0, valueOf);
const status3 = Atomics.wait(i32a, 0, 0, toPrimitive); const status3 = Atomics.wait(i32a, 0, 0, toPrimitive);
const duration = $262.agent.monotonicNow() - start;
$262.agent.report(status1); $262.agent.report(status1);
$262.agent.report(status2); $262.agent.report(status2);
$262.agent.report(status3); $262.agent.report(status3);
$262.agent.report(duration);
$262.agent.leaving(); $262.agent.leaving();
}); });
`); `);
@ -75,10 +72,4 @@ assert.sameValue(
'$262.agent.getReport() returns "timed-out"' '$262.agent.getReport() returns "timed-out"'
); );
const lapse = $262.agent.getReport();
assert(lapse >= 0, 'The result of `(lapse >= 0)` is true (timeout should be a min of 0ms)');
assert(lapse <= $262.agent.MAX_TIME_EPSILON, 'The result of `(lapse <= $262.agent.MAX_TIME_EPSILON)` is true (timeout should be a max of $$262.agent.MAX_TIME_EPSILON)');
assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0'); assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0');