Date: Thu, 8 Mar 2018 00:07:28 +0000 (UTC) From: Jan Beich <jbeich@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r463842 - in head/www/waterfox: . files Message-ID: <201803080007.w2807SsN038044@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jbeich Date: Thu Mar 8 00:07:28 2018 New Revision: 463842 URL: https://svnweb.freebsd.org/changeset/ports/463842 Log: www/waterfox: apply FF60 fix Added: head/www/waterfox/files/patch-bug1411415 (contents, props changed) Modified: head/www/waterfox/Makefile (contents, props changed) Modified: head/www/waterfox/Makefile ============================================================================== --- head/www/waterfox/Makefile Wed Mar 7 23:58:40 2018 (r463841) +++ head/www/waterfox/Makefile Thu Mar 8 00:07:28 2018 (r463842) @@ -3,6 +3,7 @@ PORTNAME= waterfox DISTVERSION= 56.0.4-36 DISTVERSIONSUFFIX= -g79492ecca478 +PORTREVISION= 1 CATEGORIES= www ipv6 MAINTAINER= jbeich@FreeBSD.org Added: head/www/waterfox/files/patch-bug1411415 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/www/waterfox/files/patch-bug1411415 Thu Mar 8 00:07:28 2018 (r463842) @@ -0,0 +1,383 @@ +commit 627eb6ae9a72 +Author: Kannan Vijayan <kvijayan@mozilla.com> +Date: Mon Mar 5 19:27:02 2018 -0500 + + Bug 1411415 - r=bz r=fitzgen +--- + dom/bindings/BindingUtils.cpp | 20 +++++------ + dom/bindings/ErrorResult.h | 2 +- + dom/xslt/xpath/txXPCOMExtensionFunction.cpp | 2 +- + js/public/Value.h | 55 ++++++++++++++++++++++++++--- + js/rust/build.rs | 1 + + js/src/jit/BaselineFrameInfo.h | 4 +-- + js/src/jit/CacheIRCompiler.cpp | 2 +- + js/src/jit/RegisterSets.h | 8 ++--- + js/src/jit/RematerializedFrame.cpp | 14 ++++++-- + js/src/wasm/AsmJS.cpp | 10 +++--- + js/xpconnect/src/XPCWrappedNative.cpp | 7 ++-- + layout/style/ServoBindings.toml | 6 ++-- + xpcom/reflect/xptcall/xptcall.h | 2 +- + 13 files changed, 97 insertions(+), 36 deletions(-) + +diff --git dom/bindings/BindingUtils.cpp dom/bindings/BindingUtils.cpp +index 93069ac4a8b8..ac8c7a2229f3 100644 +--- dom/bindings/BindingUtils.cpp ++++ dom/bindings/BindingUtils.cpp +@@ -287,8 +287,8 @@ TErrorResult<CleanupPolicy>::ThrowJSException(JSContext* cx, JS::Handle<JS::Valu + // Make sure mJSException is initialized _before_ we try to root it. But + // don't set it to exn yet, because we don't want to do that until after we + // root. +- mJSException.setUndefined(); +- if (!js::AddRawValueRoot(cx, &mJSException, "TErrorResult::mJSException")) { ++ mJSException.asValueRef().setUndefined(); ++ if (!js::AddRawValueRoot(cx, &mJSException.asValueRef(), "TErrorResult::mJSException")) { + // Don't use NS_ERROR_INTERNAL_ERRORRESULT_JS_EXCEPTION, because that + // indicates we have in fact rooted mJSException. + mResult = NS_ERROR_OUT_OF_MEMORY; +@@ -317,7 +317,7 @@ TErrorResult<CleanupPolicy>::SetPendingJSException(JSContext* cx) + mJSException = exception; + // If JS_WrapValue failed, not much we can do about it... No matter + // what, go ahead and unroot mJSException. +- js::RemoveRawValueRoot(cx, &mJSException); ++ js::RemoveRawValueRoot(cx, &mJSException.asValueRef()); + + mResult = NS_OK; + #ifdef DEBUG +@@ -423,8 +423,8 @@ TErrorResult<CleanupPolicy>::ClearUnionData() + if (IsJSException()) { + JSContext* cx = dom::danger::GetJSContext(); + MOZ_ASSERT(cx); +- mJSException.setUndefined(); +- js::RemoveRawValueRoot(cx, &mJSException); ++ mJSException.asValueRef().setUndefined(); ++ js::RemoveRawValueRoot(cx, &mJSException.asValueRef()); + #ifdef DEBUG + mUnionState = HasNothing; + #endif // DEBUG +@@ -467,13 +467,13 @@ TErrorResult<CleanupPolicy>::operator=(TErrorResult<CleanupPolicy>&& aRHS) + } else if (aRHS.IsJSException()) { + JSContext* cx = dom::danger::GetJSContext(); + MOZ_ASSERT(cx); +- mJSException.setUndefined(); +- if (!js::AddRawValueRoot(cx, &mJSException, "TErrorResult::mJSException")) { ++ mJSException.asValueRef().setUndefined(); ++ if (!js::AddRawValueRoot(cx, &mJSException.asValueRef(), "TErrorResult::mJSException")) { + MOZ_CRASH("Could not root mJSException, we're about to OOM"); + } + mJSException = aRHS.mJSException; +- aRHS.mJSException.setUndefined(); +- js::RemoveRawValueRoot(cx, &aRHS.mJSException); ++ aRHS.mJSException.asValueRef().setUndefined(); ++ js::RemoveRawValueRoot(cx, &aRHS.mJSException.asValueRef()); + } else if (aRHS.IsDOMException()) { + mDOMExceptionInfo = aRHS.mDOMExceptionInfo; + aRHS.mDOMExceptionInfo = nullptr; +@@ -525,7 +525,7 @@ TErrorResult<CleanupPolicy>::CloneTo(TErrorResult& aRv) const + aRv.mUnionState = HasJSException; + #endif + JSContext* cx = dom::danger::GetJSContext(); +- JS::Rooted<JS::Value> exception(cx, mJSException); ++ JS::Rooted<JS::Value> exception(cx, mJSException.asValueRef()); + aRv.ThrowJSException(cx, exception); + } + } +diff --git dom/bindings/ErrorResult.h dom/bindings/ErrorResult.h +index 7b38226691bb..a406a2c490a5 100644 +--- dom/bindings/ErrorResult.h ++++ dom/bindings/ErrorResult.h +@@ -507,7 +507,7 @@ private: + // (and deallocated) by SetPendingDOMException. + union { + Message* mMessage; // valid when IsErrorWithMessage() +- JS::Value mJSException; // valid when IsJSException() ++ JS::UninitializedValue mJSException; // valid when IsJSException() + DOMExceptionInfo* mDOMExceptionInfo; // valid when IsDOMException() + }; + +diff --git dom/xslt/xpath/txXPCOMExtensionFunction.cpp dom/xslt/xpath/txXPCOMExtensionFunction.cpp +index e95baa0bbde8..e1387422c303 100644 +--- dom/xslt/xpath/txXPCOMExtensionFunction.cpp ++++ dom/xslt/xpath/txXPCOMExtensionFunction.cpp +@@ -322,7 +322,7 @@ public: + void trace(JSTracer* trc) { + for (uint8_t i = 0; i < mCount; ++i) { + if (mArray[i].type == nsXPTType::T_JSVAL) { +- JS::UnsafeTraceRoot(trc, &mArray[i].val.j, "txParam value"); ++ JS::UnsafeTraceRoot(trc, &mArray[i].val.j.asValueRef(), "txParam value"); + } + } + } +diff --git js/public/Value.h js/public/Value.h +index b7c4e1b8a770..96a1b703bbc1 100644 +--- js/public/Value.h ++++ js/public/Value.h +@@ -137,12 +137,16 @@ static_assert(sizeof(JSValueShiftedTag) == sizeof(uint64_t), + + #define JSVAL_TYPE_TO_TAG(type) ((JSValueTag)(JSVAL_TAG_CLEAR | (type))) + ++#define JSVAL_RAW64_UNDEFINED (uint64_t(JSVAL_TAG_UNDEFINED) << 32) ++ + #define JSVAL_UPPER_EXCL_TAG_OF_PRIMITIVE_SET JSVAL_TAG_OBJECT + #define JSVAL_UPPER_INCL_TAG_OF_NUMBER_SET JSVAL_TAG_INT32 + #define JSVAL_LOWER_INCL_TAG_OF_GCTHING_SET JSVAL_TAG_STRING + + #elif defined(JS_PUNBOX64) + ++#define JSVAL_RAW64_UNDEFINED (uint64_t(JSVAL_TAG_UNDEFINED) << JSVAL_TAG_SHIFT) ++ + #define JSVAL_PAYLOAD_MASK 0x00007FFFFFFFFFFFLL + #define JSVAL_TAG_MASK 0xFFFF800000000000LL + #define JSVAL_TYPE_TO_TAG(type) ((JSValueTag)(JSVAL_TAG_MAX_DOUBLE | (type))) +@@ -814,7 +818,7 @@ class MOZ_NON_PARAM alignas(8) Value + double asDouble; + void* asPtr; + +- layout() = default; ++ layout() : asBits(JSVAL_RAW64_UNDEFINED) {} + explicit constexpr layout(uint64_t bits) : asBits(bits) {} + explicit constexpr layout(double d) : asDouble(d) {} + } data; +@@ -840,7 +844,7 @@ class MOZ_NON_PARAM alignas(8) Value + size_t asWord; + uintptr_t asUIntPtr; + +- layout() = default; ++ layout() : asBits(JSVAL_RAW64_UNDEFINED) {} + explicit constexpr layout(uint64_t bits) : asBits(bits) {} + explicit constexpr layout(double d) : asDouble(d) {} + } data; +@@ -868,7 +872,7 @@ class MOZ_NON_PARAM alignas(8) Value + double asDouble; + void* asPtr; + +- layout() = default; ++ layout() : asBits(JSVAL_RAW64_UNDEFINED) {} + explicit constexpr layout(uint64_t bits) : asBits(bits) {} + explicit constexpr layout(double d) : asDouble(d) {} + } data; +@@ -892,7 +896,7 @@ class MOZ_NON_PARAM alignas(8) Value + size_t asWord; + uintptr_t asUIntPtr; + +- layout() = default; ++ layout() : asBits(JSVAL_RAW64_UNDEFINED) {} + explicit constexpr layout(uint64_t bits) : asBits(bits) {} + explicit constexpr layout(double d) : asDouble(d) {} + } data; +@@ -945,8 +949,51 @@ class MOZ_NON_PARAM alignas(8) Value + } + } JS_HAZ_GC_POINTER; + ++/** ++ * This is a null-constructible structure that can convert to and from ++ * a Value, allowing UninitializedValue to be stored in unions. ++ */ ++struct MOZ_NON_PARAM alignas(8) UninitializedValue ++{ ++ private: ++ uint64_t bits; ++ ++ public: ++ UninitializedValue() = default; ++ UninitializedValue(const UninitializedValue&) = default; ++ MOZ_IMPLICIT UninitializedValue(const Value& val) : bits(val.asRawBits()) {} ++ ++ inline uint64_t asRawBits() const { ++ return bits; ++ } ++ ++ inline Value& asValueRef() { ++ return *reinterpret_cast<Value*>(this); ++ } ++ inline const Value& asValueRef() const { ++ return *reinterpret_cast<const Value*>(this); ++ } ++ ++ inline operator Value&() { ++ return asValueRef(); ++ } ++ inline operator Value const&() const { ++ return asValueRef(); ++ } ++ inline operator Value() const { ++ return asValueRef(); ++ } ++ ++ inline void operator=(Value const& other) { ++ asValueRef() = other; ++ } ++}; ++ + static_assert(sizeof(Value) == 8, "Value size must leave three tag bits, be a binary power, and is ubiquitously depended upon everywhere"); + ++static_assert(sizeof(UninitializedValue) == sizeof(Value), "Value and UninitializedValue must be the same size"); ++static_assert(alignof(UninitializedValue) == alignof(Value), "Value and UninitializedValue must have same alignment"); ++ + inline bool + IsOptimizedPlaceholderMagicValue(const Value& v) + { +diff --git js/src/jit/BaselineFrameInfo.h js/src/jit/BaselineFrameInfo.h +index 13bf0358d944..1691270acf17 100644 +--- js/src/jit/BaselineFrameInfo.h ++++ js/src/jit/BaselineFrameInfo.h +@@ -67,7 +67,7 @@ class StackValue + + union { + struct { +- Value v; ++ JS::UninitializedValue v; + } constant; + struct { + mozilla::AlignedStorage2<ValueOperand> reg; +@@ -112,7 +112,7 @@ class StackValue + } + Value constant() const { + MOZ_ASSERT(kind_ == Constant); +- return data.constant.v; ++ return data.constant.v.asValueRef(); + } + ValueOperand reg() const { + MOZ_ASSERT(kind_ == Register); +diff --git js/src/jit/CacheIRCompiler.cpp js/src/jit/CacheIRCompiler.cpp +index 98d2dcbf1b23..35357ed7c8da 100644 +--- js/src/jit/CacheIRCompiler.cpp ++++ js/src/jit/CacheIRCompiler.cpp +@@ -925,7 +925,7 @@ CacheIRWriter::copyStubData(uint8_t* dest) const + *reinterpret_cast<uint64_t*>(destWords) = field.asInt64(); + break; + case StubField::Type::Value: +- InitGCPtr<JS::Value>(destWords, field.asInt64()); ++ AsGCPtr<Value>(destWords)->init(Value::fromRawBits(uint64_t(field.asInt64()))); + break; + case StubField::Type::Limit: + MOZ_CRASH("Invalid type"); +diff --git js/src/jit/RegisterSets.h js/src/jit/RegisterSets.h +index b6436a801b1c..749730aac4c6 100644 +--- js/src/jit/RegisterSets.h ++++ js/src/jit/RegisterSets.h +@@ -226,13 +226,13 @@ class ConstantOrRegister + + // Space to hold either a Value or a TypedOrValueRegister. + union U { +- Value constant; ++ JS::UninitializedValue constant; + TypedOrValueRegister reg; + } data; + +- const Value& dataValue() const { ++ Value dataValue() const { + MOZ_ASSERT(constant()); +- return data.constant; ++ return data.constant.asValueRef(); + } + void setDataValue(const Value& value) { + MOZ_ASSERT(constant()); +@@ -268,7 +268,7 @@ class ConstantOrRegister + return constant_; + } + +- const Value& value() const { ++ Value value() const { + return dataValue(); + } + +diff --git js/src/jit/RematerializedFrame.cpp js/src/jit/RematerializedFrame.cpp +index f12475e5ee55..8cfb0c0d0b87 100644 +--- js/src/jit/RematerializedFrame.cpp ++++ js/src/jit/RematerializedFrame.cpp +@@ -60,9 +60,17 @@ RematerializedFrame::New(JSContext* cx, uint8_t* top, InlineFrameIterator& iter, + { + unsigned numFormals = iter.isFunctionFrame() ? iter.calleeTemplate()->nargs() : 0; + unsigned argSlots = Max(numFormals, iter.numActualArgs()); +- size_t numBytes = sizeof(RematerializedFrame) + +- (argSlots + iter.script()->nfixed()) * sizeof(Value) - +- sizeof(Value); // 1 Value included in sizeof(RematerializedFrame) ++ unsigned extraSlots = argSlots + iter.script()->nfixed(); ++ ++ // One Value slot is included in sizeof(RematerializedFrame), so we can ++ // reduce the extra slot count by one. However, if there are zero slot ++ // allocations total, then reducing the slots by one will lead to ++ // the memory allocation being smaller than sizeof(RematerializedFrame). ++ if (extraSlots > 0) ++ extraSlots -= 1; ++ ++ size_t numBytes = sizeof(RematerializedFrame) + (extraSlots * sizeof(Value)); ++ MOZ_ASSERT(numBytes >= sizeof(RematerializedFrame)); + + void* buf = cx->pod_calloc<uint8_t>(numBytes); + if (!buf) +diff --git js/src/wasm/AsmJS.cpp js/src/wasm/AsmJS.cpp +index a5102bd66373..9fe705976ea3 100644 +--- js/src/wasm/AsmJS.cpp ++++ js/src/wasm/AsmJS.cpp +@@ -851,7 +851,7 @@ class NumLit + private: + Which which_; + union { +- Value scalar_; ++ JS::UninitializedValue scalar_; + SimdConstant simd_; + } u; + +@@ -874,7 +874,7 @@ class NumLit + + int32_t toInt32() const { + MOZ_ASSERT(which_ == Fixnum || which_ == NegativeInt || which_ == BigUnsigned); +- return u.scalar_.toInt32(); ++ return u.scalar_.asValueRef().toInt32(); + } + + uint32_t toUint32() const { +@@ -883,17 +883,17 @@ class NumLit + + double toDouble() const { + MOZ_ASSERT(which_ == Double); +- return u.scalar_.toDouble(); ++ return u.scalar_.asValueRef().toDouble(); + } + + float toFloat() const { + MOZ_ASSERT(which_ == Float); +- return float(u.scalar_.toDouble()); ++ return float(u.scalar_.asValueRef().toDouble()); + } + + Value scalarValue() const { + MOZ_ASSERT(which_ != OutOfRangeInt); +- return u.scalar_; ++ return u.scalar_.asValueRef(); + } + + bool isSimd() const +diff --git js/xpconnect/src/XPCWrappedNative.cpp js/xpconnect/src/XPCWrappedNative.cpp +index fd992eb22465..946d671ddd00 100644 +--- js/xpconnect/src/XPCWrappedNative.cpp ++++ js/xpconnect/src/XPCWrappedNative.cpp +@@ -1723,9 +1723,12 @@ CallMethodHelper::ConvertIndependentParam(uint8_t i) + // indirectly, regardless of in/out-ness. + if (type_tag == nsXPTType::T_JSVAL) { + // Root the value. +- dp->val.j.setUndefined(); +- if (!js::AddRawValueRoot(mCallContext, &dp->val.j, "XPCWrappedNative::CallMethod param")) ++ dp->val.j.asValueRef().setUndefined(); ++ if (!js::AddRawValueRoot(mCallContext, &dp->val.j.asValueRef(), ++ "XPCWrappedNative::CallMethod param")) ++ { + return false; ++ } + } + + // Flag cleanup for anything that isn't self-contained. +diff --git xpcom/reflect/xptcall/xptcall.h xpcom/reflect/xptcall/xptcall.h +index ddab2e4af127..4b387e8ee9c1 100644 +--- xpcom/reflect/xptcall/xptcall.h ++++ xpcom/reflect/xptcall/xptcall.h +@@ -39,7 +39,7 @@ struct nsXPTCMiniVariant + // Types below here are unknown to the assembly implementations, and + // therefore _must_ be passed with indirect semantics. We put them in + // the union here for type safety, so that we can avoid void* tricks. +- JS::Value j; ++ JS::UninitializedValue j; + } val; + }; +
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201803080007.w2807SsN038044>