forked from WebKit/WebKit
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/main'
- Loading branch information
Showing
4,366 changed files
with
251,612 additions
and
942,791 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
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 |
---|---|---|
@@ -1,8 +1,18 @@ | ||
[submitproject "filter"] | ||
includedSubdirectoryPatterns = Configurations/ | ||
includedSubdirectoryPatterns = Source/ | ||
includedSubdirectoryPatterns = WebKitLibraries/SDKs/*.internal-additions.sdk/ | ||
excludedSubdirectoryPatterns = Source/ThirdParty/libwebrtc/Source/third_party/boringssl/src/util | ||
excludedSubdirectoryPatterns = Source/ThirdParty/libwebrtc/Source/webrtc/examples | ||
excludedSubdirectoryPatterns = Source/ThirdParty/capstone | ||
excludedSubdirectoryPatterns = Source/ThirdParty/d3flamegraphjs | ||
excludedSubdirectoryPatterns = Source/ThirdParty/d3js | ||
excludedSubdirectoryPatterns = Source/ThirdParty/gmock | ||
excludedSubdirectoryPatterns = Source/ThirdParty/gtest | ||
excludedSubdirectoryPatterns = Source/ThirdParty/libsysprof-capture | ||
excludedSubdirectoryPatterns = Source/ThirdParty/qunit | ||
excludedSubdirectoryPatterns = Source/ThirdParty/skia | ||
excludedSubdirectoryPatterns = Source/ThirdParty/unifdef | ||
excludedSubdirectoryPatterns = Source/ThirdParty/xdgmime | ||
[submitproject "gitmodules"] | ||
enabled = 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[submitproject "filter"] | ||
includedSubdirectoryPatterns = Tools/DumpRenderTree | ||
includedSubdirectoryPatterns = Tools/ImageDiff | ||
includedSubdirectoryPatterns = Tools/MiniBrowser | ||
includedSubdirectoryPatterns = Tools/TestRunnerShared | ||
includedSubdirectoryPatterns = Tools/WebKitTestRunner | ||
excludedSubdirectoryPatterns = Tools/WebKitTestRunner/gtk |
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
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
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,12 @@ | ||
|
||
function test(str, regexp) { | ||
str.match(regexp); | ||
} | ||
noInline(test); | ||
|
||
let str = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; | ||
let regexp = /aaaaa/g; | ||
for (let i = 0; i < 1e4; i++) { | ||
test(str, regexp); | ||
} | ||
|
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,12 @@ | ||
|
||
function test(str, regexp) { | ||
str.match(regexp); | ||
} | ||
noInline(test); | ||
|
||
let str = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; | ||
let regexp = /a/g; | ||
for (let i = 0; i < 1e4; i++) { | ||
test(str, regexp); | ||
} | ||
|
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 |
---|---|---|
|
@@ -10,4 +10,3 @@ let regexp = /aaaaaaaaaa/g; | |
for (let i = 0; i < 1e4; i++) { | ||
test(str, regexp); | ||
} | ||
|
13 changes: 13 additions & 0 deletions
13
JSTests/microbenchmarks/global-atom-substring-match-one-char.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,13 @@ | ||
|
||
function test(str, regexp) { | ||
str.substring(0, 50).match(regexp); | ||
str.substring(0, 60).match(regexp); | ||
} | ||
noInline(test); | ||
|
||
let str = "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"; | ||
let regexp = /\n/g; | ||
for (let i = 0; i < 1e4; i++) { | ||
test(str, regexp); | ||
} | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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,40 @@ | ||
function shouldThrow(op, errorConstructor) { | ||
try { | ||
op(); | ||
} catch (e) { | ||
if (!(e instanceof errorConstructor)) { | ||
throw new Error(`threw ${e}, but should have thrown ${errorConstructor.name}`); | ||
} | ||
return; | ||
} | ||
throw new Error(`Expected to throw ${errorConstructor.name}, but no exception thrown`); | ||
} | ||
|
||
const df = new Intl.DurationFormat(); | ||
|
||
{ | ||
const invalidValues = [ | ||
2**32, | ||
2**32 + 1, | ||
Number.MAX_SAFE_INTEGER, | ||
Number.MAX_VALUE, | ||
]; | ||
for (const v of invalidValues) { | ||
shouldThrow(() => { df.format({ years: v }); }, RangeError); | ||
shouldThrow(() => { df.format({ months: v }); }, RangeError); | ||
shouldThrow(() => { df.format({ weeks: v }); }, RangeError); | ||
} | ||
} | ||
|
||
{ | ||
shouldThrow(() => { df.format({ days: Math.ceil((Number.MAX_SAFE_INTEGER + 1) / 86400) }); }, RangeError) | ||
shouldThrow(() => { df.format({ hours: Math.ceil((Number.MAX_SAFE_INTEGER + 1) / 3600) }) }, RangeError); | ||
shouldThrow(() => { df.format({ minutes: Math.ceil((Number.MAX_SAFE_INTEGER + 1) / 60) }) }, RangeError); | ||
shouldThrow(() => { df.format({ seconds: Number.MAX_SAFE_INTEGER + 1 }) }, RangeError); | ||
shouldThrow(() => { df.format({ milliseconds: (Number.MAX_SAFE_INTEGER + 1) * 1e3 }) }, RangeError); | ||
shouldThrow(() => { df.format({ milliseconds: 9007199254740992_000 }) }, RangeError); | ||
shouldThrow(() => { df.format({ microseconds: (Number.MAX_SAFE_INTEGER + 1) * 1e6 }) }, RangeError); | ||
shouldThrow(() => { df.format({ microseconds: 9007199254740992_000_000 }) }, RangeError); | ||
shouldThrow(() => { df.format({ nanoseconds: (Number.MAX_SAFE_INTEGER + 1) * 1e9 }) }, RangeError); | ||
shouldThrow(() => { df.format({ nanoseconds: 9007199254740992_000_000_000 }) }, RangeError); | ||
} |
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,41 @@ | ||
function sameValue(actual, expected) { | ||
if (actual !== expected) | ||
throw new Error(`Expected ${expected} but got ${actual}`); | ||
} | ||
|
||
{ | ||
// This is calculated as 9.123456788999999 in double | ||
const duration = { | ||
seconds: 9, | ||
milliseconds: 123, | ||
microseconds: 456, | ||
nanoseconds: 789, | ||
}; | ||
|
||
const df = new Intl.DurationFormat('en', { style: "digital" }); | ||
sameValue(df.format(duration), "0:00:09.123456789"); | ||
} | ||
|
||
{ | ||
// This is calculated as 10000000.000000002 in double | ||
const duration = { | ||
seconds: 10_000_000, | ||
nanoseconds: 1, | ||
}; | ||
|
||
const df = new Intl.DurationFormat('en', { style: "digital" }); | ||
sameValue(df.format(duration), "0:00:10,000,000.000000001"); | ||
} | ||
|
||
{ | ||
// This is calculated as 0:00:9,007,199,254,740,992 in double | ||
const duration = { | ||
// Actual value is: 4503599627370497024 | ||
milliseconds: 4503599627370497_000, | ||
// Actual value is: 4503599627370494951424 | ||
microseconds: 4503599627370495_000000, | ||
}; | ||
|
||
const df = new Intl.DurationFormat('en', { style: 'digital' }); | ||
sameValue(df.format(duration), '0:00:9,007,199,254,740,991.975424'); | ||
} |
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,42 @@ | ||
//@ requireOptions("--useIteratorHelpers=1", "--useIteratorSequencing=1") | ||
|
||
function shouldBe(actual, expected) { | ||
if (actual !== expected) | ||
throw new Error(`FAIL: expected '${expected}' actual '${actual}'`); | ||
} | ||
|
||
function shouldBeArray(actual, expected) { | ||
shouldBe(actual.length, expected.length); | ||
for (let i = 0; i < expected.length; ++i) | ||
shouldBe(actual[i], expected[i]); | ||
} | ||
|
||
function shouldThrow(callback, errorConstructor) { | ||
try { | ||
callback(); | ||
} catch (e) { | ||
shouldBe(e instanceof errorConstructor, true); | ||
return | ||
} | ||
throw new Error('FAIL: should have thrown'); | ||
} | ||
|
||
shouldBeArray(Array.from(Iterator.concat([1, 2, 3, 4, 5, 6])), [1, 2, 3, 4, 5, 6]); | ||
shouldBeArray(Array.from(Iterator.concat([1, 2], [3, 4], [5, 6])), [1, 2, 3, 4, 5, 6]); | ||
shouldBeArray(Array.from(Iterator.concat([], [1], [], [2], [], [3], [], [4], [], [5], [], [6], [])), [1, 2, 3, 4, 5, 6]); | ||
|
||
const customIterable = { | ||
[Symbol.iterator]() { | ||
return [1, 2, 3][Symbol.iterator](); | ||
}, | ||
}; | ||
shouldBeArray(Array.from(Iterator.concat(customIterable, ["abc"], customIterable)), [1, 2, 3, "abc", 1, 2, 3]); | ||
|
||
const nonIterableArray = []; | ||
nonIterableArray[Symbol.iterator] = undefined; | ||
|
||
for (let invalid of [undefined, null, false, true, 42, "abc", {}, nonIterableArray]) { | ||
shouldThrow(() => { | ||
Iterator.concat(invalid); | ||
}, TypeError); | ||
} |
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,171 @@ | ||
//@ requireOptions("--useIteratorHelpers=1", "--useIteratorChunking=1") | ||
|
||
function assert(a, text) { | ||
if (!a) | ||
throw new Error(`Failed assertion: ${text}`); | ||
} | ||
|
||
function sameValue(a, b) { | ||
if (a !== b) | ||
throw new Error(`Expected ${b} but got ${a}`); | ||
} | ||
|
||
function sameArray(a, b) { | ||
sameValue(JSON.stringify(a), JSON.stringify(b)); | ||
} | ||
|
||
function shouldThrow(fn, error, message) { | ||
try { | ||
fn(); | ||
throw new Error('Expected to throw, but succeeded'); | ||
} catch (e) { | ||
if (!(e instanceof error)) | ||
throw new Error(`Expected to throw ${error.name} but got ${e.name}`); | ||
if (e.message !== message) | ||
throw new Error(`Expected ${error.name} with '${message}' but got '${e.message}'`); | ||
} | ||
} | ||
|
||
{ | ||
class Iter extends Iterator { | ||
i = 1; | ||
next() { | ||
if (this.i > 5) | ||
return { value: this.i, done: true } | ||
return { value: this.i++, done: false } | ||
} | ||
} | ||
const iter = new Iter(); | ||
const result = Array.from(iter.chunks(1)); | ||
sameArray(result, [[1], [2], [3], [4], [5]]); | ||
} | ||
|
||
{ | ||
const iter = { | ||
i: 1, | ||
next() { | ||
if (this.i > 5) | ||
return { value: this.i, done: true } | ||
return { value: this.i++, done: false } | ||
}, | ||
}; | ||
const result = Array.from(Iterator.prototype.chunks.call(iter, 2)); | ||
sameArray(result, [[1, 2], [3, 4], [5]]); | ||
} | ||
|
||
{ | ||
let nextGetCount = 0; | ||
class Iter extends Iterator { | ||
get next() { | ||
nextGetCount++; | ||
let i = 1; | ||
return function() { | ||
if (i > 5) | ||
return { value: i, done: true } | ||
return { value: i++, done: false } | ||
} | ||
}; | ||
}; | ||
const iter = new Iter(); | ||
sameValue(nextGetCount, 0); | ||
const result = Array.from(iter.chunks(3)); | ||
sameValue(nextGetCount, 1); | ||
sameArray(result, [[1, 2, 3], [4, 5]]); | ||
} | ||
|
||
{ | ||
function* gen() { | ||
yield 1; | ||
yield 2; | ||
yield 3; | ||
yield 4; | ||
yield 5; | ||
} | ||
const iter = gen(); | ||
const result = Array.from(iter.chunks(4)); | ||
sameArray(result, [[1, 2, 3, 4], [5]]); | ||
} | ||
|
||
{ | ||
const arr = [1, 2, 3, 4, 5]; | ||
const iter = arr[Symbol.iterator](); | ||
assert(iter.chunks === Iterator.prototype.chunks); | ||
const result = Array.from(iter.chunks(5)); | ||
sameArray(result, [[1, 2, 3, 4, 5]]); | ||
} | ||
|
||
{ | ||
const arr = [1, 2, 3, 4, 5]; | ||
const iter = arr[Symbol.iterator](); | ||
assert(iter.chunks === Iterator.prototype.chunks); | ||
const result = Array.from(iter.chunks(6)); | ||
sameArray(result, [[1, 2, 3, 4, 5]]); | ||
} | ||
|
||
{ | ||
const arr = [1, 2, 3, 4, 5]; | ||
const iter = arr[Symbol.iterator](); | ||
assert(iter.chunks === Iterator.prototype.chunks); | ||
const chunks = iter.chunks(2); | ||
const result1 = chunks.next().value; | ||
sameArray(result1, [1, 2]); | ||
result1.pop(); | ||
sameArray(result1, [1]); | ||
const result2 = chunks.next().value; | ||
sameArray(result2, [3, 4]); | ||
result2.pop(); | ||
sameArray(result2, [3]); | ||
assert(result1 !== result2); | ||
const result3 = chunks.next().value; | ||
sameArray(result3, [5]); | ||
result3.pop(); | ||
sameArray(result3, []); | ||
assert(result2 !== result3); | ||
assert(chunks.next().done); | ||
} | ||
|
||
{ | ||
const invalidIterators = [ | ||
1, | ||
1n, | ||
true, | ||
false, | ||
null, | ||
undefined, | ||
Symbol("symbol"), | ||
]; | ||
for (const invalidIterator of invalidIterators) { | ||
shouldThrow(function () { | ||
Iterator.prototype.chunks.call(invalidIterator); | ||
}, TypeError, "Iterator.prototype.chunks requires that |this| be an Object."); | ||
} | ||
} | ||
|
||
{ | ||
const invalidChunkSizes = [ | ||
undefined, | ||
"test", | ||
{}, | ||
]; | ||
const validIter = (function* gen() {})(); | ||
for (const invalidChunkSize of invalidChunkSizes) { | ||
shouldThrow(function () { | ||
Iterator.prototype.chunks.call(validIter, invalidChunkSize); | ||
}, RangeError, "Iterator.prototype.chunks requires that argument not be NaN."); | ||
} | ||
} | ||
|
||
{ | ||
const invalidChunkSizes = [ | ||
-1, | ||
0, | ||
2 ** 32, | ||
null, | ||
]; | ||
const validIter = (function* gen() {})(); | ||
for (const invalidChunkSize of invalidChunkSizes) { | ||
shouldThrow(function () { | ||
Iterator.prototype.chunks.call(validIter, invalidChunkSize); | ||
}, RangeError, "Iterator.prototype.chunks requires that argument be between 1 and 2**32 - 1."); | ||
} | ||
} |
Oops, something went wrong.