quickjs/tests/test262.patch

74 lines
2.3 KiB
Diff
Raw Permalink Normal View History

2020-09-07 00:53:08 +08:00
diff --git a/harness/atomicsHelper.js b/harness/atomicsHelper.js
2024-05-30 21:49:31 +08:00
index 9828b15..4a5919d 100644
2020-09-07 00:53:08 +08:00
--- a/harness/atomicsHelper.js
+++ b/harness/atomicsHelper.js
2024-05-30 21:49:31 +08:00
@@ -272,10 +272,14 @@ $262.agent.waitUntil = function(typedArray, index, expected) {
2020-09-07 00:53:08 +08:00
* }
*/
$262.agent.timeouts = {
- yield: 100,
- small: 200,
- long: 1000,
- huge: 10000,
+// yield: 100,
+// small: 200,
+// long: 1000,
+// huge: 10000,
+ yield: 20,
+ small: 20,
+ long: 100,
+ huge: 1000,
};
/**
diff --git a/harness/regExpUtils.js b/harness/regExpUtils.js
2024-05-30 21:49:31 +08:00
index b55f3c6..396bad4 100644
2020-09-07 00:53:08 +08:00
--- a/harness/regExpUtils.js
+++ b/harness/regExpUtils.js
2024-05-30 21:49:31 +08:00
@@ -6,27 +6,30 @@ description: |
defines: [buildString, testPropertyEscapes, testPropertyOfStrings, testExtendedCharacterClass, matchValidator]
2020-09-07 00:53:08 +08:00
---*/
2024-05-30 21:49:31 +08:00
2020-09-07 00:53:08 +08:00
+if ($262 && typeof $262.codePointRange === "function") {
+ /* use C function to build the codePointRange (much faster with
+ slow JS engines) */
+ codePointRange = $262.codePointRange;
+} else {
+ codePointRange = function codePointRange(start, end) {
+ const codePoints = [];
+ let length = 0;
+ for (codePoint = start; codePoint < end; codePoint++) {
+ codePoints[length++] = codePoint;
+ }
+ return String.fromCodePoint.apply(null, codePoints);
+ }
+}
+
2024-05-30 21:49:31 +08:00
function buildString(args) {
// Use member expressions rather than destructuring `args` for improved
// compatibility with engines that only implement assignment patterns
// partially or not at all.
const loneCodePoints = args.loneCodePoints;
const ranges = args.ranges;
2020-09-07 00:53:08 +08:00
- const CHUNK_SIZE = 10000;
- let result = Reflect.apply(String.fromCodePoint, null, loneCodePoints);
- for (let i = 0; i < ranges.length; i++) {
- const range = ranges[i];
- const start = range[0];
- const end = range[1];
- const codePoints = [];
- for (let length = 0, codePoint = start; codePoint <= end; codePoint++) {
- codePoints[length++] = codePoint;
- if (length === CHUNK_SIZE) {
- result += Reflect.apply(String.fromCodePoint, null, codePoints);
- codePoints.length = length = 0;
- }
2024-05-30 21:49:31 +08:00
- }
2020-09-07 00:53:08 +08:00
- result += Reflect.apply(String.fromCodePoint, null, codePoints);
2024-05-30 21:49:31 +08:00
+ let result = String.fromCodePoint.apply(null, loneCodePoints);
+ for (const [start, end] of ranges) {
+ result += codePointRange(start, end + 1);
}
return result;
2020-09-07 00:53:08 +08:00
}