Bug 1647895 - Remove inputType from MTypeof. r=jandem

Differential Revision: https://phabricator.services.mozilla.com/D80746
This commit is contained in:
Tom Schuster 2020-06-24 08:12:22 +00:00
Родитель 45dcbc2d5c
Коммит 366e3067b4
4 изменённых файлов: 8 добавлений и 16 удалений

Просмотреть файл

@ -12110,7 +12110,7 @@ AbortReasonOr<Ok> IonBuilder::jsop_globalthis() {
AbortReasonOr<Ok> IonBuilder::jsop_typeof() {
MDefinition* input = current->pop();
MTypeOf* ins = MTypeOf::New(alloc(), input, input->type());
MTypeOf* ins = MTypeOf::New(alloc(), input);
ins->cacheInputMaybeCallableOrEmulatesUndefined(constraints());

Просмотреть файл

@ -3540,13 +3540,13 @@ MDefinition* MBitNot::foldsTo(TempAllocator& alloc) {
}
MDefinition* MTypeOf::foldsTo(TempAllocator& alloc) {
// Note: we can't use input->type() here, type analysis has
// boxed the input.
MOZ_ASSERT(input()->type() == MIRType::Value);
if (!input()->isBox()) {
return this;
}
MDefinition* unboxed = input()->toBox()->input();
JSType type;
switch (inputType()) {
switch (unboxed->type()) {
case MIRType::Double:
case MIRType::Float32:
case MIRType::Int32:

Просмотреть файл

@ -4482,12 +4482,10 @@ class MBitNot : public MUnaryInstruction, public BitwisePolicy::Data {
};
class MTypeOf : public MUnaryInstruction, public BoxInputsPolicy::Data {
MIRType inputType_;
bool inputMaybeCallableOrEmulatesUndefined_;
MTypeOf(MDefinition* def, MIRType inputType)
explicit MTypeOf(MDefinition* def)
: MUnaryInstruction(classOpcode, def),
inputType_(inputType),
inputMaybeCallableOrEmulatesUndefined_(true) {
setResultType(MIRType::String);
setMovable();
@ -4497,8 +4495,6 @@ class MTypeOf : public MUnaryInstruction, public BoxInputsPolicy::Data {
INSTRUCTION_HEADER(TypeOf)
TRIVIAL_NEW_WRAPPERS
MIRType inputType() const { return inputType_; }
MDefinition* foldsTo(TempAllocator& alloc) override;
void cacheInputMaybeCallableOrEmulatesUndefined(
CompilerConstraintList* constraints);
@ -4516,9 +4512,6 @@ class MTypeOf : public MUnaryInstruction, public BoxInputsPolicy::Data {
if (!ins->isTypeOf()) {
return false;
}
if (inputType() != ins->toTypeOf()->inputType()) {
return false;
}
if (inputMaybeCallableOrEmulatesUndefined() !=
ins->toTypeOf()->inputMaybeCallableOrEmulatesUndefined()) {
return false;

Просмотреть файл

@ -1525,9 +1525,8 @@ bool WarpBuilder::build_ToPropertyKey(BytecodeLocation loc) {
}
bool WarpBuilder::build_Typeof(BytecodeLocation) {
// TODO: remove MTypeOf::inputType_ and unbox in foldsTo instead.
MDefinition* input = current->pop();
MTypeOf* ins = MTypeOf::New(alloc(), input, MIRType::Value);
MTypeOf* ins = MTypeOf::New(alloc(), input);
current->add(ins);
current->push(ins);
return true;