Bug 1483275 - Remove duplicate VMFunction definitions. r=jandem
authorTed Campbell <tcampbell@mozilla.com>
Tue, 14 Aug 2018 10:40:53 -0400
changeset 486786 c13d9e177361e3968314503b474ef0479d004d8a
parent 486785 cf5e7017ffdc1ebc32f564f95de1ca91bf7a5795
child 486787 a5f5d094aa197489311b13aeed5c67e8c74b1cf8
push id9719
push userffxbld-merge
push dateFri, 24 Aug 2018 17:49:46 +0000
treeherdermozilla-beta@719ec98fba77 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem
bugs1483275
milestone63.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 1483275 - Remove duplicate VMFunction definitions. r=jandem MozReview-Commit-ID: 6Jyq1sfaWjV
js/src/jit/BaselineCacheIRCompiler.cpp
js/src/jit/CodeGenerator.cpp
js/src/jit/IonCacheIRCompiler.cpp
js/src/jit/VMFunctions.cpp
js/src/jit/VMFunctions.h
--- a/js/src/jit/BaselineCacheIRCompiler.cpp
+++ b/js/src/jit/BaselineCacheIRCompiler.cpp
@@ -646,20 +646,16 @@ BaselineCacheIRCompiler::emitCallNativeG
 
     if (!callVM(masm, CallNativeGetterInfo))
         return false;
 
     stubFrame.leave(masm);
     return true;
 }
 
-typedef bool (*ProxyGetPropertyFn)(JSContext*, HandleObject, HandleId, MutableHandleValue);
-static const VMFunction ProxyGetPropertyInfo =
-    FunctionInfo<ProxyGetPropertyFn>(ProxyGetProperty, "ProxyGetProperty");
-
 bool
 BaselineCacheIRCompiler::emitCallProxyGetResult()
 {
     Register obj = allocator.useRegister(masm, reader.objOperandId());
     Address idAddr(stubAddress(reader.stubOffset()));
 
     AutoScratchRegister scratch(allocator, masm);
 
@@ -676,20 +672,16 @@ BaselineCacheIRCompiler::emitCallProxyGe
 
     if (!callVM(masm, ProxyGetPropertyInfo))
         return false;
 
     stubFrame.leave(masm);
     return true;
 }
 
-typedef bool (*ProxyGetPropertyByValueFn)(JSContext*, HandleObject, HandleValue, MutableHandleValue);
-static const VMFunction ProxyGetPropertyByValueInfo =
-    FunctionInfo<ProxyGetPropertyByValueFn>(ProxyGetPropertyByValue, "ProxyGetPropertyByValue");
-
 bool
 BaselineCacheIRCompiler::emitCallProxyGetByValueResult()
 {
     Register obj = allocator.useRegister(masm, reader.objOperandId());
     ValueOperand idVal = allocator.useValueRegister(masm, reader.valOperandId());
 
     AutoScratchRegister scratch(allocator, masm);
 
@@ -703,22 +695,16 @@ BaselineCacheIRCompiler::emitCallProxyGe
 
     if (!callVM(masm, ProxyGetPropertyByValueInfo))
         return false;
 
     stubFrame.leave(masm);
     return true;
 }
 
-typedef bool (*ProxyHasFn)(JSContext*, HandleObject, HandleValue, MutableHandleValue);
-static const VMFunction ProxyHasInfo = FunctionInfo<ProxyHasFn>(ProxyHas, "ProxyHas");
-
-typedef bool (*ProxyHasOwnFn)(JSContext*, HandleObject, HandleValue, MutableHandleValue);
-static const VMFunction ProxyHasOwnInfo = FunctionInfo<ProxyHasOwnFn>(ProxyHasOwn, "ProxyHasOwn");
-
 bool
 BaselineCacheIRCompiler::emitCallProxyHasPropResult()
 {
     Register obj = allocator.useRegister(masm, reader.objOperandId());
     ValueOperand idVal = allocator.useValueRegister(masm, reader.valOperandId());
     bool hasOwn = reader.readBool();
 
     AutoScratchRegister scratch(allocator, masm);
@@ -893,21 +879,16 @@ BaselineCacheIRCompiler::emitLoadStringR
     AutoOutputRegister output(*this);
     AutoScratchRegisterMaybeOutput scratch(allocator, masm, output);
 
     masm.loadPtr(stubAddress(reader.stubOffset()), scratch);
     masm.tagValue(JSVAL_TYPE_STRING, scratch, output.valueReg());
     return true;
 }
 
