Skip to content

Commit

Permalink
Regression test of the usage of Set in %TypedArray%.prototype.map.
Browse files Browse the repository at this point in the history
  • Loading branch information
iamstolis committed Jun 20, 2024
1 parent be79811 commit bfaaa4e
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions graal-js/src/com.oracle.truffle.js.test/js/GR-54881.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
*/

// Checks that %TypedArray%.prototype.map uses Set (not CreateDataPropertyOrThrow)

load("assert.js");

var buffer = new ArrayBuffer(8);
var array = new Uint8Array(buffer);
var ctor = function() { return array; };
ctor[Symbol.species] = ctor;
array.constructor = ctor;

var calls = 0;
array.map(function(_,i) {
calls++;
if (i === 1) buffer.transfer();
});

assertSame(8, calls);

0 comments on commit bfaaa4e

Please sign in to comment.