Merge inbound to mozilla-central. a=merge
authorOana Pop Rus <opoprus@mozilla.com>
Mon, 18 Mar 2019 11:53:46 +0200
changeset 522623 9421b477d67c
parent 522622 58a76dfcf9d8 (current diff)
parent 522619 568561a463a7 (diff)
child 522624 2f6d5b78fa25
push id10871
push usercbrindusan@mozilla.com
push dateMon, 18 Mar 2019 15:49:32 +0000
treeherdermozilla-beta@018abdd16060 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmerge
milestone67.0a1
first release with
nightly linux32
9421b477d67c / 67.0a1 / 20190318095354 / files
nightly linux64
9421b477d67c / 67.0a1 / 20190318095354 / files
nightly mac
9421b477d67c / 67.0a1 / 20190318095354 / files
nightly win32
9421b477d67c / 67.0a1 / 20190318095354 / files
nightly win64
9421b477d67c / 67.0a1 / 20190318095354 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Merge inbound to mozilla-central. a=merge
js/src/jit-test/tests/ion/spreadcall-not-optimized-dynamic-2.js
js/src/jit-test/tests/ion/spreadcall-not-optimized-static-2.js
--- a/browser/base/content/browser.css
+++ b/browser/base/content/browser.css
@@ -712,23 +712,21 @@ html|input.urlbar-input {
 #urlbar[actionoverride] > #urlbar-display-box,
 #urlbar:not([actiontype="switchtab"]):not([actiontype="extension"]) > #urlbar-display-box,
 #urlbar:not([actiontype="switchtab"]) > #urlbar-display-box > #switchtab,
 #urlbar:not([actiontype="extension"]) > #urlbar-display-box > #extension {
   display: none;
 }
 
 #PopupAutoComplete > richlistbox > richlistitem[originaltype="loginsFooter"] {
+  -moz-box-pack: center;
   color: var(--btn-text-color);
   min-height: 40px;
   border-top: 1px solid rgba(38,38,38,.15);
   background-color: #EDEDED;
-  display: flex;
-  justify-content: center;
-  align-items: center;
 }
 
 #PopupAutoComplete > richlistbox > richlistitem[originaltype="loginsFooter"]:hover,
 #PopupAutoComplete > richlistbox > richlistitem[originaltype="loginsFooter"][selected] {
   background-color: #DCDCDE;
 }
 
 #PopupAutoComplete[firstresultstyle="insecureWarning"] {
rename from js/src/jit-test/tests/ion/spreadcall-not-optimized-dynamic-2.js
rename to js/src/jit-test/tests/ion/spreadcall-not-optimized-dynamic-2a.js
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/ion/spreadcall-not-optimized-dynamic-2b.js
@@ -0,0 +1,37 @@
+// Tests when JSOP_OPTIMIZE_SPREADCALL no longer apply after the initial Ion
+// compilation.
+
+// JSOP_OPTIMIZE_SPREADCALL can be optimised when the following conditions
+// are fulfilled:
+//   (1) the argument is an array
+//   (2) the array has no hole
+//   (3) array[@@iterator] is not modified
+//   (4) the array's prototype is Array.prototype
+//   (5) Array.prototype[@@iterator] is not modified
+//   (6) %ArrayIteratorPrototype%.next is not modified
+
+function add(a, b, c = 0, d = 0) {
+    return a + b + c + d;
+}
+
+// The rest argument is a packed array.
+function test() {
+    function maybeInvalidate(rest) {
+        // Use a WithStatement to prevent Ion-inlining. This ensures any
+        // bailouts due to type changes don't occur in this function, but
+        // instead in the caller.
+        with ({});
+
+        if (i >= 1900) {
+            rest.length = 3;
+        }
+    }
+    function fn(...rest) {
+        maybeInvalidate(rest);
+        return add(...rest);
+    }
+    for (var i = 0; i < 4000; ++i) {
+        assertEq(fn(1, 2), 3);
+    }
+}
+test();
rename from js/src/jit-test/tests/ion/spreadcall-not-optimized-static-2.js
rename to js/src/jit-test/tests/ion/spreadcall-not-optimized-static-2a.js
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/ion/spreadcall-not-optimized-static-2b.js
@@ -0,0 +1,27 @@
+// Tests when JSOP_OPTIMIZE_SPREADCALL can't be applied during the initial
+// Ion compilation.
+
+// JSOP_OPTIMIZE_SPREADCALL can be optimised when the following conditions
+// are fulfilled:
+//   (1) the argument is an array
+//   (2) the array has no hole
+//   (3) array[@@iterator] is not modified
+//   (4) the array's prototype is Array.prototype
+//   (5) Array.prototype[@@iterator] is not modified
+//   (6) %ArrayIteratorPrototype%.next is not modified
+
+function add(a, b, c = 0, d = 0) {
+    return a + b + c + d;
+}
+
+// The rest argument is a packed array.
+function test() {
+    function fn(...rest) {
+        rest.length = 3;
+        return add(...rest);
+    }
+    for (var i = 0; i < 2000; ++i) {
+        assertEq(fn(1, 2), 3);
+    }
+}
+test();
--- a/js/src/jit/IonBuilder.cpp
+++ b/js/src/jit/IonBuilder.cpp
@@ -5676,17 +5676,17 @@ bool IonBuilder::ensureArrayIteratorProt
 AbortReasonOr<Ok> IonBuilder::jsop_optimize_spreadcall() {
   MDefinition* arr = current->peek(-1);
   arr->setImplicitlyUsedUnchecked();
 
   // Assuming optimization isn't available doesn't affect correctness.
   // TODO: Investigate dynamic checks.
   bool result = false;
   do {
-    // Inline with a constant if the conditions described in
+    // Inline with MIsPackedArray if the conditions described in
     // js::OptimizeSpreadCall() are all met or can be expressed through
     // compiler constraints.
 
     // The argument is an array.
     TemporaryTypeSet* types = arr->resultTypeSet();
     if (!types || types->getKnownClass(constraints()) != &ArrayObject::class_) {
       break;
     }
@@ -5722,17 +5722,23 @@ AbortReasonOr<Ok> IonBuilder::jsop_optim
     // %ArrayIteratorPrototype%.next is not modified.
     if (!ensureArrayIteratorPrototypeNextNotModified()) {
       break;
     }
 
     result = true;
   } while (false);
 
-  pushConstant(BooleanValue(result));
+  if (result) {
+    auto* ins = MIsPackedArray::New(alloc(), arr);
+    current->add(ins);
+    current->push(ins);
+  } else {
+    pushConstant(BooleanValue(false));
+  }
   return Ok();
 }
 
 AbortReasonOr<Ok> IonBuilder::jsop_funapplyarray(uint32_t argc) {
   MOZ_ASSERT(argc == 2);
 
   int funcDepth = -((int)argc + 1);