-typedef bool (*StringSplitHelperFn)(JSContext*, HandleString, HandleString, HandleObjectGroup,
-                              uint32_t limit, MutableHandleValue);
-static const VMFunction StringSplitHelperInfo =
-    FunctionInfo<StringSplitHelperFn>(StringSplitHelper, "StringSplitHelper");
-
 bool
 BaselineCacheIRCompiler::emitCallStringSplitResult()
 {
     Register str = allocator.useRegister(masm, reader.stringOperandId());
     Register sep = allocator.useRegister(masm, reader.stringOperandId());
     Address groupAddr(stubAddress(reader.stubOffset()));
 
     AutoScratchRegister scratch(allocator, masm);
@@ -1790,20 +1771,16 @@ BaselineCacheIRCompiler::emitCallScripte
     stubFrame.leave(masm, true);
 
     if (isCrossRealm)
         masm.switchToBaselineFrameRealm(R1.scratchReg());
 
     return true;
 }
 
-typedef bool (*SetArrayLengthFn)(JSContext*, HandleObject, HandleValue, bool);
-static const VMFunction SetArrayLengthInfo =
-    FunctionInfo<SetArrayLengthFn>(SetArrayLength, "SetArrayLength");
-
 bool
 BaselineCacheIRCompiler::emitCallSetArrayLength()
 {
     Register obj = allocator.useRegister(masm, reader.objOperandId());
     bool strict = reader.readBool();
     ValueOperand val = allocator.useValueRegister(masm, reader.valOperandId());
 
     AutoScratchRegister scratch(allocator, masm);
@@ -1819,20 +1796,16 @@ BaselineCacheIRCompiler::emitCallSetArra
 
     if (!callVM(masm, SetArrayLengthInfo))
         return false;
 
     stubFrame.leave(masm);
     return true;
 }
 
-typedef bool (*ProxySetPropertyFn)(JSContext*, HandleObject, HandleId, HandleValue, bool);
-static const VMFunction ProxySetPropertyInfo =
-    FunctionInfo<ProxySetPropertyFn>(ProxySetProperty, "ProxySetProperty");
-
 bool
 BaselineCacheIRCompiler::emitCallProxySet()
 {
     Register obj = allocator.useRegister(masm, reader.objOperandId());
     ValueOperand val = allocator.useValueRegister(masm, reader.valOperandId());
     Address idAddr(stubAddress(reader.stubOffset()));
     bool strict = reader.readBool();
 
@@ -1853,20 +1826,16 @@ BaselineCacheIRCompiler::emitCallProxySe
 
     if (!callVM(masm, ProxySetPropertyInfo))
         return false;
 
     stubFrame.leave(masm);
     return true;
 }
 
