quickjs-tart

quickjs-based runtime for wallet-core logic
Log | Files | Refs | README | LICENSE

test262.patch (2388B)


      1 diff --git a/harness/atomicsHelper.js b/harness/atomicsHelper.js
      2 index 9828b15..4a5919d 100644
      3 --- a/harness/atomicsHelper.js
      4 +++ b/harness/atomicsHelper.js
      5 @@ -272,10 +272,14 @@ $262.agent.waitUntil = function(typedArray, index, expected) {
      6   *   }
      7   */
      8  $262.agent.timeouts = {
      9 -  yield: 100,
     10 -  small: 200,
     11 -  long: 1000,
     12 -  huge: 10000,
     13 +//  yield: 100,
     14 +//  small: 200,
     15 +//  long: 1000,
     16 +//  huge: 10000,
     17 +  yield: 20,
     18 +  small: 20,
     19 +  long: 100,
     20 +  huge: 1000,
     21  };
     22  
     23  /**
     24 diff --git a/harness/regExpUtils.js b/harness/regExpUtils.js
     25 index b55f3c6..396bad4 100644
     26 --- a/harness/regExpUtils.js
     27 +++ b/harness/regExpUtils.js
     28 @@ -6,27 +6,30 @@ description: |
     29  defines: [buildString, testPropertyEscapes, testPropertyOfStrings, testExtendedCharacterClass, matchValidator]
     30  ---*/
     31  
     32 +if ($262 && typeof $262.codePointRange === "function") {
     33 +    /* use C function to build the codePointRange (much faster with
     34 +       slow JS engines) */
     35 +    codePointRange = $262.codePointRange;
     36 +} else {
     37 +    codePointRange = function codePointRange(start, end) {
     38 +        const codePoints = [];
     39 +        let length = 0;
     40 +        for (codePoint = start; codePoint < end; codePoint++) {
     41 +            codePoints[length++] = codePoint;
     42 +        }
     43 +        return String.fromCodePoint.apply(null, codePoints);
     44 +    }
     45 +}
     46 +
     47  function buildString(args) {
     48    // Use member expressions rather than destructuring `args` for improved
     49    // compatibility with engines that only implement assignment patterns
     50    // partially or not at all.
     51    const loneCodePoints = args.loneCodePoints;
     52    const ranges = args.ranges;
     53 -  const CHUNK_SIZE = 10000;
     54 -  let result = Reflect.apply(String.fromCodePoint, null, loneCodePoints);
     55 -  for (let i = 0; i < ranges.length; i++) {
     56 -    const range = ranges[i];
     57 -    const start = range[0];
     58 -    const end = range[1];
     59 -    const codePoints = [];
     60 -    for (let length = 0, codePoint = start; codePoint <= end; codePoint++) {
     61 -      codePoints[length++] = codePoint;
     62 -      if (length === CHUNK_SIZE) {
     63 -        result += Reflect.apply(String.fromCodePoint, null, codePoints);
     64 -        codePoints.length = length = 0;
     65 -      }
     66 -    }
     67 -    result += Reflect.apply(String.fromCodePoint, null, codePoints);
     68 +  let result = String.fromCodePoint.apply(null, loneCodePoints);
     69 +  for (const [start, end] of ranges) {
     70 +    result += codePointRange(start, end + 1);
     71    }
     72    return result;
     73  }