Bug 1544792 - Abort on try-catch blocks when doing definite properties analysis. r=nbp
authorJan de Mooij <jdemooij@mozilla.com>
Thu, 02 May 2019 17:51:24 +0000
changeset 531257 80f03c3dd739ce09d18d06c31cc857ed56307e1f
parent 531256 3cc662da1cd8d2a81d91912844247b51ce949e69
child 531258 5d89b9ad06138d077fb6e2156f687b451c526050
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnbp
bugs1544792
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1544792 - Abort on try-catch blocks when doing definite properties analysis. r=nbp Ion does not compile the catch block so the analysis fails to account for code there. Differential Revision: https://phabricator.services.mozilla.com/D29475
js/src/jit-test/tests/ion/bug1544792.js
js/src/jit/IonBuilder.cpp
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/ion/bug1544792.js
@@ -0,0 +1,13 @@
+var res = undefined;
+function X() {
+    try {
+        foobar();
+    } catch (e) {
+        res = this.hasOwnProperty("prop");
+    }
+    this.prop = 1;
+}
+for (var i = 0; i < 50; i++) {
+    new X();
+    assertEq(res, false);
+}
--- a/js/src/jit/IonBuilder.cpp
+++ b/js/src/jit/IonBuilder.cpp
@@ -3199,21 +3199,20 @@ AbortReasonOr<Ok> IonBuilder::visitCondS
 
 AbortReasonOr<Ok> IonBuilder::visitTry(CFGTry* try_) {
   // We don't support try-finally. The ControlFlowGenerator should have
   // aborted compilation in this case.
 
   // Try-catch within inline frames is not yet supported.
   MOZ_ASSERT(!isInlineBuilder());
 
-  // Try-catch during the arguments usage analysis is not yet supported. Code
-  // accessing the arguments within the 'catch' block is not accounted for.
-  if (info().analysisMode() == Analysis_ArgumentsUsage) {
-    return abort(AbortReason::Disable,
-                 "Try-catch during arguments usage analysis");
+  // Try-catch during analyses is not yet supported. Code within the 'catch'
+  // block is not accounted for.
+  if (info().isAnalysis()) {
+    return abort(AbortReason::Disable, "Try-catch during analysis");
   }
 
   graph().setHasTryBlock();
 
   MBasicBlock* tryBlock;
   MOZ_TRY_VAR(tryBlock, newBlock(current, try_->tryBlock()->startPc()));
 
   blockWorklist[try_->tryBlock()->id()] = tryBlock;