Bug 1629867 - Allow passing multiple inputs to buildCacheIR. r=jandem
authorTom Schuster <evilpies@gmail.com>
Wed, 15 Apr 2020 15:35:43 +0000
changeset 524189 ce3f84d94d4d7820b150ed961aa82f0b56176bd9
parent 524188 fd542e917c8554780c2ebfada6719ded022fb817
child 524190 8f3a2cbbb952c9503fac159eaf12c0da951287ca
push id113041
push userevilpies@gmail.com
push dateWed, 15 Apr 2020 15:59:25 +0000
treeherderautoland@706e0a08e6fa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem
bugs1629867
milestone77.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 1629867 - Allow passing multiple inputs to buildCacheIR. r=jandem Differential Revision: https://phabricator.services.mozilla.com/D70857
js/src/jit/WarpBuilder.cpp
js/src/jit/WarpBuilder.h
js/src/jit/WarpCacheIRTranspiler.cpp
--- a/js/src/jit/WarpBuilder.cpp
+++ b/js/src/jit/WarpBuilder.cpp
@@ -1744,17 +1744,17 @@ bool WarpBuilder::build_GlobalThis(Bytec
 
 MConstant* WarpBuilder::globalLexicalEnvConstant() {
   JSObject* globalLexical = snapshot_.globalLexicalEnv();
   return constant(ObjectValue(*globalLexical));
 }
 
 bool WarpBuilder::buildGetNameOp(BytecodeLocation loc, MDefinition* env) {
   if (auto* snapshot = getOpSnapshot<WarpCacheIR>(loc)) {
-    return buildCacheIR(loc, snapshot, env);
+    return buildCacheIR(loc, snapshot, {env});
   }
 
   MGetNameCache* ins = MGetNameCache::New(alloc(), env);
   current->add(ins);
   current->push(ins);
   return resumeAfter(ins, loc);
 }
 
@@ -1818,17 +1818,17 @@ bool WarpBuilder::buildGetPropOp(Bytecod
   return resumeAfter(ins, loc);
 }
 
 bool WarpBuilder::build_GetProp(BytecodeLocation loc) {
   PropertyName* name = loc.getPropertyName(script_);
   MDefinition* val = current->pop();
 
   if (auto* snapshot = getOpSnapshot<WarpCacheIR>(loc)) {
-    return buildCacheIR(loc, snapshot, val);
+    return buildCacheIR(loc, snapshot, {val});
   }
 
   MConstant* id = constant(StringValue(name));
   return buildGetPropOp(loc, val, id);
 }
 
 bool WarpBuilder::build_CallProp(BytecodeLocation loc) {
   return build_GetProp(loc);
@@ -2787,22 +2787,24 @@ bool WarpBuilder::build_ThrowSetConst(By
   // Terminate the block.
   current->end(MUnreachable::New(alloc()));
   setTerminatedBlock();
   return true;
 }
 
 bool WarpBuilder::buildCacheIR(BytecodeLocation loc,
                                const WarpCacheIR* snapshot,
-                               MDefinition* input) {
-  MDefinitionStackVector inputs;
-  MOZ_ALWAYS_TRUE(inputs.append(input));  // Can't fail due to inline capacity.
+                               std::initializer_list<MDefinition*> inputs) {
+  MDefinitionStackVector inputs_;
+  if (!inputs_.append(inputs.begin(), inputs.end())) {
+    return false;
+  }
 
   TranspilerOutput output;
-  if (!TranspileCacheIRToMIR(mirGen_, current, snapshot, inputs, output)) {
+  if (!TranspileCacheIRToMIR(mirGen_, current, snapshot, inputs_, output)) {
     return false;
   }
 
   if (output.result) {
     current->push(output.result);
   }
 
   return true;
--- a/js/src/jit/WarpBuilder.h
+++ b/js/src/jit/WarpBuilder.h
@@ -2,16 +2,18 @@
  * vim: set ts=8 sts=2 et sw=2 tw=80:
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef jit_WarpBuilder_h
 #define jit_WarpBuilder_h
 
+#include <initializer_list>
+
 #include "jit/JitContext.h"
 #include "jit/MIR.h"
 #include "jit/MIRBuilderShared.h"
 #include "jit/WarpSnapshot.h"
 #include "vm/Opcodes.h"
 
 namespace js {
 namespace jit {
@@ -137,17 +139,17 @@ class MOZ_STACK_CLASS WarpBuilder {
   void pushConstant(const Value& v);
 
   MOZ_MUST_USE bool buildPrologue();
   MOZ_MUST_USE bool buildBody();
   MOZ_MUST_USE bool buildEpilogue();
 
   MOZ_MUST_USE bool buildCacheIR(BytecodeLocation loc,
                                  const WarpCacheIR* snapshot,
-                                 MDefinition* input);
+                                 std::initializer_list<MDefinition*> inputs);
 
   MOZ_MUST_USE bool buildEnvironmentChain();
   MInstruction* buildNamedLambdaEnv(MDefinition* callee, MDefinition* env,
                                     LexicalEnvironmentObject* templateObj);
   MInstruction* buildCallObject(MDefinition* callee, MDefinition* env,
                                 CallObject* templateObj);
   MInstruction* buildLoadSlot(MDefinition* obj, uint32_t numFixedSlots,
                               uint32_t slot);
--- a/js/src/jit/WarpCacheIRTranspiler.cpp
+++ b/js/src/jit/WarpCacheIRTranspiler.cpp
@@ -273,14 +273,10 @@ bool WarpCacheIRTranspiler::transpile_Re
   return true;
 }
 
 bool jit::TranspileCacheIRToMIR(MIRGenerator& mirGen, MBasicBlock* current,
                                 const WarpCacheIR* snapshot,
                                 const MDefinitionStackVector& inputs,
                                 TranspilerOutput& output) {
   WarpCacheIRTranspiler transpiler(mirGen, current, snapshot, output);
-  if (!transpiler.transpile(inputs)) {
-    return false;
-  }
-
-  return true;
+  return transpiler.transpile(inputs);
 }