Bug 1322093 part 10 - Add initInputLocation overloads for register types used by Ion. r=evilpie
authorJan de Mooij <jdemooij@mozilla.com>
Wed, 21 Dec 2016 17:37:48 +0100
changeset 452485 732bfa4cc97a919ea20fbb438cbb190fdb82b698
parent 452484 c845f579be3a952e01f3eb586529c174c086b4f0
child 452486 427341f59d73784a21b2206da54d66d0e9a59a1a
push id39415
push usermozilla@noorenberghe.ca
push dateWed, 21 Dec 2016 20:49:14 +0000
reviewersevilpie
bugs1322093
milestone53.0a1
Bug 1322093 part 10 - Add initInputLocation overloads for register types used by Ion. r=evilpie
js/src/jit/CacheIRCompiler.cpp
js/src/jit/CacheIRCompiler.h
--- a/js/src/jit/CacheIRCompiler.cpp
+++ b/js/src/jit/CacheIRCompiler.cpp
@@ -308,16 +308,36 @@ CacheRegisterAllocator::knownType(ValOpe
       case OperandLocation::Uninitialized:
         break;
     }
 
     MOZ_CRASH("Invalid kind");
 }
 
 void
+CacheRegisterAllocator::initInputLocation(size_t i, const TypedOrValueRegister& reg)
+{
+    if (reg.hasValue()) {
+        initInputLocation(i, reg.valueReg());
+    } else {
+        MOZ_ASSERT(!reg.typedReg().isFloat());
+        initInputLocation(i, reg.typedReg().gpr(), ValueTypeFromMIRType(reg.type()));
+    }
+}
+
+void
+CacheRegisterAllocator::initInputLocation(size_t i, const ConstantOrRegister& value)
+{
+    if (value.constant())
+        initInputLocation(i, value.value());
+    else
+        initInputLocation(i, value.reg());
+}
+
+void
 CacheRegisterAllocator::spillOperand(MacroAssembler& masm, OperandLocation* loc)
 {
     MOZ_ASSERT(loc >= operandLocations_.begin() && loc < operandLocations_.end());
 
     if (loc->kind() == OperandLocation::ValueReg) {
         stackPushed_ += sizeof(js::Value);
         masm.pushValue(loc->valueReg());
         loc->setValueStack(stackPushed_);
--- a/js/src/jit/CacheIRCompiler.h
+++ b/js/src/jit/CacheIRCompiler.h
@@ -190,18 +190,29 @@ class MOZ_RAII CacheRegisterAllocator
         operandLocations_[i] = loc;
     }
 
     OperandLocation origInputLocation(size_t i) const {
         return origInputLocations_[i];
     }
     void initInputLocation(size_t i, ValueOperand reg) {
         origInputLocations_[i].setValueReg(reg);
-        operandLocations_[i] = origInputLocations_[i];
+        operandLocations_[i].setValueReg(reg);
+    }
+    void initInputLocation(size_t i, Register reg, JSValueType type) {
+        origInputLocations_[i].setPayloadReg(reg, type);
+        operandLocations_[i].setPayloadReg(reg, type);
     }
+    void initInputLocation(size_t i, const Value& v) {
+        origInputLocations_[i].setConstant(v);
+        operandLocations_[i].setConstant(v);
+    }
+
+    void initInputLocation(size_t i, const TypedOrValueRegister& reg);
+    void initInputLocation(size_t i, const ConstantOrRegister& value);
 
     void nextOp() {
         currentOpRegs_.clear();
         currentInstruction_++;
     }
 
     uint32_t stackPushed() const {
         return stackPushed_;