summaryrefslogtreecommitdiffstats
path: root/js
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@wolfbeast.com>2020-01-11 14:15:49 +0100
committerwolfbeast <mcwerewolf@wolfbeast.com>2020-01-11 14:15:49 +0100
commit823b9a4120813274849e68443ec43249b97add3e (patch)
tree0845f6a6ce06db041530948c5cbd4c347ba12866 /js
parent319d485e234dff3f59ac2e98ccf4c32a1aa43642 (diff)
parentcffb44547ae7997e5eaf71c644bd626eeb3bba00 (diff)
downloadUXP-823b9a4120813274849e68443ec43249b97add3e.tar
UXP-823b9a4120813274849e68443ec43249b97add3e.tar.gz
UXP-823b9a4120813274849e68443ec43249b97add3e.tar.lz
UXP-823b9a4120813274849e68443ec43249b97add3e.tar.xz
UXP-823b9a4120813274849e68443ec43249b97add3e.zip
Merge branch 'release' into Pale_Moon-release
Diffstat (limited to 'js')
-rw-r--r--js/public/RootingAPI.h14
-rw-r--r--js/public/Value.h91
-rw-r--r--js/src/jit/AliasAnalysisShared.cpp4
-rw-r--r--js/src/jit/MIR.h9
4 files changed, 41 insertions, 77 deletions
diff --git a/js/public/RootingAPI.h b/js/public/RootingAPI.h
index 9f6ed8943..ca35ea4a5 100644
--- a/js/public/RootingAPI.h
+++ b/js/public/RootingAPI.h
@@ -274,6 +274,12 @@ class MOZ_NON_MEMMOVABLE Heap : public js::HeapBase<T>
T* unsafeGet() { return &ptr; }
+ void set(const T& newPtr) {
+ T tmp = ptr;
+ ptr = newPtr;
+ post(tmp, ptr);
+ }
+
explicit operator bool() const {
return bool(js::BarrierMethods<T>::asGCThingOrNull(ptr));
}
@@ -287,12 +293,6 @@ class MOZ_NON_MEMMOVABLE Heap : public js::HeapBase<T>
post(GCPolicy<T>::initial(), ptr);
}
- void set(const T& newPtr) {
- T tmp = ptr;
- ptr = newPtr;
- post(tmp, ptr);
- }
-
void post(const T& prev, const T& next) {
js::BarrierMethods<T>::postBarrier(&ptr, prev, next);
}
@@ -1172,13 +1172,13 @@ class PersistentRooted : public js::PersistentRootedBase<T>,
return ptr;
}
- private:
template <typename U>
void set(U&& value) {
MOZ_ASSERT(initialized());
ptr = mozilla::Forward<U>(value);
}
+ private:
// See the comment above Rooted::ptr.
using MaybeWrapped = typename mozilla::Conditional<
MapTypeToRootKind<T>::kind == JS::RootKind::Traceable,
diff --git a/js/public/Value.h b/js/public/Value.h
index 7c4f833e3..272d9b478 100644
--- a/js/public/Value.h
+++ b/js/public/Value.h
@@ -399,25 +399,21 @@ class MOZ_NON_PARAM alignas(8) Value
data.asBits = bitsFromTagAndPayload(JSVAL_TAG_MAGIC, payload);
}
- bool setNumber(uint32_t ui) {
+ void setNumber(uint32_t ui) {
if (ui > JSVAL_INT_MAX) {
setDouble((double)ui);
- return false;
} else {
setInt32((int32_t)ui);
- return true;
}
}
- bool setNumber(double d) {
+ void setNumber(double d) {
int32_t i;
if (mozilla::NumberIsInt32(d, &i)) {
setInt32(i);
- return true;
+ } else {
+ setDouble(d);
}
-
- setDouble(d);
- return false;
}
void setObjectOrNull(JSObject* arg) {
@@ -1406,25 +1402,29 @@ class ValueOperations
template <class Outer>
class MutableValueOperations : public ValueOperations<Outer>
{
- JS::Value& value() { return static_cast<Outer*>(this)->get(); }
+ protected:
+ void set(const JS::Value& v) {
+ // Call Outer::set to trigger any barriers.
+ static_cast<Outer*>(this)->set(v);
+ }
public:
- void setNull() { value().setNull(); }
- void setUndefined() { value().setUndefined(); }
- void setInt32(int32_t i) { value().setInt32(i); }
- void setDouble(double d) { value().setDouble(d); }
+ void setNull() { set(JS::NullValue()); }
+ void setUndefined() { set(JS::UndefinedValue()); }
+ void setInt32(int32_t i) { set(JS::Int32Value(i)); }
+ void setDouble(double d) { set(JS::DoubleValue(d)); }
void setNaN() { setDouble(JS::GenericNaN()); }
- void setBoolean(bool b) { value().setBoolean(b); }
- void setMagic(JSWhyMagic why) { value().setMagic(why); }
- bool setNumber(uint32_t ui) { return value().setNumber(ui); }
- bool setNumber(double d) { return value().setNumber(d); }
- void setString(JSString* str) { this->value().setString(str); }
- void setSymbol(JS::Symbol* sym) { this->value().setSymbol(sym); }
- void setObject(JSObject& obj) { this->value().setObject(obj); }
- void setObjectOrNull(JSObject* arg) { this->value().setObjectOrNull(arg); }
- void setPrivate(void* ptr) { this->value().setPrivate(ptr); }
- void setPrivateUint32(uint32_t ui) { this->value().setPrivateUint32(ui); }
- void setPrivateGCThing(js::gc::Cell* cell) { this->value().setPrivateGCThing(cell); }
+ void setBoolean(bool b) { set(JS::BooleanValue(b)); }
+ void setMagic(JSWhyMagic why) { set(JS::MagicValue(why)); }
+ void setNumber(uint32_t ui) { set(JS::NumberValue(ui)); }
+ void setNumber(double d) { set(JS::NumberValue(d)); }
+ void setString(JSString* str) { set(JS::StringValue(str)); }
+ void setSymbol(JS::Symbol* sym) { set(JS::SymbolValue(sym)); }
+ void setObject(JSObject& obj) { set(JS::ObjectValue(obj)); }
+ void setObjectOrNull(JSObject* arg) { set(JS::ObjectOrNullValue(arg)); }
+ void setPrivate(void* ptr) { set(JS::PrivateValue(ptr)); }
+ void setPrivateUint32(uint32_t ui) { set(JS::PrivateUint32Value(ui)); }
+ void setPrivateGCThing(js::gc::Cell* cell) { set(JS::PrivateGCThingValue(cell)); }
};
/*
@@ -1432,55 +1432,28 @@ class MutableValueOperations : public ValueOperations<Outer>
* type-querying, value-extracting, and mutating operations.
*/
template <>
-class HeapBase<JS::Value> : public ValueOperations<JS::Heap<JS::Value> >
+class HeapBase<JS::Value> : public MutableValueOperations<JS::Heap<JS::Value> >
{
typedef JS::Heap<JS::Value> Outer;
friend class ValueOperations<Outer>;
- void setBarriered(const JS::Value& v) {
- *static_cast<JS::Heap<JS::Value>*>(this) = v;
- }
-
public:
- void setNull() { setBarriered(JS::NullValue()); }
- void setUndefined() { setBarriered(JS::UndefinedValue()); }
- void setInt32(int32_t i) { setBarriered(JS::Int32Value(i)); }
- void setDouble(double d) { setBarriered(JS::DoubleValue(d)); }
- void setNaN() { setDouble(JS::GenericNaN()); }
- void setBoolean(bool b) { setBarriered(JS::BooleanValue(b)); }
- void setMagic(JSWhyMagic why) { setBarriered(JS::MagicValue(why)); }
- void setString(JSString* str) { setBarriered(JS::StringValue(str)); }
- void setSymbol(JS::Symbol* sym) { setBarriered(JS::SymbolValue(sym)); }
- void setObject(JSObject& obj) { setBarriered(JS::ObjectValue(obj)); }
- void setPrivateGCThing(js::gc::Cell* cell) { setBarriered(JS::PrivateGCThingValue(cell)); }
-
- bool setNumber(uint32_t ui) {
+ void setNumber(uint32_t ui) {
if (ui > JSVAL_INT_MAX) {
- setDouble((double)ui);
- return false;
+ this->setDouble((double)ui);
} else {
- setInt32((int32_t)ui);
- return true;
+ this->setInt32((int32_t)ui);
}
}
- bool setNumber(double d) {
+ void setNumber(double d) {
int32_t i;
if (mozilla::NumberIsInt32(d, &i)) {
- setInt32(i);
- return true;
+ this->setInt32(i);
+ } else {
+ this->setDouble(d);
}
-
- setDouble(d);
- return false;
- }
-
- void setObjectOrNull(JSObject* arg) {
- if (arg)
- setObject(*arg);
- else
- setNull();
}
};
diff --git a/js/src/jit/AliasAnalysisShared.cpp b/js/src/jit/AliasAnalysisShared.cpp
index 0f0d4a66a..400626b33 100644
--- a/js/src/jit/AliasAnalysisShared.cpp
+++ b/js/src/jit/AliasAnalysisShared.cpp
@@ -86,8 +86,6 @@ GetObject(const MDefinition* ins)
case MDefinition::Op_SetInitializedLength:
case MDefinition::Op_ArrayLength:
case MDefinition::Op_SetArrayLength:
- case MDefinition::Op_StoreElementHole:
- case MDefinition::Op_FallibleStoreElement:
case MDefinition::Op_TypedObjectDescr:
case MDefinition::Op_Slots:
case MDefinition::Op_Elements:
@@ -143,6 +141,8 @@ GetObject(const MDefinition* ins)
case MDefinition::Op_WasmStoreGlobalVar:
case MDefinition::Op_ArrayJoin:
case MDefinition::Op_ArraySlice:
+ case MDefinition::Op_StoreElementHole:
+ case MDefinition::Op_FallibleStoreElement:
return nullptr;
default:
#ifdef DEBUG
diff --git a/js/src/jit/MIR.h b/js/src/jit/MIR.h
index 6c376d528..7b0ed65f2 100644
--- a/js/src/jit/MIR.h
+++ b/js/src/jit/MIR.h
@@ -9460,12 +9460,6 @@ class MStoreElementHole
TRIVIAL_NEW_WRAPPERS
NAMED_OPERANDS((0, object), (1, elements), (2, index), (3, value))
- AliasSet getAliasSet() const override {
- // StoreElementHole can update the initialized length, the array length
- // or reallocate obj->elements.
- return AliasSet::Store(AliasSet::ObjectFields | AliasSet::Element);
- }
-
ALLOW_CLONE(MStoreElementHole)
};
@@ -9496,9 +9490,6 @@ class MFallibleStoreElement
TRIVIAL_NEW_WRAPPERS
NAMED_OPERANDS((0, object), (1, elements), (2, index), (3, value))
- AliasSet getAliasSet() const override {
- return AliasSet::Store(AliasSet::ObjectFields | AliasSet::Element);
- }
bool strict() const {
return strict_;
}