зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1331092 - Part 8: Support JSOP_TOASYNCITER in JIT. r=jandem
This commit is contained in:
Родитель
0d535229d3
Коммит
ec1bf94ed6
|
@ -3945,6 +3945,28 @@ BaselineCompiler::emit_JSOP_TOASYNCGEN()
|
|||
return true;
|
||||
}
|
||||
|
||||
typedef JSObject* (*ToAsyncIterFn)(JSContext*, HandleObject);
|
||||
static const VMFunction ToAsyncIterInfo =
|
||||
FunctionInfo<ToAsyncIterFn>(js::CreateAsyncFromSyncIterator, "ToAsyncIter");
|
||||
|
||||
bool
|
||||
BaselineCompiler::emit_JSOP_TOASYNCITER()
|
||||
{
|
||||
frame.syncStack(0);
|
||||
masm.unboxObject(frame.addressOfStackValue(frame.peek(-1)), R0.scratchReg());
|
||||
|
||||
prepareVMCall();
|
||||
pushArg(R0.scratchReg());
|
||||
|
||||
if (!callVM(ToAsyncIterInfo))
|
||||
return false;
|
||||
|
||||
masm.tagValue(JSVAL_TYPE_OBJECT, ReturnReg, R0);
|
||||
frame.pop();
|
||||
frame.push(R0);
|
||||
return true;
|
||||
}
|
||||
|
||||
typedef bool (*ThrowObjectCoercibleFn)(JSContext*, HandleValue);
|
||||
static const VMFunction ThrowObjectCoercibleInfo =
|
||||
FunctionInfo<ThrowObjectCoercibleFn>(ThrowObjectCoercible, "ThrowObjectCoercible");
|
||||
|
|
|
@ -198,6 +198,7 @@ namespace jit {
|
|||
_(JSOP_REST) \
|
||||
_(JSOP_TOASYNC) \
|
||||
_(JSOP_TOASYNCGEN) \
|
||||
_(JSOP_TOASYNCITER) \
|
||||
_(JSOP_TOID) \
|
||||
_(JSOP_TOSTRING) \
|
||||
_(JSOP_TABLESWITCH) \
|
||||
|
|
|
@ -10708,6 +10708,17 @@ CodeGenerator::visitToAsyncGen(LToAsyncGen* lir)
|
|||
callVM(ToAsyncGenInfo, lir);
|
||||
}
|
||||
|
||||
typedef JSObject* (*ToAsyncIterFn)(JSContext*, HandleObject);
|
||||
static const VMFunction ToAsyncIterInfo =
|
||||
FunctionInfo<ToAsyncIterFn>(js::CreateAsyncFromSyncIterator, "ToAsyncIter");
|
||||
|
||||
void
|
||||
CodeGenerator::visitToAsyncIter(LToAsyncIter* lir)
|
||||
{
|
||||
pushArg(ToRegister(lir->unwrapped()));
|
||||
callVM(ToAsyncIterInfo, lir);
|
||||
}
|
||||
|
||||
typedef bool (*ToIdFn)(JSContext*, HandleScript, jsbytecode*, HandleValue,
|
||||
MutableHandleValue);
|
||||
static const VMFunction ToIdInfo = FunctionInfo<ToIdFn>(ToIdOperation, "ToIdOperation");
|
||||
|
|
|
@ -297,6 +297,7 @@ class CodeGenerator final : public CodeGeneratorSpecific
|
|||
void visitOutOfLineTypeOfV(OutOfLineTypeOfV* ool);
|
||||
void visitToAsync(LToAsync* lir);
|
||||
void visitToAsyncGen(LToAsyncGen* lir);
|
||||
void visitToAsyncIter(LToAsyncIter* lir);
|
||||
void visitToIdV(LToIdV* lir);
|
||||
template<typename T> void emitLoadElementT(LLoadElementT* lir, const T& source);
|
||||
void visitLoadElementT(LLoadElementT* lir);
|
||||
|
|
|
@ -2215,6 +2215,9 @@ IonBuilder::inspectOpcode(JSOp op)
|
|||
case JSOP_TOASYNCGEN:
|
||||
return jsop_toasyncgen();
|
||||
|
||||
case JSOP_TOASYNCITER:
|
||||
return jsop_toasynciter();
|
||||
|
||||
case JSOP_TOID:
|
||||
return jsop_toid();
|
||||
|
||||
|
@ -12274,6 +12277,20 @@ IonBuilder::jsop_toasyncgen()
|
|||
return resumeAfter(ins);
|
||||
}
|
||||
|
||||
AbortReasonOr<Ok>
|
||||
IonBuilder::jsop_toasynciter()
|
||||
{
|
||||
MDefinition* unwrapped = current->pop();
|
||||
MOZ_ASSERT(unwrapped->type() == MIRType::Object);
|
||||
|
||||
MToAsyncIter* ins = MToAsyncIter::New(alloc(), unwrapped);
|
||||
|
||||
current->add(ins);
|
||||
current->push(ins);
|
||||
|
||||
return resumeAfter(ins);
|
||||
}
|
||||
|
||||
AbortReasonOr<Ok>
|
||||
IonBuilder::jsop_toid()
|
||||
{
|
||||
|
|
|
@ -570,6 +570,7 @@ class IonBuilder
|
|||
AbortReasonOr<Ok> jsop_typeof();
|
||||
AbortReasonOr<Ok> jsop_toasync();
|
||||
AbortReasonOr<Ok> jsop_toasyncgen();
|
||||
AbortReasonOr<Ok> jsop_toasynciter();
|
||||
AbortReasonOr<Ok> jsop_toid();
|
||||
AbortReasonOr<Ok> jsop_iter(uint8_t flags);
|
||||
AbortReasonOr<Ok> jsop_itermore();
|
||||
|
|
|
@ -1218,6 +1218,14 @@ LIRGenerator::visitToAsyncGen(MToAsyncGen* ins)
|
|||
assignSafepoint(lir, ins);
|
||||
}
|
||||
|
||||
void
|
||||
LIRGenerator::visitToAsyncIter(MToAsyncIter* ins)
|
||||
{
|
||||
LToAsyncIter* lir = new(alloc()) LToAsyncIter(useRegisterAtStart(ins->input()));
|
||||
defineReturn(lir, ins);
|
||||
assignSafepoint(lir, ins);
|
||||
}
|
||||
|
||||
void
|
||||
LIRGenerator::visitToId(MToId* ins)
|
||||
{
|
||||
|
|
|
@ -122,6 +122,7 @@ class LIRGenerator : public LIRGeneratorSpecific
|
|||
void visitTypeOf(MTypeOf* ins);
|
||||
void visitToAsync(MToAsync* ins);
|
||||
void visitToAsyncGen(MToAsyncGen* ins);
|
||||
void visitToAsyncIter(MToAsyncIter* ins);
|
||||
void visitToId(MToId* ins);
|
||||
void visitBitNot(MBitNot* ins);
|
||||
void visitBitAnd(MBitAnd* ins);
|
||||
|
|
|
@ -5840,6 +5840,21 @@ class MToAsyncGen
|
|||
TRIVIAL_NEW_WRAPPERS
|
||||
};
|
||||
|
||||
class MToAsyncIter
|
||||
: public MUnaryInstruction,
|
||||
public SingleObjectPolicy::Data
|
||||
{
|
||||
explicit MToAsyncIter(MDefinition* unwrapped)
|
||||
: MUnaryInstruction(unwrapped)
|
||||
{
|
||||
setResultType(MIRType::Object);
|
||||
}
|
||||
|
||||
public:
|
||||
INSTRUCTION_HEADER(ToAsyncIter)
|
||||
TRIVIAL_NEW_WRAPPERS
|
||||
};
|
||||
|
||||
class MToId
|
||||
: public MUnaryInstruction,
|
||||
public BoxInputsPolicy::Data
|
||||
|
|
|
@ -80,6 +80,7 @@ namespace jit {
|
|||
_(TypeOf) \
|
||||
_(ToAsync) \
|
||||
_(ToAsyncGen) \
|
||||
_(ToAsyncIter) \
|
||||
_(ToId) \
|
||||
_(BitAnd) \
|
||||
_(BitOr) \
|
||||
|
|
|
@ -1631,6 +1631,19 @@ class LToAsyncGen : public LCallInstructionHelper<1, 1, 0>
|
|||
}
|
||||
};
|
||||
|
||||
class LToAsyncIter : public LCallInstructionHelper<1, 1, 0>
|
||||
{
|
||||
public:
|
||||
LIR_HEADER(ToAsyncIter)
|
||||
explicit LToAsyncIter(const LAllocation& input) {
|
||||
setOperand(0, input);
|
||||
}
|
||||
|
||||
const LAllocation* unwrapped() {
|
||||
return getOperand(0);
|
||||
}
|
||||
};
|
||||
|
||||
class LToIdV : public LInstructionHelper<BOX_PIECES, BOX_PIECES, 1>
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -364,6 +364,7 @@
|
|||
_(TypeOfV) \
|
||||
_(ToAsync) \
|
||||
_(ToAsyncGen) \
|
||||
_(ToAsyncIter) \
|
||||
_(ToIdV) \
|
||||
_(Floor) \
|
||||
_(FloorF) \
|
||||
|
|
Загрузка…
Ссылка в новой задаче