Bug 1687973 - Part 7: Remove ModuleObject::fixEnvironmentsAfterRealmMerge. r=tcampbell

Differential Revision: https://phabricator.services.mozilla.com/D131361
This commit is contained in:
Tooru Fujisawa 2021-11-19 04:43:05 +00:00
Родитель 3cdeb2e290
Коммит 4887469061
4 изменённых файлов: 0 добавлений и 24 удалений

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

@ -407,9 +407,6 @@ void IndirectBindingMap::trace(JSTracer* trc) {
bool IndirectBindingMap::put(JSContext* cx, HandleId name, bool IndirectBindingMap::put(JSContext* cx, HandleId name,
HandleModuleEnvironmentObject environment, HandleModuleEnvironmentObject environment,
HandleId targetName) { HandleId targetName) {
// This object might have been allocated on the background parsing thread in
// different zone to the final module. Lazily allocate the map so we don't
// have to switch its zone when merging realms.
if (!map_) { if (!map_) {
MOZ_ASSERT(!cx->zone()->createdForHelperThread()); MOZ_ASSERT(!cx->zone()->createdForHelperThread());
map_.emplace(cx->zone()); map_.emplace(cx->zone());
@ -1017,19 +1014,6 @@ static inline bool CheckObjectPropertyFrozen(JSContext* cx,
#endif #endif
inline static void AssertModuleScopesMatch(ModuleObject* module) {
MOZ_ASSERT(module->enclosingScope()->is<GlobalScope>());
MOZ_ASSERT(IsGlobalLexicalEnvironment(
&module->initialEnvironment().enclosingEnvironment()));
}
void ModuleObject::fixEnvironmentsAfterRealmMerge() {
AssertModuleScopesMatch(this);
initialEnvironment().fixEnclosingEnvironmentAfterRealmMerge(
script()->global());
AssertModuleScopesMatch(this);
}
JSScript* ModuleObject::maybeScript() const { JSScript* ModuleObject::maybeScript() const {
Value value = getReservedSlot(ScriptSlot); Value value = getReservedSlot(ScriptSlot);
if (value.isUndefined()) { if (value.isUndefined()) {

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

@ -330,7 +330,6 @@ class ModuleObject : public NativeObject {
#ifdef DEBUG #ifdef DEBUG
static bool AssertFrozen(JSContext* cx, HandleModuleObject self); static bool AssertFrozen(JSContext* cx, HandleModuleObject self);
#endif #endif
void fixEnvironmentsAfterRealmMerge();
JSScript* maybeScript() const; JSScript* maybeScript() const;
JSScript* script() const; JSScript* script() const;

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

@ -464,11 +464,6 @@ bool ModuleEnvironmentObject::lookupImport(
return importBindings().lookup(name, envOut, propOut); return importBindings().lookup(name, envOut, propOut);
} }
void ModuleEnvironmentObject::fixEnclosingEnvironmentAfterRealmMerge(
GlobalObject& global) {
setEnclosingEnvironment(&global.lexicalEnvironment());
}
/* static */ /* static */
bool ModuleEnvironmentObject::lookupProperty(JSContext* cx, HandleObject obj, bool ModuleEnvironmentObject::lookupProperty(JSContext* cx, HandleObject obj,
HandleId id, HandleId id,

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

@ -447,8 +447,6 @@ class ModuleEnvironmentObject : public EnvironmentObject {
bool lookupImport(jsid name, ModuleEnvironmentObject** envOut, bool lookupImport(jsid name, ModuleEnvironmentObject** envOut,
mozilla::Maybe<PropertyInfo>* propOut); mozilla::Maybe<PropertyInfo>* propOut);
void fixEnclosingEnvironmentAfterRealmMerge(GlobalObject& global);
private: private:
static bool lookupProperty(JSContext* cx, HandleObject obj, HandleId id, static bool lookupProperty(JSContext* cx, HandleObject obj, HandleId id,
MutableHandleObject objp, PropertyResult* propp); MutableHandleObject objp, PropertyResult* propp);