summaryrefslogtreecommitdiff
path: root/js/src/jit/MIR.h
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/jit/MIR.h')
-rw-r--r--js/src/jit/MIR.h57
1 files changed, 42 insertions, 15 deletions
diff --git a/js/src/jit/MIR.h b/js/src/jit/MIR.h
index 6c0616c71d..72c5214845 100644
--- a/js/src/jit/MIR.h
+++ b/js/src/jit/MIR.h
@@ -1548,6 +1548,7 @@ class MConstant : public MNullaryInstruction
double d;
JSString* str;
JS::Symbol* sym;
+ BigInt* bi;
JSObject* obj;
uint64_t asBits;
};
@@ -1672,6 +1673,10 @@ class MConstant : public MNullaryInstruction
MOZ_ASSERT(type() == MIRType::Symbol);
return payload_.sym;
}
+ BigInt* toBigInt() const {
+ MOZ_ASSERT(type() == MIRType::BigInt);
+ return payload_.bi;
+ }
JSObject& toObject() const {
MOZ_ASSERT(type() == MIRType::Object);
return *payload_.obj;
@@ -4743,6 +4748,7 @@ class MUnbox final : public MUnaryInstruction, public BoxInputsPolicy::Data
type == MIRType::Double ||
type == MIRType::String ||
type == MIRType::Symbol ||
+ type == MIRType::BigInt ||
type == MIRType::Object);
TemporaryTypeSet* resultSet = ins->resultTypeSet();
@@ -4781,6 +4787,9 @@ class MUnbox final : public MUnaryInstruction, public BoxInputsPolicy::Data
case MIRType::Symbol:
kind = Bailout_NonSymbolInput;
break;
+ case MIRType::BigInt:
+ kind = Bailout_NonBigIntInput;
+ break;
case MIRType::Object:
kind = Bailout_NonObjectInput;
break;
@@ -5189,9 +5198,11 @@ class MToDouble
setMovable();
// An object might have "valueOf", which means it is effectful.
- // ToNumber(symbol) throws.
- if (def->mightBeType(MIRType::Object) || def->mightBeType(MIRType::Symbol))
+ // ToNumber(symbol) and ToNumber(bigint) throw.
+ if (def->mightBeType(MIRType::Object) || def->mightBeType(MIRType::Symbol) ||
+ def->mightBeType(MIRType::BigInt)) {
setGuard();
+ }
}
public:
@@ -5226,11 +5237,15 @@ class MToDouble
MOZ_MUST_USE bool writeRecoverData(CompactBufferWriter& writer) const override;
bool canRecoverOnBailout() const override {
- if (input()->type() == MIRType::Value)
+ if (input()->type() == MIRType::Value) {
return false;
- if (input()->type() == MIRType::Symbol)
+ }
+ if (input()->type() == MIRType::Symbol) {
return false;
-
+ }
+ if (input()->type() == MIRType::BigInt) {
+ return false;
+ }
return true;
}
@@ -5253,9 +5268,11 @@ class MToFloat32
setMovable();
// An object might have "valueOf", which means it is effectful.
- // ToNumber(symbol) throws.
- if (def->mightBeType(MIRType::Object) || def->mightBeType(MIRType::Symbol))
+ // ToNumber(symbol) and ToNumber(BigInt) throw.
+ if (def->mightBeType(MIRType::Object) || def->mightBeType(MIRType::Symbol) ||
+ def->mightBeType(MIRType::BigInt)) {
setGuard();
+ }
}
explicit MToFloat32(MDefinition* def, bool mustPreserveNaN)
@@ -5537,9 +5554,11 @@ class MToInt32
setMovable();
// An object might have "valueOf", which means it is effectful.
- // ToNumber(symbol) throws.
- if (def->mightBeType(MIRType::Object) || def->mightBeType(MIRType::Symbol))
+ // ToInt32(symbol) and ToInt32(BigInt) throw.
+ if (def->mightBeType(MIRType::Object) || def->mightBeType(MIRType::Symbol) ||
+ def->mightBeType(MIRType::BigInt)) {
setGuard();
+ }
}
public:
@@ -5594,9 +5613,11 @@ class MTruncateToInt32
setMovable();
// An object might have "valueOf", which means it is effectful.
- // ToInt32(symbol) throws.
- if (def->mightBeType(MIRType::Object) || def->mightBeType(MIRType::Symbol))
+ // ToInt32(symbol) and ToInt32(BigInt) throw.
+ if (def->mightBeType(MIRType::Object) || def->mightBeType(MIRType::Symbol) ||
+ def->mightBeType(MIRType::BigInt)) {
setGuard();
+ }
}
public:
@@ -5639,9 +5660,12 @@ class MToString :
setResultType(MIRType::String);
setMovable();
- // Objects might override toString and Symbols throw.
- if (def->mightBeType(MIRType::Object) || def->mightBeType(MIRType::Symbol))
+ // Objects might override toString; Symbol and BigInts throw. We bailout in
+ // those cases and run side-effects in baseline instead.
+ if (def->mightBeType(MIRType::Object) || def->mightBeType(MIRType::Symbol) ||
+ def->mightBeType(MIRType::BigInt)) {
setGuard();
+ }
}
public:
@@ -5701,7 +5725,7 @@ class MBitNot
: MUnaryInstruction(input)
{
specialization_ = MIRType::None;
- setResultType(MIRType::Int32);
+ setResultType(MIRType::Value);
setMovable();
}
@@ -5861,7 +5885,7 @@ class MBinaryBitwiseInstruction
maskMatchesRightRange(false)
{
MOZ_ASSERT(type == MIRType::Int32 || type == MIRType::Int64);
- setResultType(type);
+ setResultType(MIRType::Value);
setMovable();
}
@@ -14419,6 +14443,9 @@ MIRTypeForTypedArrayRead(Scalar::Type arrayType, bool observedDouble)
return MIRType::Float32;
case Scalar::Float64:
return MIRType::Double;
+ case Scalar::BigInt64:
+ case Scalar::BigUint64:
+ return MIRType::BigInt;
default:
break;
}