document various v8 bugs (#4808)
authorAlex Lam S.L <alexlamsl@gmail.com>
Sat, 20 Mar 2021 22:33:45 +0000 (22:33 +0000)
committerGitHub <noreply@github.com>
Sat, 20 Mar 2021 22:33:45 +0000 (06:33 +0800)
closes #4805

README.md
test/compress/classes.js
test/compress/loops.js
test/ufuzz/index.js

index b378a40..914eb56 100644 (file)
--- a/README.md
+++ b/README.md
@@ -1296,3 +1296,16 @@ To allow for better optimizations, the compiler makes various assumptions:
   // SyntaxError: Identifier 'e' has already been declared
   ```
   UglifyJS may modify the input which in turn may suppress those errors.
+- Some versions of Chrome and Node.js will give incorrect results with the
+  following:
+  ```javascript
+  console.log({
+      ...{
+          set 42(v) {},
+          42: "PASS",
+      },
+  });
+  // Expected: { '42': 'PASS' }
+  // Actual:   { '42': undefined }
+  ```
+  UglifyJS may modify the input which in turn may suppress those errors.
index 46749a2..7a9dfc5 100644 (file)
@@ -725,7 +725,7 @@ unused_await: {
             (() => console.log(await))();
         })();
     }
-    expect_stdout: "PASS"
+    expect_stdout: true
     node_version: ">=12"
 }
 
index b1128f1..5a66e02 100644 (file)
@@ -836,10 +836,7 @@ for_of: {
             console.log(async);
     }
     expect_exact: 'var async=["PASS",42];async.p="FAIL";for(async of(null,async))console.log(async);'
-    expect_stdout: [
-        "PASS",
-        "42",
-    ]
+    expect_stdout: true
     node_version: ">=0.12"
 }
 
index f7ad29a..d91fe04 100644 (file)
@@ -158,6 +158,9 @@ var SUPPORT = function(matrix) {
     template: "``",
     trailing_comma: "function f(a,) {}",
 });
+if (SUPPORT.exponentiation && sandbox.run_code("console.log(10 ** 100 === Math.pow(10, 100));") !== "true\n") {
+    SUPPORT.exponentiation = false;
+}
 
 var VALUES = [
     '"a"',
@@ -241,40 +244,13 @@ BINARY_OPS = BINARY_OPS.concat(BINARY_OPS);
 BINARY_OPS = BINARY_OPS.concat(BINARY_OPS);
 BINARY_OPS.push(" in ");
 
-var ASSIGNMENTS = [
-    "=",
-    "=",
-    "=",
-    "=",
-    "=",
-    "=",
-    "=",
-    "=",
-    "=",
-    "=",
-
-    "=",
-    "=",
-    "=",
-    "=",
-    "=",
-    "=",
-    "=",
-    "=",
-    "=",
-    "=",
-
-    "+=",
-    "+=",
-    "+=",
-    "+=",
-    "+=",
-    "+=",
-    "+=",
-    "+=",
-    "+=",
-    "+=",
-
+var ASSIGNMENTS = [ "=" ];
+ASSIGNMENTS = ASSIGNMENTS.concat(ASSIGNMENTS);
+ASSIGNMENTS.push("+=");
+ASSIGNMENTS = ASSIGNMENTS.concat(ASSIGNMENTS);
+ASSIGNMENTS = ASSIGNMENTS.concat(ASSIGNMENTS);
+ASSIGNMENTS = ASSIGNMENTS.concat(ASSIGNMENTS);
+ASSIGNMENTS = ASSIGNMENTS.concat([
     "-=",
     "*=",
     "/=",
@@ -285,8 +261,11 @@ var ASSIGNMENTS = [
     "<<=",
     ">>=",
     ">>>=",
-];
-if (SUPPORT.exponentiation) ASSIGNMENTS.push("**=");
+]);
+if (SUPPORT.exponentiation) {
+    ASSIGNMENTS = ASSIGNMENTS.concat(ASSIGNMENTS);
+    ASSIGNMENTS.push("**=");
+}
 
 var UNARY_SAFE = [
     "+",