Title: [201494] trunk/Source/_javascript_Core
- Revision
- 201494
- Author
- [email protected]
- Date
- 2016-05-28 21:47:41 -0700 (Sat, 28 May 2016)
Log Message
JSGlobalLexicalEnvironment leaks SegmentedVector due to lack of destructor.
<https://webkit.org/b/158186>
Reviewed by Saam Barati.
Give JSGlobalLexicalEnvironment a destroy() and set up a finalizer for it
like we do with JSGlobalObject. (This is needed because they don't inherit
from JSDestructibleObjects and thus can't use JSCell::needsDestruction to
ask for allocation in destructor space.)
This stops us from leaking all the SegmentedVector backing stores.
* runtime/JSGlobalLexicalEnvironment.cpp:
(JSC::JSGlobalLexicalEnvironment::destroy):
* runtime/JSGlobalLexicalEnvironment.h:
(JSC::JSGlobalLexicalEnvironment::create):
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (201493 => 201494)
--- trunk/Source/_javascript_Core/ChangeLog 2016-05-29 04:20:06 UTC (rev 201493)
+++ trunk/Source/_javascript_Core/ChangeLog 2016-05-29 04:47:41 UTC (rev 201494)
@@ -1,3 +1,22 @@
+2016-05-28 Andreas Kling <[email protected]>
+
+ JSGlobalLexicalEnvironment leaks SegmentedVector due to lack of destructor.
+ <https://webkit.org/b/158186>
+
+ Reviewed by Saam Barati.
+
+ Give JSGlobalLexicalEnvironment a destroy() and set up a finalizer for it
+ like we do with JSGlobalObject. (This is needed because they don't inherit
+ from JSDestructibleObjects and thus can't use JSCell::needsDestruction to
+ ask for allocation in destructor space.)
+
+ This stops us from leaking all the SegmentedVector backing stores.
+
+ * runtime/JSGlobalLexicalEnvironment.cpp:
+ (JSC::JSGlobalLexicalEnvironment::destroy):
+ * runtime/JSGlobalLexicalEnvironment.h:
+ (JSC::JSGlobalLexicalEnvironment::create):
+
2016-05-28 Skachkov Oleksandr <[email protected]>
[ESNext] Trailing commas in function parameters.
https://bugs.webkit.org/show_bug.cgi?id=158020
Modified: trunk/Source/_javascript_Core/runtime/JSGlobalLexicalEnvironment.cpp (201493 => 201494)
--- trunk/Source/_javascript_Core/runtime/JSGlobalLexicalEnvironment.cpp 2016-05-29 04:20:06 UTC (rev 201493)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalLexicalEnvironment.cpp 2016-05-29 04:47:41 UTC (rev 201494)
@@ -32,6 +32,11 @@
const ClassInfo JSGlobalLexicalEnvironment::s_info = { "JSGlobalLexicalEnvironment", &Base::s_info, 0, CREATE_METHOD_TABLE(JSGlobalLexicalEnvironment) };
+void JSGlobalLexicalEnvironment::destroy(JSCell* cell)
+{
+ static_cast<JSGlobalLexicalEnvironment*>(cell)->JSGlobalLexicalEnvironment::~JSGlobalLexicalEnvironment();
+}
+
bool JSGlobalLexicalEnvironment::getOwnPropertySlot(JSObject* object, ExecState*, PropertyName propertyName, PropertySlot& slot)
{
JSGlobalLexicalEnvironment* thisObject = jsCast<JSGlobalLexicalEnvironment*>(object);
Modified: trunk/Source/_javascript_Core/runtime/JSGlobalLexicalEnvironment.h (201493 => 201494)
--- trunk/Source/_javascript_Core/runtime/JSGlobalLexicalEnvironment.h 2016-05-29 04:20:06 UTC (rev 201493)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalLexicalEnvironment.h 2016-05-29 04:47:41 UTC (rev 201494)
@@ -43,12 +43,17 @@
new (NotNull, allocateCell<JSGlobalLexicalEnvironment>(vm.heap)) JSGlobalLexicalEnvironment(vm, structure, parentScope);
result->finishCreation(vm);
result->symbolTable()->setScopeType(SymbolTable::ScopeType::GlobalLexicalScope);
+ vm.heap.addFinalizer(result, destroy);
return result;
}
static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);
static bool put(JSCell*, ExecState*, PropertyName, JSValue, PutPropertySlot&);
+ static void destroy(JSCell*);
+ // We don't need a destructor because we use a finalizer instead.
+ static const bool needsDestruction = false;
+
bool isEmpty() const { return !symbolTable()->size(); }
bool isConstVariable(UniquedStringImpl*);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes