Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream'
Browse files Browse the repository at this point in the history
  • Loading branch information
dylan-conway committed Oct 2, 2024
2 parents 76798f7 + a9fce28 commit e94a0f0
Show file tree
Hide file tree
Showing 7,473 changed files with 277,110 additions and 231,349 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
3 changes: 3 additions & 0 deletions Configurations/Sanitizers.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ WK_SANITIZER_GCC_OPTIMIZATION_LEVEL_Debug = 0;
WK_SANITIZER_GCC_OPTIMIZATION_LEVEL_Production = 1;
WK_SANITIZER_GCC_OPTIMIZATION_LEVEL_Release = 1;

GCC_PREPROCESSOR_DEFINITIONS = $(inherited) $(WK_ENABLE_CONJECTURE_ASSERT_$(WK_ANY_SANITIZER_ENABLED));
WK_ENABLE_CONJECTURE_ASSERT_YES = ENABLE_CONJECTURE_ASSERT=1;

WK_SANITIZER_OTHER_CFLAGS = $(WK_ANY_SANITIZER_CFLAGS_$(WK_ANY_SANITIZER_ENABLED)) $(WK_ADDRESS_SANITIZER_OTHER_CFLAGS_$(ENABLE_ADDRESS_SANITIZER)) $(WK_UNDEFINED_BEHAVIOR_SANITIZER_OTHER_CFLAGS_$(ENABLE_UNDEFINED_BEHAVIOR_SANITIZER)) $(WK_FUZZILLI_OTHER_CFLAGS_$(ENABLE_FUZZILLI)) $(WK_LIBFUZZER_OTHER_CFLAGS_$(ENABLE_LIBFUZZER));

WK_SANITIZER_OTHER_CPLUSPLUSFLAGS = $(WK_ADDRESS_SANITIZER_OTHER_CPLUSPLUSFLAGS_$(ENABLE_ADDRESS_SANITIZER));
Expand Down
2 changes: 1 addition & 1 deletion Configurations/Version.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

MAJOR_VERSION = 621;
MINOR_VERSION = 1;
TINY_VERSION = 1;
TINY_VERSION = 3;
MICRO_VERSION = 0;
NANO_VERSION = 0;
FULL_VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(TINY_VERSION);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
function shouldBe(actual, expected) {
if (actual !== expected)
throw new Error('bad value: ' + actual);
}

function test(array1) {
return array1.concat();
}
noInline(test);

var array1 = [2.1, 2.2, 2.3, 2.4, 4, 5, 6, 7];
for (var i = 0; i < 1e4; ++i) {
var result = test(array1);
shouldBe(result[0], 2.1);
shouldBe(result[1], 2.2);
shouldBe(result[2], 2.3);
shouldBe(result[3], 2.4);
shouldBe(result[4], 4);
shouldBe(result[5], 5);
shouldBe(result[6], 6);
shouldBe(result[7], 7);
shouldBe(result.length, 8);
}
19 changes: 19 additions & 0 deletions JSTests/microbenchmarks/array-prototype-concat-copy-double.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
function shouldBe(actual, expected) {
if (actual !== expected)
throw new Error('bad value: ' + actual);
}

function test(array1) {
return array1.concat();
}
noInline(test);

var array1 = [2.1, 2.2, 2.3, 2.4];
for (var i = 0; i < 1e4; ++i) {
var result = test(array1);
shouldBe(result[0], 2.1);
shouldBe(result[1], 2.2);
shouldBe(result[2], 2.3);
shouldBe(result[3], 2.4);
shouldBe(result.length, 4);
}
19 changes: 19 additions & 0 deletions JSTests/microbenchmarks/array-prototype-concat-copy-int32.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
function shouldBe(actual, expected) {
if (actual !== expected)
throw new Error('bad value: ' + actual);
}

function test(array1) {
return array1.concat();
}
noInline(test);

var array1 = [2, 3, 4, 5];
for (var i = 0; i < 1e4; ++i) {
var result = test(array1);
shouldBe(result[0], 2);
shouldBe(result[1], 3);
shouldBe(result[2], 4);
shouldBe(result[3], 5);
shouldBe(result.length, 4);
}
20 changes: 20 additions & 0 deletions JSTests/microbenchmarks/array-prototype-concat-copy-obj.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
function shouldBe(actual, expected) {
if (actual !== expected)
throw new Error('bad value: ' + actual);
}

function test(array1) {
return array1.concat();
}
noInline(test);

var obj1 = {}, obj2 = {}, obj3 = {}, obj4 = {};
var array1 = [obj1, obj2, obj3, obj4];
for (var i = 0; i < 1e4; ++i) {
var result = test(array1);
shouldBe(result[0], obj1);
shouldBe(result[1], obj2);
shouldBe(result[2], obj3);
shouldBe(result[3], obj4);
shouldBe(result.length, 4);
}
22 changes: 22 additions & 0 deletions JSTests/microbenchmarks/array-prototype-with-fast-path.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
function shouldBe(actual, expected) {
if (actual !== expected)
throw new Error('bad value: ' + actual);
}

function test(array1, index, value) {
return array1.with(index, value);
}

noInline(test);

const array = new Array(1024);
array.fill(99);

const index = 512;
const newValue = 300;

for (let i = 0; i < 1e2; i++) {
const result = test(array, index, newValue);
shouldBe(result[index], newValue);
shouldBe(result.length, array.length);
}
12 changes: 12 additions & 0 deletions JSTests/microbenchmarks/hash-map-double.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
function test(map, i)
{
return map.get(i);
}
noInline(test);

