Commit 53446342 authored by jochen@chromium.org's avatar jochen@chromium.org

Report precise memory usage from StaticNodeList to v8

BUG=none
R=haraken@chromium.org

Review URL: https://codereview.chromium.org/311053004

git-svn-id: svn://svn.chromium.org/blink/trunk@175884 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 9cb5f068
......@@ -38,15 +38,13 @@ PassRefPtrWillBeRawPtr<StaticNodeList> StaticNodeList::adopt(WillBeHeapVector<Re
{
RefPtrWillBeRawPtr<StaticNodeList> nodeList = adoptRefWillBeNoop(new StaticNodeList);
nodeList->m_nodes.swap(nodes);
if (nodeList->AllocationSize() > externalMemoryReportSizeLimit)
v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(nodeList->AllocationSize());
v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(nodeList->AllocationSize());
return nodeList.release();
}
StaticNodeList::~StaticNodeList()
{
if (AllocationSize() > externalMemoryReportSizeLimit)
v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(-AllocationSize());
v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(-AllocationSize());
}
unsigned StaticNodeList::length() const
......
......@@ -56,10 +56,6 @@ public:
virtual void trace(Visitor*) OVERRIDE;
private:
// If AllocationSize() is larger than this, we report it as external
// allocated memory to V8.
const static ptrdiff_t externalMemoryReportSizeLimit = 1024;
ptrdiff_t AllocationSize()
{
return m_nodes.capacity() * sizeof(RefPtrWillBeMember<Node>);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment