forked from WebKit/WebKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/WebKit/WebKit
- Loading branch information
Showing
925 changed files
with
20,459 additions
and
11,945 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[sourcefilter "include"] | ||
external = WebKitAdditions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
JSTests/microbenchmarks/array-prototype-indexOf-string-16.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
function test(array, value) { | ||
return array.indexOf(value); | ||
} | ||
noInline(test); | ||
|
||
const array = [ | ||
"あいうえおかきくけこさしすせそたちつてとなにぬねの", | ||
"かきくけこさしすせそたちつてとなにぬねのはひふへほ", | ||
"さしすせそたちつてとなにぬねのはひふへほまみむめも", | ||
"たちつてとなにぬねのはひふへほまみむめもやゆよらり", | ||
"なにぬねのはひふへほまみむめもやゆよらりるれろわを", | ||
"はひふへほまみむめもやゆよらりるれろわをんあいうえ", | ||
"まみむめもやゆよらりるれろわをんあいうえおかきくけ", | ||
"やゆよらりるれろわをんあいうえおかきくけこさしすせ", | ||
"らりるれろわをんあいうえおかきくけこさしすせそたち", | ||
"わをんあいうえおかきくけこさしすせそたちつてとなに", | ||
"んあいうえおかきくけこさしすせそたちつてとなにぬね", | ||
"ひふへほまみむめもやゆよらりるれろわをんあいうえお", | ||
"ふへほまみむめもやゆよらりるれろわをんあいうえおか", | ||
"へほまみむめもやゆよらりるれろわをんあいうえおかき", | ||
"ほまみむめもやゆよらりるれろわをんあいうえおかきく", | ||
"みむめもやゆよらりるれろわをんあいうえおかきくけこ", | ||
"むめもやゆよらりるれろわをんあいうえおかきくけこさ", | ||
"めもやゆよらりるれろわをんあいうえおかきくけこさし", | ||
"もやゆよらりるれろわをんあいうえおかきくけこさしす", | ||
"ゆよらりるれろわをんあいうえおかきくけこさしすせそ", | ||
"よらりるれろわをんあいうえおかきくけこさしすせそた", | ||
"らりるれろわをんあいうえおかきくけこさしすせそたち", | ||
"りるれろわをんあいうえおかきくけこさしすせそたちつ", | ||
"るれろわをんあいうえおかきくけこさしすせそたちつて", | ||
"れろわをんあいうえおかきくけこさしすせそたちつてと", | ||
"ろわをんあいうえおかきくけこさしすせそたちつてとな", | ||
]; | ||
|
||
for (var i = 0; i < 1e6; ++i) | ||
test(array, "もやゆよらりるれろわをんあいうえおかきくけこさしす"); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
function test(array, index) { | ||
return array.indexOf(index); | ||
} | ||
noInline(test); | ||
|
||
const array = [ | ||
"dEXt0TxZQQQasd999!@#$%d^&", | ||
"AAZZ!!@@**CC77zzxx1122d33", | ||
"HelloWorldHeldloWorlddABC", | ||
"abcABC123!@#xfyzXYZ!$d%+=", | ||
"Zyx9!Zyx9!Zyx9!Zyx9!!d???", | ||
"LoremIpsum1234!@#$LordemI", | ||
"QQQQQQQQQQqqqqqqqqqq-----", | ||
"&&&&1111%%%%2222@@@@33f33", | ||
"TestStringasdVariousChars", | ||
"RandomASCII~d~~~====?????", | ||
"^^^^#####^^^f^^+++++.....", | ||
"AZaz09!?AZaz09!?AZaz09!?%", | ||
"Foobar##1122Foobar##1122F", | ||
"9876543210!@d#$%^&*()_+=-", | ||
"OneTwo3FourFive6Seven8Nin", | ||
"Zwxy000111Zwxy000111Zwxy0", | ||
"Spark!!!Spark???Spark%%%S", | ||
"ShortAndSweet123??!!Short", | ||
"BenchmarkCaseHere12345!!?", | ||
"MultiLineString###000xxx@", | ||
"ABCDEFGHabcdfefgh1234!!!!", | ||
"111122223333d4444!!!!####", | ||
"EndlessVariety?!@#$%^^^^^", | ||
"PqrstUVWX9876pqrstUVWX987", | ||
"MixItUpWith5omeWe!rdCHARS", | ||
"FinallyZzYyXx!@#$4321)(*&", | ||
]; | ||
for (var i = 0; i < 1e6; ++i) | ||
test(array, "BenchmarkCaseHere12345!!?"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
var length = 1024; | ||
var array = new Array(1024); | ||
array.fill(99); | ||
ensureArrayStorage(array); | ||
|
||
var result; | ||
for (let i = 0; i < 1e5; i++) { | ||
result = array.with(i % 1024, i); | ||
result = array.with((i + 1) % 1024, i + 1); | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
function shouldBe(a, b) { | ||
if (a !== b) | ||
throw new Error(`Expected ${b} but got ${a}`); | ||
} | ||
|
||
function test1(array, searchElement) { | ||
return array.indexOf(searchElement); | ||
} | ||
noInline(test1); | ||
|
||
function test2(array, searchElement, fromIndex) { | ||
return array.indexOf(searchElement, fromIndex); | ||
} | ||
noInline(test2); | ||
|
||
{ | ||
const array = [ | ||
"あいうえお", | ||
"かきくけここ", | ||
"さしすせ", | ||
"たちつてととと", | ||
"なにぬ", | ||
"まみむめもももも" | ||
]; | ||
|
||
for (var i = 0; i < 1e6; ++i) { | ||
shouldBe(test1(array, "あいうえお"), 0); | ||
shouldBe(test1(array, "あいうえおお"), -1); | ||
shouldBe(test1(array, "さしすせ"), 2); | ||
shouldBe(test1(array, "なにぬ"), 4); | ||
shouldBe(test1(array, "お"), -1); | ||
shouldBe(test1(array, "aaaaaaa"), -1); | ||
shouldBe(test2(array, "あいうえお", 1), -1); | ||
shouldBe(test2(array, "かきくけここ", 1), 1); | ||
} | ||
} | ||
|
||
{ | ||
const array = []; | ||
for (let code = 0x4E00; code <= 0x9FFF; code++) { | ||
const char = String.fromCharCode(code); | ||
array.push(char); | ||
} | ||
|
||
for (let i = 0; i < 1e6; i++) { | ||
let code = 0x4E00 + (i % 50); | ||
let searchElement = String.fromCharCode(code); | ||
shouldBe(test1(array, searchElement), i % 50); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
function shouldBe(a, b) { | ||
if (a !== b) | ||
throw new Error(`Expected ${b} but got ${a}`); | ||
} | ||
|
||
function test1(array, searchElement) { | ||
return array.indexOf(searchElement); | ||
} | ||
noInline(test1); | ||
|
||
function test2(array, searchElement, fromIndex) { | ||
return array.indexOf(searchElement, fromIndex); | ||
} | ||
noInline(test2); | ||
|
||
{ | ||
const array = [ | ||
"aasdfflkjlkj", | ||
"bdkjsldfk", | ||
"cadsflkj", | ||
"dasdlkjf", | ||
"afdutnklkj", | ||
"fadajknkj", | ||
"", | ||
]; | ||
|
||
for (var i = 0; i < 1e6; ++i) { | ||
shouldBe(test1(array, "aasdfflkjlkj"), 0); | ||
shouldBe(test1(array, ""), 6); | ||
shouldBe(test1(array, "aaasdfflkjlki"), -1); | ||
shouldBe(test1(array, "cadsflkj"), 2); | ||
shouldBe(test1(array, "afdutnklkj"), 4); | ||
shouldBe(test1(array, "e"), -1); | ||
shouldBe(test1(array, "あああああ"), -1); | ||
shouldBe(test2(array, "aaasdfflkjlkj", 1), -1); | ||
shouldBe(test2(array, "bdkjsldfk", 1), 1); | ||
} | ||
} | ||
|
||
{ | ||
const bigArray = []; | ||
for (let i = 0; i < 1e5; i++) { | ||
bigArray.push(i.toString()); | ||
} | ||
for (let i = 0; i < 1e6; i++) { | ||
let search = (i % 50).toString(); | ||
let result = test1(bigArray, search); | ||
shouldBe(result.toString(), search); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
function shouldBe(a, b) { | ||
if (a !== b) | ||
throw new Error(`Expected ${b} but got ${a}`); | ||
} | ||
|
||
function test1(array, searchElement) { | ||
return array.indexOf(searchElement); | ||
} | ||
noInline(test1); | ||
|
||
function test2(array, searchElement, fromIndex) { | ||
return array.indexOf(searchElement, fromIndex); | ||
} | ||
noInline(test2); | ||
|
||
const obj = {}; | ||
const array = [obj, {}, "b", {}]; | ||
|
||
for (var i = 0; i < 1e6; ++i) { | ||
shouldBe(test1(array, "a"), -1); | ||
shouldBe(test1(array, "b"), 2); | ||
shouldBe(test2(array, obj), 0); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
function sameArray(a, b) { | ||
if (a.length !== b.length) | ||
throw new Error(`Expected array length ${b.length} but got ${a.length}`); | ||
for (let i = 0; i < a.length; i++) { | ||
if (a[i] !== b[i]) | ||
throw new Error(`Expected ${b[i]} but got ${a[i]} (${i})`); | ||
} | ||
} | ||
|
||
|
||
const arr = []; | ||
for (let i = 0; i < 10; i++) { | ||
arr.push(i); | ||
} | ||
let result = arr.with(0, 42); | ||
sameArray(result, [42, 1, 2, 3, 4, 5, 6, 7, 8, 9]); | ||
|
||
result = result.with(6, 87); | ||
sameArray(result, [42, 1, 2, 3, 4, 5, 87, 7, 8, 9]); |
104 changes: 104 additions & 0 deletions
104
JSTests/stress/function-toString-for-accessor-properties.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
// https://tc39.es/ecma262/#sec-well-known-intrinsic-objects | ||
const wellKnownIntrinsicObjects = [ | ||
AggregateError, | ||
Array, | ||
ArrayBuffer, | ||
Atomics, | ||
BigInt, | ||
BigInt64Array, | ||
BigUint64Array, | ||
Boolean, | ||
DataView, | ||
Date, | ||
decodeURI, | ||
decodeURIComponent, | ||
encodeURI, | ||
encodeURIComponent, | ||
Error, | ||
eval, | ||
EvalError, | ||
FinalizationRegistry, | ||
Float32Array, | ||
Float64Array, | ||
Function, | ||
isFinite, | ||
isNaN, | ||
JSON, | ||
Map, | ||
Math, | ||
Number, | ||
Object, | ||
parseFloat, | ||
parseInt, | ||
Promise, | ||
Proxy, | ||
RangeError, | ||
ReferenceError, | ||
Reflect, | ||
RegExp, | ||
Set, | ||
SharedArrayBuffer, | ||
String, | ||
Symbol, | ||
SyntaxError, | ||
TypeError, | ||
Uint8Array, | ||
Uint8ClampedArray, | ||
Uint16Array, | ||
Uint32Array, | ||
URIError, | ||
WeakMap, | ||
WeakRef, | ||
WeakSet, | ||
]; | ||
|
||
function assertNativeGetter(ns) { | ||
const stringified = Function.prototype.toString.call(ns); | ||
if (!stringified.startsWith("function get ")) { | ||
throw new Error("bad value: " + stringified); | ||
} | ||
} | ||
|
||
function assertNativeSetter(ns) { | ||
const stringified = Function.prototype.toString.call(ns); | ||
if (!stringified.startsWith("function set ")) { | ||
throw new Error("bad value: " + stringified); | ||
} | ||
} | ||
|
||
const visited = []; | ||
function visit(ns, isGetter, isSetter) { | ||
if (visited.includes(ns)) { | ||
return; | ||
} | ||
visited.push(ns); | ||
if (typeof ns === "function") { | ||
if (isGetter) { | ||
assertNativeGetter(ns); | ||
} | ||
if (isSetter) { | ||
assertNativeSetter(ns); | ||
} | ||
} | ||
if (typeof ns !== "function" && (typeof ns !== "object" || ns === null)) { | ||
return; | ||
} | ||
|
||
const descriptors = Object.getOwnPropertyDescriptors(ns); | ||
Reflect.ownKeys(descriptors).forEach((name) => { | ||
const desc = descriptors[name]; | ||
if ("value" in desc) { | ||
visit(desc.value, false, false); | ||
} | ||
if ("get" in desc) { | ||
visit(desc.get, true, false); | ||
} | ||
if ("set" in desc) { | ||
visit(desc.set, false, true); | ||
} | ||
}); | ||
} | ||
|
||
wellKnownIntrinsicObjects.forEach((intrinsic) => { | ||
visit(intrinsic, false, false); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.