let map = new Map();
for (var i = 0; i < 1e6; ++i) {
test(map, i * 0.253);
test(map, i * 20.253);
test(map, i * 3.2);
}
8 changes: 8 additions & 0 deletions JSTests/microbenchmarks/set-delete-add.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
var map = new Set();

for (var i = 0; i < 1000; i++) {
for (var j = 0; j < 1000; j++) {
map.delete(j);
map.add(j);
}
}
12 changes: 12 additions & 0 deletions JSTests/microbenchmarks/splice-to-remove-and-insert.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//@ skip if $model == "Apple Watch Series 3" # added by mark-jsc-stress-test.py
//@ skip

(function () {
for (var i = 0; i < 100; ++i) {
var array = [];
for (var j = 0; j < 1000; ++j)
array.push(j);
while (array.length > 10)
array.splice(array.length / 2, 5, 1, 2, 3);
}
}());
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

function test(str) {
return str.replace('h', "abc");
}
noInline(test);

let str = (-1).toLocaleString().padEnd(315241, "hello ");
for (let i = 0; i < 1e2; i++) {
test(str);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

function test(str) {
return str.replace('h', "abc");
}
noInline(test);

let str = (-1).toLocaleString().padEnd(296, "hello ");
for (let i = 0; i < 1e4; i++) {
test(str);
}
2 changes: 1 addition & 1 deletion JSTests/microbenchmarks/wasm-cc-int-to-int.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//@ skip unless $isWasmPlatform
//@ runDefaultWasm("--useWasm=1", "--useWasmJITLessJSEntrypoint=1")
//@ runDefaultWasm("--useWasm=1")

var wasm_code;
try {
Expand Down
109 changes: 109 additions & 0 deletions JSTests/stress/array-prototype-concat-copy-empty.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
function shouldBe(actual, expected) {
if (actual !== expected)
throw new Error('bad value: ' + actual);
}

{
let source = new Array(0);
let result = source.concat();
shouldBe(result.length, 0);
}

{
let source = new Array(2);
source[0] = 42;
source[1] = 43;
let result = source.concat();
shouldBe(result.length, 2);
shouldBe(result[0], 42);
shouldBe(result[1], 43);
}

{
let source = new Array(2);
source[0] = 42.195;
source[1] = 43.195;
let result = source.concat();
shouldBe(result.length, 2);
shouldBe(result[0], 42.195);
shouldBe(result[1], 43.195);
}

{
let source = new Array(6);
let result = source.concat();
shouldBe(result.length, 6);
for (var i = 0; i < result.length; ++i) {
shouldBe(result.hasOwnProperty(i), false);
shouldBe(result[i], undefined);
}
}

{
let source = new Array(6);
source[0] = 42;
let result = source.concat();
shouldBe(result.length, 6);
for (var i = 0; i < result.length; ++i) {
if (i === 0) {
shouldBe(result.hasOwnProperty(i), true);
shouldBe(result[i], 42);
} else {
shouldBe(result.hasOwnProperty(i), false);
shouldBe(result[i], undefined);
}
}
}

{
let source = new Array(6);
source[0] = 42.195;
let result = source.concat();
shouldBe(result.length, 6);
for (var i = 0; i < result.length; ++i) {
if (i === 0) {
shouldBe(result.hasOwnProperty(i), true);
shouldBe(result[i], 42.195);
} else {
shouldBe(result.hasOwnProperty(i), false);
shouldBe(result[i], undefined);
}
}
}

{
let source = new Array(6);
source[0] = "string";
let result = source.concat();
shouldBe(result.length, 6);
for (var i = 0; i < result.length; ++i) {
if (i === 0) {
shouldBe(result.hasOwnProperty(i), true);
shouldBe(result[i], "string");
} else {
shouldBe(result.hasOwnProperty(i), false);
shouldBe(result[i], undefined);
}
}
}

{
let source = new Array(6);
source[0] = "string";
$vm.ensureArrayStorage(source);
source[1000] = "Hello";
let result = source.concat();
shouldBe(result.length, 1001);
for (var i = 0; i < result.length; ++i) {
if (i === 0) {
shouldBe(result.hasOwnProperty(i), true);
shouldBe(result[i], "string");
} else if (i === 1000) {
shouldBe(result.hasOwnProperty(i), true);
shouldBe(result[i], "Hello");
} else {
shouldBe(result.hasOwnProperty(i), false);
shouldBe(result[i], undefined);
}
}
}
21 changes: 21 additions & 0 deletions JSTests/stress/array-prototype-concat-species.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
function shouldBe(actual, expected) {
if (actual !== expected)
throw new Error('bad value: ' + actual);
}

let constructorCallCount = 0;
function Constructor() {
constructorCallCount++;
return {};
}

const array = [1, 2, 3];
array.constructor = { [Symbol.species]: Constructor };

const result = array.concat();

shouldBe(constructorCallCount, 1);
shouldBe(Object.getPrototypeOf(result) === Array.prototype, false);
shouldBe(result[0], 1);
shouldBe(result[1], 2);
shouldBe(result[2], 3);
21 changes: 21 additions & 0 deletions JSTests/stress/array-prototype-with-effect.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
function sameValue(a, b) {
if (a !== b)
throw new Error(`Expected ${b} but got ${a}`);
}

const arr = [0, 1, 2];

let get0Count = 0;
Object.defineProperty(arr, "0", {
get() {
get0Count++;
return 0;
}
});

arr.with(1, 2);
sameValue(get0Count, 1);
arr.with(2, 2);
sameValue(get0Count, 2);
arr.with(0, 2);
sameValue(get0Count, 2);
Loading

0 comments on commit e94a0f0

Please sign in to comment.