зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1382612
- Support default class constructors in Ion. r=tcampbell
This commit is contained in:
Родитель
1efe54ed22
Коммит
a5f725d4f6
|
@ -2584,6 +2584,21 @@ CodeGenerator::visitNullarySharedStub(LNullarySharedStub* lir)
|
|||
}
|
||||
}
|
||||
|
||||
typedef JSFunction* (*MakeDefaultConstructorFn)(JSContext*, HandleScript,
|
||||
jsbytecode*, HandleObject);
|
||||
static const VMFunction MakeDefaultConstructorInfo =
|
||||
FunctionInfo<MakeDefaultConstructorFn>(js::MakeDefaultConstructor,
|
||||
"MakeDefaultConstructor");
|
||||
|
||||
void
|
||||
CodeGenerator::visitClassConstructor(LClassConstructor* lir)
|
||||
{
|
||||
pushArg(ImmPtr(nullptr));
|
||||
pushArg(ImmPtr(lir->mir()->pc()));
|
||||
pushArg(ImmGCPtr(current->mir()->info().script()));
|
||||
callVM(MakeDefaultConstructorInfo, lir);
|
||||
}
|
||||
|
||||
typedef JSObject* (*LambdaFn)(JSContext*, HandleFunction, HandleObject);
|
||||
static const VMFunction LambdaInfo = FunctionInfo<LambdaFn>(js::Lambda, "Lambda");
|
||||
|
||||
|
|
|
@ -137,6 +137,7 @@ class CodeGenerator final : public CodeGeneratorSpecific
|
|||
void visitBinarySharedStub(LBinarySharedStub* lir);
|
||||
void visitUnarySharedStub(LUnarySharedStub* lir);
|
||||
void visitNullarySharedStub(LNullarySharedStub* lir);
|
||||
void visitClassConstructor(LClassConstructor* lir);
|
||||
void visitLambda(LLambda* lir);
|
||||
void visitOutOfLineLambdaArrow(OutOfLineLambdaArrow* ool);
|
||||
void visitLambdaArrow(LLambdaArrow* lir);
|
||||
|
|
|
@ -2226,6 +2226,9 @@ IonBuilder::inspectOpcode(JSOp op)
|
|||
case JSOP_OBJECT:
|
||||
return jsop_object(info().getObject(pc));
|
||||
|
||||
case JSOP_CLASSCONSTRUCTOR:
|
||||
return jsop_classconstructor();
|
||||
|
||||
case JSOP_TYPEOF:
|
||||
case JSOP_TYPEOFEXPR:
|
||||
return jsop_typeof();
|
||||
|
@ -2360,7 +2363,6 @@ IonBuilder::inspectOpcode(JSOp op)
|
|||
case JSOP_OBJWITHPROTO:
|
||||
case JSOP_BUILTINPROTO:
|
||||
case JSOP_INITHOMEOBJECT:
|
||||
case JSOP_CLASSCONSTRUCTOR:
|
||||
case JSOP_DERIVEDCONSTRUCTOR:
|
||||
case JSOP_CHECKTHIS:
|
||||
case JSOP_CHECKRETURN:
|
||||
|
@ -12161,6 +12163,15 @@ IonBuilder::jsop_object(JSObject* obj)
|
|||
return Ok();
|
||||
}
|
||||
|
||||
AbortReasonOr<Ok>
|
||||
IonBuilder::jsop_classconstructor()
|
||||
{
|
||||
MClassConstructor* constructor = MClassConstructor::New(alloc(), pc);
|
||||
current->add(constructor);
|
||||
current->push(constructor);
|
||||
return resumeAfter(constructor);
|
||||
}
|
||||
|
||||
AbortReasonOr<Ok>
|
||||
IonBuilder::jsop_lambda(JSFunction* fun)
|
||||
{
|
||||
|
|
|
@ -563,6 +563,7 @@ class IonBuilder
|
|||
AbortReasonOr<Ok> jsop_initprop_getter_setter(PropertyName* name);
|
||||
AbortReasonOr<Ok> jsop_regexp(RegExpObject* reobj);
|
||||
AbortReasonOr<Ok> jsop_object(JSObject* obj);
|
||||
AbortReasonOr<Ok> jsop_classconstructor();
|
||||
AbortReasonOr<Ok> jsop_lambda(JSFunction* fun);
|
||||
AbortReasonOr<Ok> jsop_lambda_arrow(JSFunction* fun);
|
||||
AbortReasonOr<Ok> jsop_setfunname(uint8_t prefixKind);
|
||||
|
|
|
@ -2505,6 +2505,14 @@ LIRGenerator::visitNullarySharedStub(MNullarySharedStub* ins)
|
|||
assignSafepoint(lir, ins);
|
||||
}
|
||||
|
||||
void
|
||||
LIRGenerator::visitClassConstructor(MClassConstructor* ins)
|
||||
{
|
||||
LClassConstructor* lir = new(alloc()) LClassConstructor();
|
||||
defineReturn(lir, ins);
|
||||
assignSafepoint(lir, ins);
|
||||
}
|
||||
|
||||
void
|
||||
LIRGenerator::visitLambda(MLambda* ins)
|
||||
{
|
||||
|
|
|
@ -185,6 +185,7 @@ class LIRGenerator : public LIRGeneratorSpecific
|
|||
void visitBinarySharedStub(MBinarySharedStub* ins);
|
||||
void visitUnarySharedStub(MUnarySharedStub* ins);
|
||||
void visitNullarySharedStub(MNullarySharedStub* ins);
|
||||
void visitClassConstructor(MClassConstructor* ins);
|
||||
void visitLambda(MLambda* ins);
|
||||
void visitLambdaArrow(MLambdaArrow* ins);
|
||||
void visitSetFunName(MSetFunName* ins);
|
||||
|
|
|
@ -8486,6 +8486,29 @@ class MSubstr
|
|||
}
|
||||
};
|
||||
|
||||
class MClassConstructor : public MNullaryInstruction
|
||||
{
|
||||
jsbytecode* pc_;
|
||||
|
||||
explicit MClassConstructor(jsbytecode* pc)
|
||||
: pc_(pc)
|
||||
{
|
||||
setResultType(MIRType::Object);
|
||||
}
|
||||
|
||||
public:
|
||||
INSTRUCTION_HEADER(ClassConstructor)
|
||||
TRIVIAL_NEW_WRAPPERS
|
||||
|
||||
jsbytecode* pc() const {
|
||||
return pc_;
|
||||
}
|
||||
|
||||
AliasSet getAliasSet() const override {
|
||||
return AliasSet::None();
|
||||
}
|
||||
};
|
||||
|
||||
struct LambdaFunctionInfo
|
||||
{
|
||||
// The functions used in lambdas are the canonical original function in
|
||||
|
|
|
@ -161,6 +161,7 @@ namespace jit {
|
|||
_(RegExpInstanceOptimizable) \
|
||||
_(GetFirstDollarIndex) \
|
||||
_(StringReplace) \
|
||||
_(ClassConstructor) \
|
||||
_(Lambda) \
|
||||
_(LambdaArrow) \
|
||||
_(SetFunName) \
|
||||
|
|
|
@ -4987,6 +4987,16 @@ class LNullarySharedStub : public LCallInstructionHelper<BOX_PIECES, 0, 0>
|
|||
}
|
||||
};
|
||||
|
||||
class LClassConstructor : public LCallInstructionHelper<1, 0, 0>
|
||||
{
|
||||
public:
|
||||
LIR_HEADER(ClassConstructor)
|
||||
|
||||
const MClassConstructor* mir() const {
|
||||
return mir_->toClassConstructor();
|
||||
}
|
||||
};
|
||||
|
||||
class LLambdaForSingleton : public LCallInstructionHelper<1, 1, 0>
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -239,6 +239,7 @@
|
|||
_(BinarySharedStub) \
|
||||
_(UnarySharedStub) \
|
||||
_(NullarySharedStub) \
|
||||
_(ClassConstructor) \
|
||||
_(Lambda) \
|
||||
_(LambdaArrow) \
|
||||
_(LambdaForSingleton) \
|
||||
|
|
Загрузка…
Ссылка в новой задаче