mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-25 16:47:29 +09:00
Issue #1691 - Part 5: Don't pre-create module metadata object when compiling. https://bugzilla.mozilla.org/show_bug.cgi?id=1489477
(cherry picked from commit d83bad49f6b03894548fbf85fc18ad7e8cc19a93)
This commit is contained in:
parent
7a6dab0b38
commit
c965fbdd10
11 changed files with 81 additions and 11 deletions
|
|
@ -1914,7 +1914,6 @@ Fold(ExclusiveContext* cx, ParseNode** pnp, Parser<FullParseHandler>& parser, bo
|
||||||
|
|
||||||
case PNK_CALL_IMPORT: {
|
case PNK_CALL_IMPORT: {
|
||||||
BinaryNode* node = &pn->as<BinaryNode>();
|
BinaryNode* node = &pn->as<BinaryNode>();
|
||||||
MOZ_ASSERT(pn->isArity(PN_BINARY));
|
|
||||||
MOZ_ASSERT(node->left()->isKind(PNK_POSHOLDER));
|
MOZ_ASSERT(node->left()->isKind(PNK_POSHOLDER));
|
||||||
return Fold(cx, node->unsafeRightReference(), parser, inGenexpLambda);
|
return Fold(cx, node->unsafeRightReference(), parser, inGenexpLambda);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4695,17 +4695,27 @@ BaselineCompiler::emit_JSOP_JUMPTARGET()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
typedef JSObject* (*GetOrCreateModuleMetaObjectFn)(JSContext*, HandleObject);
|
||||||
|
static const VMFunction GetOrCreateModuleMetaObjectInfo =
|
||||||
|
FunctionInfo<GetOrCreateModuleMetaObjectFn>(js::GetOrCreateModuleMetaObject,
|
||||||
|
"GetOrCreateModuleMetaObject");
|
||||||
|
|
||||||
bool
|
bool
|
||||||
BaselineCompiler::emit_JSOP_IMPORTMETA()
|
BaselineCompiler::emit_JSOP_IMPORTMETA()
|
||||||
{
|
{
|
||||||
RootedModuleObject module(cx, GetModuleObjectForScript(script));
|
RootedModuleObject module(cx, GetModuleObjectForScript(script));
|
||||||
MOZ_ASSERT(module);
|
MOZ_ASSERT(module);
|
||||||
|
|
||||||
JSObject* metaObject = GetOrCreateModuleMetaObject(cx, module);
|
frame.syncStack(0);
|
||||||
if (!metaObject)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
frame.push(ObjectValue(*metaObject));
|
prepareVMCall();
|
||||||
|
pushArg(ImmGCPtr(module));
|
||||||
|
if (!callVM(GetOrCreateModuleMetaObjectInfo)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
masm.tagValue(JSVAL_TYPE_OBJECT, ReturnReg, R0);
|
||||||
|
frame.push(R0);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2402,6 +2402,18 @@ CodeGenerator::visitNullarySharedStub(LNullarySharedStub* lir)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
typedef JSObject* (*GetOrCreateModuleMetaObjectFn)(JSContext*, HandleObject);
|
||||||
|
static const VMFunction GetOrCreateModuleMetaObjectInfo =
|
||||||
|
FunctionInfo<GetOrCreateModuleMetaObjectFn>(js::GetOrCreateModuleMetaObject,
|
||||||
|
"GetOrCreateModuleMetaObject");
|
||||||
|
|
||||||
|
void
|
||||||
|
CodeGenerator::visitModuleMetadata(LModuleMetadata* lir)
|
||||||
|
{
|
||||||
|
pushArg(ImmPtr(lir->mir()->module()));
|
||||||
|
callVM(GetOrCreateModuleMetaObjectInfo, lir);
|
||||||
|
}
|
||||||
|
|
||||||
typedef JSObject* (*StartDynamicModuleImportFn)(JSContext*, HandleValue, HandleValue);
|
typedef JSObject* (*StartDynamicModuleImportFn)(JSContext*, HandleValue, HandleValue);
|
||||||
static const VMFunction StartDynamicModuleImportInfo =
|
static const VMFunction StartDynamicModuleImportInfo =
|
||||||
FunctionInfo<StartDynamicModuleImportFn>(js::StartDynamicModuleImport,
|
FunctionInfo<StartDynamicModuleImportFn>(js::StartDynamicModuleImport,
|
||||||
|
|
|
||||||
|
|
@ -442,6 +442,7 @@ class CodeGenerator final : public CodeGeneratorSpecific
|
||||||
|
|
||||||
void visitRandom(LRandom* ins);
|
void visitRandom(LRandom* ins);
|
||||||
void visitSignExtend(LSignExtend* ins);
|
void visitSignExtend(LSignExtend* ins);
|
||||||
|
void visitModuleMetadata(LModuleMetadata* lir);
|
||||||
void visitDynamicImport(LDynamicImport* lir);
|
void visitDynamicImport(LDynamicImport* lir);
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
|
|
||||||
|
|
@ -14259,13 +14259,10 @@ IonBuilder::jsop_importmeta()
|
||||||
ModuleObject* module = GetModuleObjectForScript(script());
|
ModuleObject* module = GetModuleObjectForScript(script());
|
||||||
MOZ_ASSERT(module);
|
MOZ_ASSERT(module);
|
||||||
|
|
||||||
// The object must have been created already when we compiled for baseline.
|
MModuleMetadata* meta = MModuleMetadata::New(alloc(), module);
|
||||||
JSObject* metaObject = module->metaObject();
|
current->add(meta);
|
||||||
MOZ_ASSERT(metaObject);
|
current->push(meta);
|
||||||
|
return resumeAfter(meta);
|
||||||
pushConstant(ObjectValue(*metaObject));
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
|
||||||
|
|
@ -2427,6 +2427,14 @@ LIRGenerator::visitNullarySharedStub(MNullarySharedStub* ins)
|
||||||
assignSafepoint(lir, ins);
|
assignSafepoint(lir, ins);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
LIRGenerator::visitModuleMetadata(MModuleMetadata* ins)
|
||||||
|
{
|
||||||
|
LModuleMetadata* lir = new(alloc()) LModuleMetadata();
|
||||||
|
defineReturn(lir, ins);
|
||||||
|
assignSafepoint(lir, ins);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
LIRGenerator::visitDynamicImport(MDynamicImport* ins)
|
LIRGenerator::visitDynamicImport(MDynamicImport* ins)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -334,6 +334,7 @@ class LIRGenerator : public LIRGeneratorSpecific
|
||||||
void visitCheckIsCallable(MCheckIsCallable* ins);
|
void visitCheckIsCallable(MCheckIsCallable* ins);
|
||||||
void visitCheckObjCoercible(MCheckObjCoercible* ins);
|
void visitCheckObjCoercible(MCheckObjCoercible* ins);
|
||||||
void visitDebugCheckSelfHosted(MDebugCheckSelfHosted* ins);
|
void visitDebugCheckSelfHosted(MDebugCheckSelfHosted* ins);
|
||||||
|
void visitModuleMetadata(MModuleMetadata* ins);
|
||||||
void visitDynamicImport(MDynamicImport* ins);
|
void visitDynamicImport(MDynamicImport* ins);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8379,6 +8379,33 @@ class MSubstr
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class MModuleMetadata : public MNullaryInstruction
|
||||||
|
{
|
||||||
|
CompilerObject module_;
|
||||||
|
|
||||||
|
explicit MModuleMetadata(JSObject* module)
|
||||||
|
: module_(module)
|
||||||
|
{
|
||||||
|
setResultType(MIRType::Object);
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
INSTRUCTION_HEADER(ModuleMetadata)
|
||||||
|
TRIVIAL_NEW_WRAPPERS
|
||||||
|
|
||||||
|
JSObject* module() const {
|
||||||
|
return module_;
|
||||||
|
}
|
||||||
|
|
||||||
|
AliasSet getAliasSet() const override {
|
||||||
|
return AliasSet::None();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool appendRoots(MRootList& roots) const override {
|
||||||
|
return roots.append(module_);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
class MDynamicImport : public MBinaryInstruction,
|
class MDynamicImport : public MBinaryInstruction,
|
||||||
public BoxInputsPolicy::Data
|
public BoxInputsPolicy::Data
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -284,6 +284,7 @@ namespace jit {
|
||||||
_(GlobalNameConflictsCheck) \
|
_(GlobalNameConflictsCheck) \
|
||||||
_(Debugger) \
|
_(Debugger) \
|
||||||
_(NewTarget) \
|
_(NewTarget) \
|
||||||
|
_(ModuleMetadata) \
|
||||||
_(DynamicImport) \
|
_(DynamicImport) \
|
||||||
_(ArrowNewTarget) \
|
_(ArrowNewTarget) \
|
||||||
_(CheckReturn) \
|
_(CheckReturn) \
|
||||||
|
|
|
||||||
|
|
@ -4939,6 +4939,19 @@ class LNullarySharedStub : public LCallInstructionHelper<BOX_PIECES, 0, 0>
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class LModuleMetadata : public LCallInstructionHelper<1, 0, 0>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
LIR_HEADER(ModuleMetadata)
|
||||||
|
|
||||||
|
const MModuleMetadata* mir() const {
|
||||||
|
return mir_->toModuleMetadata();
|
||||||
|
}
|
||||||
|
|
||||||
|
LModuleMetadata()
|
||||||
|
{}
|
||||||
|
};
|
||||||
|
|
||||||
class LDynamicImport : public LCallInstructionHelper<1, 2 * BOX_PIECES, 0>
|
class LDynamicImport : public LCallInstructionHelper<1, 2 * BOX_PIECES, 0>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
|
|
@ -401,6 +401,7 @@
|
||||||
_(GlobalNameConflictsCheck) \
|
_(GlobalNameConflictsCheck) \
|
||||||
_(Debugger) \
|
_(Debugger) \
|
||||||
_(NewTarget) \
|
_(NewTarget) \
|
||||||
|
_(ModuleMetadata) \
|
||||||
_(DynamicImport) \
|
_(DynamicImport) \
|
||||||
_(ArrowNewTarget) \
|
_(ArrowNewTarget) \
|
||||||
_(CheckReturn) \
|
_(CheckReturn) \
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue