summaryrefslogtreecommitdiff
path: root/tests/test262.patch
blob: 3047751d923a82fd0792c47a0d4f9983fba6c32b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
diff --git a/harness/atomicsHelper.js b/harness/atomicsHelper.js
index 9828b15..4a5919d 100644
--- a/harness/atomicsHelper.js
+++ b/harness/atomicsHelper.js
@@ -272,10 +272,14 @@ $262.agent.waitUntil = function(typedArray, index, expected) {
  *   }
  */
 $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
index b397be0..c197ddc 100644
--- a/harness/regExpUtils.js
+++ b/harness/regExpUtils.js
@@ -6,27 +6,30 @@ description: |
 defines: [buildString, testPropertyEscapes, testPropertyOfStrings, testExtendedCharacterClass, matchValidator]
 ---*/
 
+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);
+    }
+}
+
 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;
-  const CHUNK_SIZE = 10000;
   let result = String.fromCodePoint.apply(null, loneCodePoints);
-  for (let i = 0; i < ranges.length; i++) {
-    let range = ranges[i];
-    let start = range[0];
-    let end = range[1];
-    let codePoints = [];
-    for (let length = 0, codePoint = start; codePoint <= end; codePoint++) {
-      codePoints[length++] = codePoint;
-      if (length === CHUNK_SIZE) {
-        result += String.fromCodePoint.apply(null, codePoints);
-        codePoints.length = length = 0;
-      }
-    }
-    result += String.fromCodePoint.apply(null, codePoints);
+  for (const [start, end] of ranges) {
+    result += codePointRange(start, end + 1);
   }
   return result;
 }
diff --git a/harness/sm/non262.js b/harness/sm/non262.js
index c1829e3..3a3ee27 100644
--- a/harness/sm/non262.js
+++ b/harness/sm/non262.js
@@ -41,8 +41,6 @@ globalThis.createNewGlobal = function() {
   return $262.createRealm().global
 }
 
-function print(...args) {
-}
 function assertEq(...args) {
   assert.sameValue(...args)
 }
@@ -71,4 +69,4 @@ if (globalThis.createExternalArrayBuffer === undefined) {
 if (globalThis.enableGeckoProfilingWithSlowAssertions === undefined) {
   globalThis.enableGeckoProfilingWithSlowAssertions = globalThis.enableGeckoProfiling =
     globalThis.disableGeckoProfiling = () => {}
-}
\ No newline at end of file
+}