mirror of
https://github.com/oven-sh/bun
synced 2026-02-15 21:32:05 +00:00
Merge branch 'main' into pfg/only-parse-twice
This commit is contained in:
@@ -1016,11 +1016,13 @@ void JSCommonJSModule::visitChildrenImpl(JSCell* cell, Visitor& visitor)
|
||||
JSCommonJSModule* thisObject = jsCast<JSCommonJSModule*>(cell);
|
||||
ASSERT_GC_OBJECT_INHERITS(thisObject, info());
|
||||
Base::visitChildren(thisObject, visitor);
|
||||
visitor.append(thisObject->m_id);
|
||||
visitor.append(thisObject->m_filename);
|
||||
visitor.append(thisObject->m_dirname);
|
||||
visitor.append(thisObject->m_paths);
|
||||
visitor.append(thisObject->m_overridenParent);
|
||||
|
||||
// Use appendHidden so it doesn't show up in the heap snapshot twice.
|
||||
visitor.appendHidden(thisObject->m_id);
|
||||
visitor.appendHidden(thisObject->m_filename);
|
||||
visitor.appendHidden(thisObject->m_dirname);
|
||||
visitor.appendHidden(thisObject->m_paths);
|
||||
visitor.appendHidden(thisObject->m_overridenParent);
|
||||
}
|
||||
|
||||
DEFINE_VISIT_CHILDREN(JSCommonJSModule);
|
||||
@@ -1029,18 +1031,43 @@ void JSCommonJSModule::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer)
|
||||
{
|
||||
auto* thisObject = jsCast<JSCommonJSModule*>(cell);
|
||||
|
||||
if (auto* id = thisObject->m_id.get()) {
|
||||
if (!id->isRope()) {
|
||||
auto label = id->tryGetValue(false);
|
||||
analyzer.setLabelForCell(cell, makeString("CommonJS Module: "_s, StringView(label)));
|
||||
} else {
|
||||
analyzer.setLabelForCell(cell, "CommonJS Module"_s);
|
||||
}
|
||||
} else {
|
||||
analyzer.setLabelForCell(cell, "CommonJS Module"_s);
|
||||
}
|
||||
analyzer.setLabelForCell(cell, "Module (CommonJS)"_s);
|
||||
|
||||
Base::analyzeHeap(cell, analyzer);
|
||||
auto& vm = cell->vm();
|
||||
auto& builtinNames = Bun::builtinNames(vm);
|
||||
if (auto* id = thisObject->m_id.get()) {
|
||||
analyzer.analyzePropertyNameEdge(cell, id, vm.propertyNames->id.impl());
|
||||
}
|
||||
|
||||
if (thisObject->m_filename) {
|
||||
JSValue filename = thisObject->m_filename.get();
|
||||
if (filename.isCell()) {
|
||||
analyzer.analyzePropertyNameEdge(cell, filename.asCell(), builtinNames.filenamePublicName().impl());
|
||||
}
|
||||
}
|
||||
|
||||
if (thisObject->m_dirname) {
|
||||
JSValue dirname = thisObject->m_dirname.get();
|
||||
if (dirname.isCell()) {
|
||||
analyzer.analyzePropertyNameEdge(cell, dirname.asCell(), builtinNames.dirnamePublicName().impl());
|
||||
}
|
||||
}
|
||||
|
||||
if (thisObject->m_paths) {
|
||||
JSValue paths = thisObject->m_paths.get();
|
||||
if (paths.isCell()) {
|
||||
analyzer.analyzePropertyNameEdge(cell, paths.asCell(), builtinNames.pathsPublicName().impl());
|
||||
}
|
||||
}
|
||||
|
||||
if (thisObject->m_overridenParent) {
|
||||
JSValue overridenParent = thisObject->m_overridenParent.get();
|
||||
if (overridenParent.isCell()) {
|
||||
const Identifier overridenParentIdentifier = Identifier::fromString(vm, "parent"_s);
|
||||
analyzer.analyzePropertyNameEdge(cell, overridenParent.asCell(), overridenParentIdentifier.impl());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const JSC::ClassInfo JSCommonJSModule::s_info = { "Module"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSCommonJSModule) };
|
||||
|
||||
Reference in New Issue
Block a user