-typedef bool (*ProxySetPropertyByValueFn)(JSContext*, HandleObject, HandleValue, HandleValue, bool);
-static const VMFunction ProxySetPropertyByValueInfo =
-    FunctionInfo<ProxySetPropertyByValueFn>(ProxySetPropertyByValue, "ProxySetPropertyByValue");
-
 bool
 BaselineCacheIRCompiler::emitCallProxySetByValue()
 {
     Register obj = allocator.useRegister(masm, reader.objOperandId());
     ValueOperand idVal = allocator.useValueRegister(masm, reader.valOperandId());
     ValueOperand val = allocator.useValueRegister(masm, reader.valOperandId());
     bool strict = reader.readBool();
 
@@ -2379,20 +2348,16 @@ ICCacheIR_Updated::Clone(JSContext* cx, 
     ICCacheIR_Updated* res = new(newStub) ICCacheIR_Updated(other.jitCode(), stubInfo);
     res->updateStubGroup() = other.updateStubGroup();
     res->updateStubId() = other.updateStubId();
 
     stubInfo->copyStubData(&other, res);
     return res;
 }
 
-typedef JSString* (*ConcatStringsFn)(JSContext*, HandleString, HandleString);
-static const VMFunction ConcatStringsInfo =
-    FunctionInfo<ConcatStringsFn>(ConcatStrings<CanGC>, "ConcatStrings", NonTailCall);
-
 bool
 BaselineCacheIRCompiler::emitCallStringConcatResult()
 {
     AutoOutputRegister output(*this);
     Register lhs = allocator.useRegister(masm, reader.stringOperandId());
     Register rhs = allocator.useRegister(masm, reader.stringOperandId());
     AutoScratchRegisterMaybeOutput scratch(allocator, masm, output);
 
--- a/js/src/jit/CodeGenerator.cpp
+++ b/js/src/jit/CodeGenerator.cpp
@@ -8367,20 +8367,16 @@ static const VMFunction SameValueInfo = 
 void
 CodeGenerator::visitSameValueVM(LSameValueVM* lir)
 {
     pushArg(ToValue(lir, LSameValueVM::RhsInput));
     pushArg(ToValue(lir, LSameValueVM::LhsInput));
     callVM(SameValueInfo, lir);
 }
 
-typedef JSString* (*ConcatStringsFn)(JSContext*, HandleString, HandleString);
-static const VMFunction ConcatStringsInfo =
-    FunctionInfo<ConcatStringsFn>(ConcatStrings<CanGC>, "ConcatStrings");
-
 void
 CodeGenerator::emitConcat(LInstruction* lir, Register lhs, Register rhs, Register output)
 {
     OutOfLineCode* ool = oolCallVM(ConcatStringsInfo, lir, ArgList(lhs, rhs),
                                    StoreRegisterTo(output));
 
     const JitRealm* jitRealm = gen->realm->jitRealm();
     JitCode* stringConcatStub = jitRealm->stringConcatStubNoBarrier(&realmStubsToReadBarrier_);
--- a/js/src/jit/IonCacheIRCompiler.cpp
+++ b/js/src/jit/IonCacheIRCompiler.cpp
@@ -1150,20 +1150,16 @@ IonCacheIRCompiler::emitCallProxyGetResu
     if (JitOptions.spectreJitToCxxCalls)
         masm.speculationBarrier();
 
     // masm.leaveExitFrame & pop locals
     masm.adjustStack(IonOOLProxyExitFrameLayout::Size());
     return true;
 }
 
-typedef bool (*ProxyGetPropertyByValueFn)(JSContext*, HandleObject, HandleValue, MutableHandleValue);
-static const VMFunction ProxyGetPropertyByValueInfo =
-    FunctionInfo<ProxyGetPropertyByValueFn>(ProxyGetPropertyByValue, "ProxyGetPropertyByValue");
-
 bool
 IonCacheIRCompiler::emitCallProxyGetByValueResult()
 {
     AutoSaveLiveRegisters save(*this);
     AutoOutputRegister output(*this);
 
     Register obj = allocator.useRegister(masm, reader.objOperandId());
     ValueOperand idVal = allocator.useValueRegister(masm, reader.valOperandId());
@@ -1177,22 +1173,16 @@ IonCacheIRCompiler::emitCallProxyGetByVa
 
     if (!callVM(masm, ProxyGetPropertyByValueInfo))
         return false;
 
     masm.storeCallResultValue(output);
     return true;
 }
 
-typedef bool (*ProxyHasFn)(JSContext*, HandleObject, HandleValue, MutableHandleValue);
-static const VMFunction ProxyHasInfo = FunctionInfo<ProxyHasFn>(ProxyHas, "ProxyHas");
-
-typedef bool (*ProxyHasOwnFn)(JSContext*, HandleObject, HandleValue, MutableHandleValue);
-static const VMFunction ProxyHasOwnInfo = FunctionInfo<ProxyHasOwnFn>(ProxyHasOwn, "ProxyHasOwn");
-
 bool
 IonCacheIRCompiler::emitCallProxyHasPropResult()
 {
     AutoSaveLiveRegisters save(*this);
     AutoOutputRegister output(*this);
 
     Register obj = allocator.useRegister(masm, reader.objOperandId());
     ValueOperand idVal = allocator.useValueRegister(masm, reader.valOperandId());
@@ -1298,21 +1288,16 @@ IonCacheIRCompiler::emitLoadEnvironmentD
 
 
 bool
 IonCacheIRCompiler::emitLoadStringResult()
 {
     MOZ_CRASH("not used in ion");
 }
 
-typedef bool (*StringSplitHelperFn)(JSContext*, HandleString, HandleString, HandleObjectGroup,
-                              uint32_t limit, MutableHandleValue);
-static const VMFunction StringSplitHelperInfo =
-    FunctionInfo<StringSplitHelperFn>(StringSplitHelper, "StringSplitHelper");
-
 bool
 IonCacheIRCompiler::emitCallStringSplitResult()
 {
     AutoSaveLiveRegisters save(*this);
     AutoOutputRegister output(*this);
 
     Register str = allocator.useRegister(masm, reader.stringOperandId());
     Register sep = allocator.useRegister(masm, reader.stringOperandId());
@@ -2165,20 +2150,16 @@ IonCacheIRCompiler::emitCallScriptedSett
 
     if (isCrossRealm)
         masm.switchToRealm(cx_->realm(), ReturnReg);
 
     masm.freeStack(masm.framePushed() - framePushedBefore);
     return true;
 }
 
-typedef bool (*SetArrayLengthFn)(JSContext*, HandleObject, HandleValue, bool);
-static const VMFunction SetArrayLengthInfo =
-    FunctionInfo<SetArrayLengthFn>(SetArrayLength, "SetArrayLength");
-
 bool
 IonCacheIRCompiler::emitCallSetArrayLength()
 {
     AutoSaveLiveRegisters save(*this);
 
     Register obj = allocator.useRegister(masm, reader.objOperandId());
     bool strict = reader.readBool();
     ConstantOrRegister val = allocator.useConstantOrRegister(masm, reader.valOperandId());
@@ -2188,20 +2169,16 @@ IonCacheIRCompiler::emitCallSetArrayLeng
 
     masm.Push(Imm32(strict));
     masm.Push(val);
     masm.Push(obj);
 
     return callVM(masm, SetArrayLengthInfo);
 }
 
-typedef bool (*ProxySetPropertyFn)(JSContext*, HandleObject, HandleId, HandleValue, bool);
-static const VMFunction ProxySetPropertyInfo =
-    FunctionInfo<ProxySetPropertyFn>(ProxySetProperty, "ProxySetProperty");
-
 bool
 IonCacheIRCompiler::emitCallProxySet()
 {
     AutoSaveLiveRegisters save(*this);
 
     Register obj = allocator.useRegister(masm, reader.objOperandId());
     ConstantOrRegister val = allocator.useConstantOrRegister(masm, reader.valOperandId());
     jsid id = idStubField(reader.stubOffset());
@@ -2215,20 +2192,16 @@ IonCacheIRCompiler::emitCallProxySet()
     masm.Push(Imm32(strict));
     masm.Push(val);
     masm.Push(id, scratch);
     masm.Push(obj);
 
     return callVM(masm, ProxySetPropertyInfo);
 }
 
-typedef bool (*ProxySetPropertyByValueFn)(JSContext*, HandleObject, HandleValue, HandleValue, bool);
-static const VMFunction ProxySetPropertyByValueInfo =
-    FunctionInfo<ProxySetPropertyByValueFn>(ProxySetPropertyByValue, "ProxySetPropertyByValue");
-
 bool
 IonCacheIRCompiler::emitCallProxySetByValue()
 {
     AutoSaveLiveRegisters save(*this);
 
     Register obj = allocator.useRegister(masm, reader.objOperandId());
     ConstantOrRegister idVal = allocator.useConstantOrRegister(masm, reader.valOperandId());
     ConstantOrRegister val = allocator.useConstantOrRegister(masm, reader.valOperandId());
@@ -2508,20 +2481,16 @@ IonIC::attachCacheIRStub(JSContext* cx, 
     JitCode* code = compiler.compile();
     if (!code)
         return;
 
     attachStub(newStub, code);
     *attached = true;
 }
 
-typedef JSString* (*ConcatStringsFn)(JSContext*, HandleString, HandleString);
-static const VMFunction ConcatStringsInfo =
-    FunctionInfo<ConcatStringsFn>(ConcatStrings<CanGC>, "ConcatStrings", NonTailCall);
-
 bool
 IonCacheIRCompiler::emitCallStringConcatResult()
 {
     AutoSaveLiveRegisters save(*this);
     AutoOutputRegister output(*this);
 
     Register lhs = allocator.useRegister(masm, reader.stringOperandId());
     Register rhs = allocator.useRegister(masm, reader.stringOperandId());
--- a/js/src/jit/VMFunctions.cpp
+++ b/js/src/jit/VMFunctions.cpp
@@ -350,16 +350,20 @@ bool StringSplitHelper(JSContext* cx, Ha
     JSObject* resultObj = str_split_string(cx, group, str, sep, limit);
     if (!resultObj)
         return false;
 
     result.setObject(*resultObj);
     return true;
 }
 
+typedef bool (*StringSplitHelperFn)(JSContext*, HandleString, HandleString, HandleObjectGroup,
+                                    uint32_t limit, MutableHandleValue);
+const VMFunction StringSplitHelperInfo =
+    FunctionInfo<StringSplitHelperFn>(StringSplitHelper, "StringSplitHelper");
 
 bool
 ArrayPopDense(JSContext* cx, HandleObject obj, MutableHandleValue rval)
 {
     MOZ_ASSERT(obj->is<ArrayObject>());
 
     AutoDetectInvalidation adi(cx, rval);
 
@@ -476,16 +480,20 @@ SetArrayLength(JSContext* cx, HandleObje
             return false;
     } else {
         MOZ_ALWAYS_TRUE(result.fail(JSMSG_READ_ONLY));
     }
 
     return result.checkStrictErrorOrWarning(cx, obj, id, strict);
 }
 
+typedef bool (*SetArrayLengthFn)(JSContext*, HandleObject, HandleValue, bool);
+const VMFunction SetArrayLengthInfo =
+    FunctionInfo<SetArrayLengthFn>(SetArrayLength, "SetArrayLength");
+
 bool
 CharCodeAt(JSContext* cx, HandleString str, int32_t index, uint32_t* code)
 {
     char16_t c;
     if (!str->getChar(cx, index, &c))
         return false;
     *code = c;
     return true;
@@ -1890,16 +1898,20 @@ CloseIteratorFromIon(JSContext* cx, JSOb
 }
 
 typedef bool (*SetObjectElementFn)(JSContext*, HandleObject, HandleValue,
                                    HandleValue, HandleValue, bool);
 const VMFunction SetObjectElementInfo =
     FunctionInfo<SetObjectElementFn>(js::SetObjectElement, "SetObjectElement");
 
 
+typedef JSString* (*ConcatStringsFn)(JSContext*, HandleString, HandleString);
+const VMFunction ConcatStringsInfo =
+    FunctionInfo<ConcatStringsFn>(ConcatStrings<CanGC>, "ConcatStrings");
+
 static JSString*
 ConvertObjectToStringForConcat(JSContext* cx, HandleValue obj)
 {
     MOZ_ASSERT(obj.isObject());
     RootedValue rootedObj(cx, obj);
     if (!ToPrimitive(cx, &rootedObj))
         return nullptr;
     return ToString<CanGC>(cx, rootedObj);
@@ -1960,10 +1972,32 @@ TrySkipAwait(JSContext* cx, HandleValue 
         return false;
 
     if (!canSkip)
         resolved.setMagic(JS_CANNOT_SKIP_AWAIT);
 
     return true;
 }
 
+typedef bool (*ProxyGetPropertyFn)(JSContext*, HandleObject, HandleId, MutableHandleValue);
+const VMFunction ProxyGetPropertyInfo =
+    FunctionInfo<ProxyGetPropertyFn>(ProxyGetProperty, "ProxyGetProperty");
+
+typedef bool (*ProxyGetPropertyByValueFn)(JSContext*, HandleObject, HandleValue, MutableHandleValue);
+const VMFunction ProxyGetPropertyByValueInfo =
+    FunctionInfo<ProxyGetPropertyByValueFn>(ProxyGetPropertyByValue, "ProxyGetPropertyByValue");
+
+typedef bool (*ProxySetPropertyFn)(JSContext*, HandleObject, HandleId, HandleValue, bool);
+const VMFunction ProxySetPropertyInfo =
+    FunctionInfo<ProxySetPropertyFn>(ProxySetProperty, "ProxySetProperty");
+
+typedef bool (*ProxySetPropertyByValueFn)(JSContext*, HandleObject, HandleValue, HandleValue, bool);
+const VMFunction ProxySetPropertyByValueInfo =
+    FunctionInfo<ProxySetPropertyByValueFn>(ProxySetPropertyByValue, "ProxySetPropertyByValue");
+
+typedef bool (*ProxyHasFn)(JSContext*, HandleObject, HandleValue, MutableHandleValue);
+const VMFunction ProxyHasInfo = FunctionInfo<ProxyHasFn>(ProxyHas, "ProxyHas");
+
+typedef bool (*ProxyHasOwnFn)(JSContext*, HandleObject, HandleValue, MutableHandleValue);
+const VMFunction ProxyHasOwnInfo = FunctionInfo<ProxyHasOwnFn>(ProxyHasOwn, "ProxyHasOwn");
+
 } // namespace jit
 } // namespace js
--- a/js/src/jit/VMFunctions.h
+++ b/js/src/jit/VMFunctions.h
@@ -948,31 +948,42 @@ JSString*
 TypeOfObject(JSObject* obj, JSRuntime* rt);
 
 bool
 GetPrototypeOf(JSContext* cx, HandleObject target, MutableHandleValue rval);
 
 void
 CloseIteratorFromIon(JSContext* cx, JSObject* obj);
 
-extern const VMFunction SetObjectElementInfo;
-
 bool
 DoConcatStringObject(JSContext* cx, HandleValue lhs, HandleValue rhs,
                      MutableHandleValue res);
 
 // Wrapper for js::TrySkipAwait.
 // If the await operation can be skipped and the resolution value for `val` can
 // be acquired, stored the resolved value to `resolved`.  Otherwise, stores
 // the JS_CANNOT_SKIP_AWAIT magic value to `resolved`.
 MOZ_MUST_USE bool
 TrySkipAwait(JSContext* cx, HandleValue val, MutableHandleValue resolved);
 
-// This is the tailcall version of DoConcatStringObject
-extern const VMFunction DoConcatStringObjectInfo;
+// VMFunctions shared by JITs
+extern const VMFunction SetArrayLengthInfo;
+extern const VMFunction SetObjectElementInfo;
 
 extern const VMFunction StringsEqualInfo;
 extern const VMFunction StringsNotEqualInfo;
+extern const VMFunction ConcatStringsInfo;
+extern const VMFunction StringSplitHelperInfo;
+
+extern const VMFunction ProxyGetPropertyInfo;
+extern const VMFunction ProxyGetPropertyByValueInfo;
+extern const VMFunction ProxySetPropertyInfo;
+extern const VMFunction ProxySetPropertyByValueInfo;
+extern const VMFunction ProxyHasInfo;
+extern const VMFunction ProxyHasOwnInfo;
+
+// TailCall VMFunctions
+extern const VMFunction DoConcatStringObjectInfo;
 
 } // namespace jit
 } // namespace js
 
 #endif /* jit_VMFunctions_h */