зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1314055 - Part 3: Support JSOP_TOASYNC in Ion. r=jandem
This commit is contained in:
Родитель
5e0d25b1c2
Коммит
b07a61038c
|
@ -39,6 +39,7 @@
|
|||
#include "jit/MoveEmitter.h"
|
||||
#include "jit/RangeAnalysis.h"
|
||||
#include "jit/SharedICHelpers.h"
|
||||
#include "vm/AsyncFunction.h"
|
||||
#include "vm/MatchPairs.h"
|
||||
#include "vm/RegExpObject.h"
|
||||
#include "vm/RegExpStatics.h"
|
||||
|
@ -10454,6 +10455,16 @@ CodeGenerator::visitOutOfLineTypeOfV(OutOfLineTypeOfV* ool)
|
|||
masm.jump(ool->rejoin());
|
||||
}
|
||||
|
||||
typedef JSObject* (*ToAsyncFn)(JSContext*, HandleFunction);
|
||||
static const VMFunction ToAsyncInfo = FunctionInfo<ToAsyncFn>(js::WrapAsyncFunction, "ToAsync");
|
||||
|
||||
void
|
||||
CodeGenerator::visitToAsync(LToAsync* lir)
|
||||
{
|
||||
pushArg(ToRegister(lir->unwrapped()));
|
||||
callVM(ToAsyncInfo, lir);
|
||||
}
|
||||
|
||||
typedef bool (*ToIdFn)(JSContext*, HandleScript, jsbytecode*, HandleValue,
|
||||
MutableHandleValue);
|
||||
static const VMFunction ToIdInfo = FunctionInfo<ToIdFn>(ToIdOperation, "ToIdOperation");
|
||||
|
|
|
@ -291,6 +291,7 @@ class CodeGenerator final : public CodeGeneratorSpecific
|
|||
void visitThrow(LThrow* lir);
|
||||
void visitTypeOfV(LTypeOfV* lir);
|
||||
void visitOutOfLineTypeOfV(OutOfLineTypeOfV* ool);
|
||||
void visitToAsync(LToAsync* lir);
|
||||
void visitToIdV(LToIdV* lir);
|
||||
template<typename T> void emitLoadElementT(LLoadElementT* lir, const T& source);
|
||||
void visitLoadElementT(LLoadElementT* lir);
|
||||
|
|
|
@ -2103,6 +2103,9 @@ IonBuilder::inspectOpcode(JSOp op)
|
|||
case JSOP_TYPEOFEXPR:
|
||||
return jsop_typeof();
|
||||
|
||||
case JSOP_TOASYNC:
|
||||
return jsop_toasync();
|
||||
|
||||
case JSOP_TOID:
|
||||
return jsop_toid();
|
||||
|
||||
|
@ -13569,6 +13572,20 @@ IonBuilder::jsop_typeof()
|
|||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
IonBuilder::jsop_toasync()
|
||||
{
|
||||
MDefinition* unwrapped = current->pop();
|
||||
MOZ_ASSERT(unwrapped->type() == MIRType::Object);
|
||||
|
||||
MToAsync* ins = MToAsync::New(alloc(), unwrapped);
|
||||
|
||||
current->add(ins);
|
||||
current->push(ins);
|
||||
|
||||
return resumeAfter(ins);
|
||||
}
|
||||
|
||||
bool
|
||||
IonBuilder::jsop_toid()
|
||||
{
|
||||
|
|
|
@ -769,6 +769,7 @@ class IonBuilder
|
|||
MOZ_MUST_USE bool jsop_functionthis();
|
||||
MOZ_MUST_USE bool jsop_globalthis();
|
||||
MOZ_MUST_USE bool jsop_typeof();
|
||||
MOZ_MUST_USE bool jsop_toasync();
|
||||
MOZ_MUST_USE bool jsop_toid();
|
||||
MOZ_MUST_USE bool jsop_iter(uint8_t flags);
|
||||
MOZ_MUST_USE bool jsop_itermore();
|
||||
|
|
|
@ -1176,6 +1176,14 @@ LIRGenerator::visitTypeOf(MTypeOf* ins)
|
|||
define(lir, ins);
|
||||
}
|
||||
|
||||
void
|
||||
LIRGenerator::visitToAsync(MToAsync* ins)
|
||||
{
|
||||
LToAsync* lir = new(alloc()) LToAsync(useRegisterAtStart(ins->input()));
|
||||
defineReturn(lir, ins);
|
||||
assignSafepoint(lir, ins);
|
||||
}
|
||||
|
||||
void
|
||||
LIRGenerator::visitToId(MToId* ins)
|
||||
{
|
||||
|
|
|
@ -121,6 +121,7 @@ class LIRGenerator : public LIRGeneratorSpecific
|
|||
void visitObjectGroupDispatch(MObjectGroupDispatch* ins);
|
||||
void visitCompare(MCompare* comp);
|
||||
void visitTypeOf(MTypeOf* ins);
|
||||
void visitToAsync(MToAsync* ins);
|
||||
void visitToId(MToId* ins);
|
||||
void visitBitNot(MBitNot* ins);
|
||||
void visitBitAnd(MBitAnd* ins);
|
||||
|
|
|
@ -5806,6 +5806,21 @@ class MTypeOf
|
|||
}
|
||||
};
|
||||
|
||||
class MToAsync
|
||||
: public MUnaryInstruction,
|
||||
public SingleObjectPolicy::Data
|
||||
{
|
||||
explicit MToAsync(MDefinition* unwrapped)
|
||||
: MUnaryInstruction(unwrapped)
|
||||
{
|
||||
setResultType(MIRType::Object);
|
||||
}
|
||||
|
||||
public:
|
||||
INSTRUCTION_HEADER(ToAsync)
|
||||
TRIVIAL_NEW_WRAPPERS
|
||||
};
|
||||
|
||||
class MToId
|
||||
: public MUnaryInstruction,
|
||||
public BoxInputsPolicy::Data
|
||||
|
|
|
@ -79,6 +79,7 @@ namespace jit {
|
|||
_(CallDirectEval) \
|
||||
_(BitNot) \
|
||||
_(TypeOf) \
|
||||
_(ToAsync) \
|
||||
_(ToId) \
|
||||
_(BitAnd) \
|
||||
_(BitOr) \
|
||||
|
|
|
@ -1593,6 +1593,19 @@ class LTypeOfV : public LInstructionHelper<1, BOX_PIECES, 1>
|
|||
}
|
||||
};
|
||||
|
||||
class LToAsync : public LCallInstructionHelper<1, 1, 0>
|
||||
{
|
||||
public:
|
||||
LIR_HEADER(ToAsync)
|
||||
explicit LToAsync(const LAllocation& input) {
|
||||
setOperand(0, input);
|
||||
}
|
||||
|
||||
const LAllocation* unwrapped() {
|
||||
return getOperand(0);
|
||||
}
|
||||
};
|
||||
|
||||
class LToIdV : public LInstructionHelper<BOX_PIECES, BOX_PIECES, 1>
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -359,6 +359,7 @@
|
|||
_(RunOncePrologue) \
|
||||
_(Rest) \
|
||||
_(TypeOfV) \
|
||||
_(ToAsync) \
|
||||
_(ToIdV) \
|
||||
_(Floor) \
|
||||
_(FloorF) \
|
||||
|
|
Загрузка…
Ссылка в новой задаче