diff options
author | 2022-08-12 18:07:51 +0800 | |
---|---|---|
committer | 2022-08-12 03:07:51 -0700 | |
commit | 1dce0b2af1a9efbe917e7ba884f02fc3edfd8e86 (patch) | |
tree | 2f319de8978117503afd5a3eda46d12ac6e08691 /src/bun.js/bindings/sqlite/JSSQLStatement.cpp | |
parent | c33f39b39cf866363e3a50e8897ed72eba4d1eda (diff) | |
download | bun-1dce0b2af1a9efbe917e7ba884f02fc3edfd8e86.tar.gz bun-1dce0b2af1a9efbe917e7ba884f02fc3edfd8e86.tar.zst bun-1dce0b2af1a9efbe917e7ba884f02fc3edfd8e86.zip |
remove column name caches in js (#1057)
Diffstat (limited to 'src/bun.js/bindings/sqlite/JSSQLStatement.cpp')
-rw-r--r-- | src/bun.js/bindings/sqlite/JSSQLStatement.cpp | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/src/bun.js/bindings/sqlite/JSSQLStatement.cpp b/src/bun.js/bindings/sqlite/JSSQLStatement.cpp index 9e0c4b182..063d328e6 100644 --- a/src/bun.js/bindings/sqlite/JSSQLStatement.cpp +++ b/src/bun.js/bindings/sqlite/JSSQLStatement.cpp @@ -146,7 +146,6 @@ public: uint64_t version; bool hasExecuted = false; std::unique_ptr<PropertyNameArray> columnNames; - mutable WriteBarrier<JSC::JSArray> _columnNames; mutable WriteBarrier<JSC::JSObject> _prototype; protected: @@ -155,7 +154,6 @@ protected: , stmt(stmt) , version_db(version_db) , columnNames(new PropertyNameArray(globalObject.vm(), PropertyNameMode::Strings, PrivateSymbolMode::Exclude)) - , _columnNames(globalObject.vm(), this, nullptr) , _prototype(globalObject.vm(), this, nullptr) {} void finishCreation(JSC::VM&); @@ -1331,19 +1329,15 @@ JSC_DEFINE_CUSTOM_GETTER(jsSqlStatementGetColumnNames, (JSGlobalObject * lexical auto scope = DECLARE_THROW_SCOPE(vm); CHECK_THIS - auto* array = castedThis->_columnNames.get(); - if (!castedThis->hasExecuted || castedThis->need_update() || array == nullptr) { + if (!castedThis->hasExecuted || castedThis->need_update()) { initializeColumnNames(lexicalGlobalObject, castedThis); - - if (castedThis->columnNames->size() > 0) { - array = ownPropertyKeys(lexicalGlobalObject, castedThis->_prototype.get(), PropertyNameMode::Strings, DontEnumPropertiesMode::Exclude, CachedPropertyNamesKind::Keys); - } else { - array = JSC::constructEmptyArray(lexicalGlobalObject, nullptr, 0); - } - - castedThis->_columnNames.set(vm, castedThis, array); } - + JSC::JSArray* array; + if (castedThis->columnNames->size() > 0) { + array = ownPropertyKeys(lexicalGlobalObject, castedThis->_prototype.get(), PropertyNameMode::Strings, DontEnumPropertiesMode::Exclude, CachedPropertyNamesKind::Keys); + } else { + array = JSC::constructEmptyArray(lexicalGlobalObject, nullptr, 0); + } return JSC::JSValue::encode(array); } @@ -1431,7 +1425,6 @@ void JSSQLStatement::visitChildrenImpl(JSCell* cell, Visitor& visitor) JSSQLStatement* thisObject = jsCast<JSSQLStatement*>(cell); ASSERT_GC_OBJECT_INHERITS(thisObject, info()); Base::visitChildren(thisObject, visitor); - visitor.append(thisObject->_columnNames); visitor.append(thisObject->_prototype); } |