From 7818859fb98601a3957a1a502b9096bbb63c578e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bargull?= Date: Wed, 27 Nov 2019 13:55:52 +0000 Subject: [PATCH] Bug 1599416 - Part 7: Remove unused lazyArrayBuffers table. r=mgaudet Entries are never added to `lazyArrayBuffers` resp. `lazyArrayBuffers` isn't even allocated anymore. Differential Revision: https://phabricator.services.mozilla.com/D54711 --HG-- extra : moz-landing-system : lando --- js/public/MemoryMetrics.h | 1 - js/src/builtin/TypedObject.cpp | 7 ------- js/src/vm/MemoryMetrics.cpp | 6 +++--- js/src/vm/Realm.cpp | 23 +++++------------------ js/src/vm/Realm.h | 22 +++++++++------------- js/xpconnect/src/XPCJSRuntime.cpp | 4 ---- 6 files changed, 17 insertions(+), 46 deletions(-) diff --git a/js/public/MemoryMetrics.h b/js/public/MemoryMetrics.h index d2a6e14420e0..e2dedd75a4e7 100644 --- a/js/public/MemoryMetrics.h +++ b/js/public/MemoryMetrics.h @@ -730,7 +730,6 @@ struct RealmStats { MACRO(Other, MallocHeap, realmObject) \ MACRO(Other, MallocHeap, realmTables) \ MACRO(Other, MallocHeap, innerViewsTable) \ - MACRO(Other, MallocHeap, lazyArrayBuffersTable) \ MACRO(Other, MallocHeap, objectMetadataTable) \ MACRO(Other, MallocHeap, savedStacksSet) \ MACRO(Other, MallocHeap, varNamesSet) \ diff --git a/js/src/builtin/TypedObject.cpp b/js/src/builtin/TypedObject.cpp index 07981bacf10b..fa4c50396f00 100644 --- a/js/src/builtin/TypedObject.cpp +++ b/js/src/builtin/TypedObject.cpp @@ -1515,13 +1515,6 @@ uint8_t* TypedObject::typedMemBase() const { bool TypedObject::isAttached() const { if (is()) { - ObjectWeakMap* table = ObjectRealm::get(this).lazyArrayBuffers.get(); - if (table) { - JSObject* buffer = table->lookup(this); - if (buffer) { - return !buffer->as().isDetached(); - } - } return true; } if (is()) { diff --git a/js/src/vm/MemoryMetrics.cpp b/js/src/vm/MemoryMetrics.cpp index 4f864681bb0b..9da17539481e 100644 --- a/js/src/vm/MemoryMetrics.cpp +++ b/js/src/vm/MemoryMetrics.cpp @@ -240,9 +240,9 @@ static void StatsRealmCallback(JSContext* cx, void* data, &realmStats.typeInferenceArrayTypeTables, &realmStats.typeInferenceObjectTypeTables, &realmStats.realmObject, &realmStats.realmTables, &realmStats.innerViewsTable, - &realmStats.lazyArrayBuffersTable, &realmStats.objectMetadataTable, - &realmStats.savedStacksSet, &realmStats.varNamesSet, - &realmStats.nonSyntacticLexicalScopesTable, &realmStats.jitRealm); + &realmStats.objectMetadataTable, &realmStats.savedStacksSet, + &realmStats.varNamesSet, &realmStats.nonSyntacticLexicalScopesTable, + &realmStats.jitRealm); } static void StatsArenaCallback(JSRuntime* rt, void* data, gc::Arena* arena, diff --git a/js/src/vm/Realm.cpp b/js/src/vm/Realm.cpp index 201d18a24f16..f6338823f04e 100644 --- a/js/src/vm/Realm.cpp +++ b/js/src/vm/Realm.cpp @@ -276,10 +276,6 @@ void Realm::traceGlobal(JSTracer* trc) { } void ObjectRealm::trace(JSTracer* trc) { - if (lazyArrayBuffers) { - lazyArrayBuffers->trace(trc); - } - if (objectMetadataTable) { objectMetadataTable->trace(trc); } @@ -324,10 +320,6 @@ void Realm::traceRoots(JSTracer* trc, } void ObjectRealm::finishRoots() { - if (lazyArrayBuffers) { - lazyArrayBuffers->clear(); - } - if (objectMetadataTable) { objectMetadataTable->clear(); } @@ -739,14 +731,10 @@ void Realm::collectCodeCoverageInfo(JSScript* script, const char* name) { void ObjectRealm::addSizeOfExcludingThis( mozilla::MallocSizeOf mallocSizeOf, size_t* innerViewsArg, - size_t* lazyArrayBuffersArg, size_t* objectMetadataTablesArg, + size_t* objectMetadataTablesArg, size_t* nonSyntacticLexicalEnvironmentsArg) { *innerViewsArg += innerViews.sizeOfExcludingThis(mallocSizeOf); - if (lazyArrayBuffers) { - *lazyArrayBuffersArg += lazyArrayBuffers->sizeOfIncludingThis(mallocSizeOf); - } - if (objectMetadataTable) { *objectMetadataTablesArg += objectMetadataTable->sizeOfIncludingThis(mallocSizeOf); @@ -761,10 +749,9 @@ void ObjectRealm::addSizeOfExcludingThis( void Realm::addSizeOfIncludingThis( mozilla::MallocSizeOf mallocSizeOf, size_t* tiAllocationSiteTables, size_t* tiArrayTypeTables, size_t* tiObjectTypeTables, size_t* realmObject, - size_t* realmTables, size_t* innerViewsArg, size_t* lazyArrayBuffersArg, - size_t* objectMetadataTablesArg, size_t* savedStacksSet, - size_t* varNamesSet, size_t* nonSyntacticLexicalEnvironmentsArg, - size_t* jitRealm) { + size_t* realmTables, size_t* innerViewsArg, size_t* objectMetadataTablesArg, + size_t* savedStacksSet, size_t* varNamesSet, + size_t* nonSyntacticLexicalEnvironmentsArg, size_t* jitRealm) { *realmObject += mallocSizeOf(this); objectGroups_.addSizeOfExcludingThis(mallocSizeOf, tiAllocationSiteTables, tiArrayTypeTables, tiObjectTypeTables, @@ -772,7 +759,7 @@ void Realm::addSizeOfIncludingThis( wasm.addSizeOfExcludingThis(mallocSizeOf, realmTables); objects_.addSizeOfExcludingThis(mallocSizeOf, innerViewsArg, - lazyArrayBuffersArg, objectMetadataTablesArg, + objectMetadataTablesArg, nonSyntacticLexicalEnvironmentsArg); *savedStacksSet += savedStacks_.sizeOfExcludingThis(mallocSizeOf); diff --git a/js/src/vm/Realm.h b/js/src/vm/Realm.h index 10b842b0223c..5b79fcab7291 100644 --- a/js/src/vm/Realm.h +++ b/js/src/vm/Realm.h @@ -248,11 +248,6 @@ class ObjectRealm { // Map from array buffers to views sharing that storage. JS::WeakCache innerViews; - // Inline transparent typed objects do not initially have an array buffer, - // but can have that buffer created lazily if it is accessed later. This - // table manages references from such typed objects to their buffers. - js::UniquePtr lazyArrayBuffers; - // Keep track of the metadata objects which can be associated with each JS // object. Both keys and values are in this realm. js::UniquePtr objectMetadataTable; @@ -276,7 +271,6 @@ class ObjectRealm { void addSizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf, size_t* innerViewsArg, - size_t* lazyArrayBuffersArg, size_t* objectMetadataTablesArg, size_t* nonSyntacticLexicalEnvironmentsArg); @@ -467,13 +461,15 @@ class JS::Realm : public JS::shadow::Realm { void destroy(JSFreeOp* fop); void clearTables(); - void addSizeOfIncludingThis( - mozilla::MallocSizeOf mallocSizeOf, size_t* tiAllocationSiteTables, - size_t* tiArrayTypeTables, size_t* tiObjectTypeTables, - size_t* realmObject, size_t* realmTables, size_t* innerViewsArg, - size_t* lazyArrayBuffersArg, size_t* objectMetadataTablesArg, - size_t* savedStacksSet, size_t* varNamesSet, - size_t* nonSyntacticLexicalEnvironmentsArg, size_t* jitRealm); + void addSizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf, + size_t* tiAllocationSiteTables, + size_t* tiArrayTypeTables, + size_t* tiObjectTypeTables, size_t* realmObject, + size_t* realmTables, size_t* innerViewsArg, + size_t* objectMetadataTablesArg, + size_t* savedStacksSet, size_t* varNamesSet, + size_t* nonSyntacticLexicalEnvironmentsArg, + size_t* jitRealm); JS::Zone* zone() { return zone_; } const JS::Zone* zone() const { return zone_; } diff --git a/js/xpconnect/src/XPCJSRuntime.cpp b/js/xpconnect/src/XPCJSRuntime.cpp index 71f11003350d..2b43433d07cc 100644 --- a/js/xpconnect/src/XPCJSRuntime.cpp +++ b/js/xpconnect/src/XPCJSRuntime.cpp @@ -1895,10 +1895,6 @@ static void ReportRealmStats(const JS::RealmStats& realmStats, realmStats.innerViewsTable, "The table for array buffer inner views."); - ZRREPORT_BYTES(realmJSPathPrefix + NS_LITERAL_CSTRING("lazy-array-buffers"), - realmStats.lazyArrayBuffersTable, - "The table for typed object lazy array buffers."); - ZRREPORT_BYTES( realmJSPathPrefix + NS_LITERAL_CSTRING("object-metadata"), realmStats.objectMetadataTable,