forked from WebKit/WebKit
-
Notifications
You must be signed in to change notification settings - Fork 13
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'
- Loading branch information
Showing
3,454 changed files
with
138,039 additions
and
35,631 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
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() { | ||
var result = 0; | ||
var n = 10000000; | ||
let src = "foo bar BAZ1 23% 456q Uu X {Xyzz y78} 9 $$$0Abc"; | ||
for (let i = 0; i < n; ++i) { | ||
let re = /[A-Za-z0-9]{3,4}/g; | ||
while (re.test(src)) | ||
++result; | ||
} | ||
if (result != n * 7) /* Expect [foo, bar, BAZ1, 456q, Xyzz, y78, 0Abc] */ | ||
throw "Error: bad result: " + result; | ||
})(); |
12 changes: 12 additions & 0 deletions
12
JSTests/microbenchmarks/regexp-match-multiple-single-chars.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,12 @@ | ||
(function() { | ||
var result = 0; | ||
var n = 10000000; | ||
let src = "foo bar BAZ1 23% 456q Uu X {Xyzz y78} 9 $$$0Abc"; | ||
for (let i = 0; i < n; ++i) { | ||
let re = /[AaCeGgJjMmNnQqTtWwZz]/g; | ||
while (re.test(src)) | ||
++result; | ||
} | ||
if (result != n * 7) /* Expect [a, A, Z, q, z, z, A] */ | ||
throw "Error: bad result: " + result; | ||
})(); |
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,31 @@ | ||
(function() { | ||
var result = 0; | ||
var n = 1000000; | ||
let src = ` | ||
function cross(vec<float, 3> a, vec<float, 3> b) { | ||
vec<float, 3> result = { | ||
a.y * b.z - a.z * b.y, | ||
a.z * b.x - a.x * b.z, | ||
a.x * b.y - a.y * b.x | ||
}; | ||
return result; | ||
} | ||
function dot(vec<float, 3> a, vec<float, 3> b) { | ||
return a.x * b.x + a.y * b.y + a.z * b.z; | ||
} | ||
function test() { | ||
vec<float, 3> a = { 1, 2, 3 }; | ||
vec<float, 3> b = { 400, 500, 600 }; | ||
vec<float, 3> c = cross(a, b); | ||
assert(dot(a, c) == 0); | ||
assert(dot(b, c) == 0); | ||
} | ||
`; | ||
for (let i = 0; i < n; ++i) { | ||
let re = /[\(\)\{\}\[\]\<\>\,\.\;]/g; | ||
while (re.test(src)) | ||
++result; | ||
} | ||
if (result != n * 89) | ||
throw "Error: bad result: " + result; | ||
})(); |
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,48 @@ | ||
//@ requireOptions("--jitPolicyScale=0.001") | ||
|
||
function opt16() { | ||
const arr = new Int16Array([-1, 1]); | ||
if (Atomics.and(arr, 0, 0) !== -1) | ||
throw new Error(); | ||
|
||
if (Atomics.and(arr, 1, 0) !== 1) | ||
throw new Error(); | ||
} | ||
noInline(opt16); | ||
|
||
function optU16() { | ||
const arr = new Uint16Array([-1, 1]); | ||
if (Atomics.and(arr, 0, 0) !== 65535) | ||
throw new Error(); | ||
|
||
if (Atomics.and(arr, 1, 0) !== 1) | ||
throw new Error(); | ||
} | ||
noInline(optU16); | ||
|
||
function opt8() { | ||
const arr = new Int8Array([-1, 1]); | ||
if (Atomics.and(arr, 0, 0) !== -1) | ||
throw new Error(); | ||
|
||
if (Atomics.and(arr, 1, 0) !== 1) | ||
throw new Error(); | ||
} | ||
noInline(opt8); | ||
|
||
function optU8() { | ||
const arr = new Uint8Array([-1, 1]); | ||
if (Atomics.and(arr, 0, 0) !== 255) | ||
throw new Error(); | ||
|
||
if (Atomics.and(arr, 1, 0) !== 1) | ||
throw new Error(); | ||
} | ||
noInline(optU8); | ||
|
||
for (let i = 0; i < 1e3; i++) { | ||
opt16(); | ||
optU16(); | ||
opt8(); | ||
optU8(); | ||
} |
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,24 @@ | ||
//@ requireOptions("--useIteratorHelpers=1") | ||
|
||
function assert(a, b) { | ||
if (a !== b) | ||
throw new Error("Expected: " + b + " but got: " + a); | ||
} | ||
|
||
function assertThrows(expectedError, f) { | ||
try { | ||
f(); | ||
} catch (e) { | ||
assert(e instanceof expectedError, true); | ||
} | ||
} | ||
|
||
// https://tc39.es/proposal-iterator-helpers/#sec-iterator | ||
assertThrows(TypeError, function () { | ||
new Iterator(); | ||
}); | ||
|
||
// https://tc39.es/proposal-iterator-helpers/#sec-iterator | ||
class MyIterator extends Iterator {}; | ||
const myIterator = new MyIterator(); | ||
assert(myIterator instanceof Iterator, true); |
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 @@ | ||
//@ requireOptions("--useIteratorHelpers=1") | ||
|
||
function assert(a, b) { | ||
if (a !== b) | ||
throw new Error("Expected: " + b + " but got: " + a); | ||
} | ||
|
||
function assertThrows(expectedError, f) { | ||
try { | ||
f(); | ||
} catch (e) { | ||
assert(e instanceof expectedError, true); | ||
} | ||
} | ||
|
||
// see https://tc39.es/proposal-iterator-helpers/#sec-set-iteratorprototype-constructor | ||
assertThrows(TypeError, function () { | ||
Iterator.prototype.constructor = {}; | ||
}); |
19 changes: 19 additions & 0 deletions
19
JSTests/stress/iterator-prototype-to-string-tag-basic-setter.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,19 @@ | ||
//@ requireOptions("--useIteratorHelpers=1") | ||
|
||
function assert(a, b) { | ||
if (a !== b) | ||
throw new Error("Expected: " + b + " but got: " + a); | ||
} | ||
|
||
function assertThrows(expectedError, f) { | ||
try { | ||
f(); | ||
} catch (e) { | ||
assert(e instanceof expectedError, true); | ||
} | ||
} | ||
|
||
// see https://tc39.es/proposal-iterator-helpers/#sec-set-iteratorprototype-@@tostringtag | ||
assertThrows(TypeError, function () { | ||
Iterator.prototype[Symbol.toStringTag] = "foo"; | ||
}); |
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,80 @@ | ||
function testScopeRestorationAfterExceptionInTry() { | ||
try { | ||
{ | ||
let x = 1; | ||
var captureX = function() { print(x) }; | ||
throw new Error("foo"); | ||
} | ||
} catch { | ||
shouldBe(typeof x, "undefined"); | ||
} finally { | ||
x | ||
} | ||
} | ||
|
||
function testScopeRestorationAfterExceptionInTry2() { | ||
try { | ||
for (let x of [1, 2, 3]) { | ||
var captureX = function() { print(x) }; | ||
throw new Error("foo"); | ||
} | ||
} catch { | ||
shouldBe(typeof x, "undefined"); | ||
} finally { | ||
x | ||
} | ||
} | ||
|
||
function testScopeRestorationAfterExceptionInCatch() { | ||
try { | ||
throw new Error("foo"); | ||
} catch (error) { | ||
{ | ||
let x = 1; | ||
var captureX = function() { print(x) }; | ||
throw new Error("foo"); | ||
} | ||
} finally { | ||
shouldBe(typeof x, "undefined"); | ||
x | ||
} | ||
} | ||
|
||
function testScopeRestorationAfterExceptionInCatch2() { | ||
try { | ||
throw new Error("foo"); | ||
} catch { | ||
for (let x of [1, 2, 3]) { | ||
var captureX = function() { print(x) }; | ||
throw new Error("foo"); | ||
} | ||
} finally { | ||
shouldBe(typeof x, "undefined"); | ||
x | ||
} | ||
} | ||
|
||
function shouldBe(actual, expected) { | ||
if (actual !== expected) | ||
throw new Error(`Bad value: ${actual}!`); | ||
} | ||
|
||
function shouldThrow(func, expectedMessage) { | ||
let errorThrown = false; | ||
try { | ||
func(); | ||
} catch (error) { | ||
errorThrown = true; | ||
if (error.toString() !== expectedMessage) | ||
throw new Error(`Bad error: ${error}`); | ||
} | ||
if (!errorThrown) | ||
throw new Error(`Didn't throw!`); | ||
} | ||
|
||
for (var i = 0; i < 1e4; i++) { | ||
shouldThrow(testScopeRestorationAfterExceptionInTry, "ReferenceError: Can't find variable: x"); | ||
shouldThrow(testScopeRestorationAfterExceptionInTry2, "ReferenceError: Can't find variable: x"); | ||
shouldThrow(testScopeRestorationAfterExceptionInCatch, "ReferenceError: Can't find variable: x"); | ||
shouldThrow(testScopeRestorationAfterExceptionInCatch2, "ReferenceError: Can't find variable: x"); | ||
} |
33 changes: 33 additions & 0 deletions
33
JSTests/stress/runString-returns-globalThis-not-globalObject.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,33 @@ | ||
// This shouldn't crash. | ||
|
||
try { | ||
function F() { | ||
return runString(); | ||
} | ||
class C extends F { | ||
"undefined" = this; | ||
} | ||
new C(); | ||
} catch { } | ||
|
||
var custom = $vm.createCustomTestGetterSetter(); | ||
|
||
try { | ||
function F2() { | ||
return $vm.custom.customAccessorGlobalObject; | ||
} | ||
class C2 extends F2 { | ||
"undefined" = this; | ||
} | ||
new C2(); | ||
} catch { } | ||
|
||
try { | ||
function F3() { | ||
return $vm.custom.customValueGlobalObject; | ||
} | ||
class C3 extends F3 { | ||
"undefined" = this; | ||
} | ||
new C3(); | ||
} catch { } |
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,33 @@ | ||
function shouldBe(actual, expected) { | ||
if (actual !== expected) | ||
throw new Error('bad value: ' + actual); | ||
} | ||
(function () { | ||
if (!platformSupportsSamplingProfiler()) | ||
return; | ||
|
||
load("./sampling-profiler/samplingProfiler.js", "caller relative"); | ||
|
||
function test() { | ||
var res = 0; | ||
for (let i = 0; i < 1000; ++i) | ||
res += Math.tan(i); | ||
return res; | ||
} | ||
noInline(test); | ||
|
||
const timeToFail = 50000; | ||
let startTime = Date.now(); | ||
do { | ||
test(); | ||
let data = samplingProfilerStackTraces(); | ||
for (let trace of data.traces) { | ||
for (let frame of trace.frames) { | ||
if (frame.name === 'test' && (frame.line >= 11 && frame.line <= 16) && (frame.column >= 5 && frame.line <= 38)) | ||
return; | ||
} | ||
} | ||
} while (Date.now() - startTime < timeToFail); | ||
let stacktraces = samplingProfilerStackTraces(); | ||
throw new Error(`Bad stack trace ${JSON.stringify(stacktraces)}`); | ||
}()); |
Oops, something went wrong.