Reviewers: yurys, loislo, Dmitry Lomov (chromium),
Message:
Please take a look.
Description:
Make a single HeapEntry per single JSArrayBuffer data in heap snapshot.
It turned out that JSArrayBuffer's may share their backing_store so
the backing_store should go through hash map registration just like
other heap objects, so they won't be reported twice.
BUG=341741
LOG=N
Please review this at https://codereview.chromium.org/166993002/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+24, -8 lines):
M src/heap-snapshot-generator.h
M src/heap-snapshot-generator.cc
Index: src/heap-snapshot-generator.cc
diff --git a/src/heap-snapshot-generator.cc b/src/heap-snapshot-generator.cc
index
71362ffc0d36b4a2dc4c405762aea6a270136c5b..2279f0db7babbc8b0f1642e6ee70b10b86e40a06
100644
--- a/src/heap-snapshot-generator.cc
+++ b/src/heap-snapshot-generator.cc
@@ -1456,6 +1456,23 @@ void
V8HeapExplorer::ExtractAllocationSiteReferences(int entry,
}
+class JSArrayBufferDataEntryAllocator : public HeapEntriesAllocator {
+ public:
+ JSArrayBufferDataEntryAllocator(int size, V8HeapExplorer* explorer)
+ : size_(size)
+ , explorer_(explorer) {
+ }
+ virtual HeapEntry* AllocateEntry(HeapThing ptr) {
+ return explorer_->AddEntry(
+ static_cast<Address>(ptr),
+ HeapEntry::kNative, "system / JSArrayBufferData", size_);
+ }
+ private:
+ int size_;
+ V8HeapExplorer* explorer_;
+};
+
+
void V8HeapExplorer::ExtractJSArrayBufferReferences(
int entry, JSArrayBuffer* buffer) {
SetWeakReference(buffer, entry, "weak_next", buffer->weak_next(),
@@ -1466,10 +1483,9 @@ void V8HeapExplorer::ExtractJSArrayBufferReferences(
// Setup a reference to a native memory backing_store object.
size_t data_size = NumberToSize(heap_->isolate(), buffer->byte_length());
CHECK(data_size <= static_cast<size_t>(kMaxInt));
- HeapEntry* data_entry = AddEntry(
- static_cast<Address>(buffer->backing_store()),
- HeapEntry::kNative, "system / ArrayBufferData",
- static_cast<int>(data_size));
+ JSArrayBufferDataEntryAllocator allocator(static_cast<int>(data_size),
this);
+ HeapEntry* data_entry =
+ filler_->FindOrAddEntry(buffer->backing_store(), &allocator);
filler_->SetNamedReference(HeapGraphEdge::kInternal,
entry, "backing_store", data_entry);
}
Index: src/heap-snapshot-generator.h
diff --git a/src/heap-snapshot-generator.h b/src/heap-snapshot-generator.h
index
9ea366e6c4f6b1ee5acc63edf8675aa0eb8d758b..35e80be728f273c3514723c9028473d35575fa18
100644
--- a/src/heap-snapshot-generator.h
+++ b/src/heap-snapshot-generator.h
@@ -386,6 +386,10 @@ class V8HeapExplorer : public HeapEntriesAllocator {
void TagGlobalObjects();
void TagCodeObject(Code* code);
void TagBuiltinCodeObject(Code* code, const char* name);
+ HeapEntry* AddEntry(Address address,
+ HeapEntry::Type type,
+ const char* name,
+ int size);
static String* GetConstructorName(JSObject* object);
@@ -396,10 +400,6 @@ class V8HeapExplorer : public HeapEntriesAllocator {
HeapEntry* AddEntry(HeapObject* object,
HeapEntry::Type type,
const char* name);
- HeapEntry* AddEntry(Address address,
- HeapEntry::Type type,
- const char* name,
- int size);
const char* GetSystemEntryName(HeapObject* object);
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.