Skip to content

Commit

Permalink
Account for the use of ToIndex in Atomic operations (#870)
Browse files Browse the repository at this point in the history
  • Loading branch information
lars-t-hansen authored and leobalter committed Mar 2, 2017
1 parent e262dcd commit abc4dfa
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions harness/testAtomics.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,8 @@ function testWithAtomicsOutOfBoundsIndices(f) {
(view) => -1,
(view) => view.length,
(view) => view.length*2,
(view) => undefined,
(view) => Number.NaN,
(view) => Number.POSITIVE_INFINITY,
(view) => Number.NEGATIVE_INFINITY,
(view) => '3.5',
(view) => 3.5,
(view) => { password: "qumquat" },
(view) => ({ valueOf: () => 125 }),
(view) => ({ toString: () => '125', valueOf: false }) // non-callable valueOf triggers invocation of toString
];
Expand All @@ -38,12 +33,21 @@ function testWithAtomicsOutOfBoundsIndices(f) {
* Calls the provided function for each good index that should not throw when
* passed to an Atomics method on a SAB-backed view.
*
* The view must have length greater than zero.
*
* @param f - the function to call for each good index.
*/
function testWithAtomicsInBoundsIndices(f) {
// Most of these are eventually coerced to +0 by ToIndex.
var good_indices = [
(view) => 0/-1, // -0
(view) => 0/-1,
(view) => '-0',
(view) => undefined,
(view) => NaN,
(view) => 0.5,
(view) => '0.5',
(view) => -0.9,
(view) => ({ password: "qumquat" }),
(view) => view.length - 1,
(view) => ({ valueOf: () => 0 }),
(view) => ({ toString: () => '0', valueOf: false }) // non-callable valueOf triggers invocation of toString
Expand Down

0 comments on commit abc4dfa

Please sign in to comment.