Revision: 19063
Author: [email protected]
Date: Tue Feb 4 11:43:19 2014 UTC
Log: Add Box object to heap profiler.
LOG=Y
[email protected], [email protected]
Review URL: https://codereview.chromium.org/143343006
http://code.google.com/p/v8/source/detail?r=19063
Modified:
/branches/bleeding_edge/src/heap-snapshot-generator.cc
/branches/bleeding_edge/src/heap-snapshot-generator.h
/branches/bleeding_edge/test/cctest/test-heap-profiler.cc
=======================================
--- /branches/bleeding_edge/src/heap-snapshot-generator.cc Thu Jan 30
12:17:21 2014 UTC
+++ /branches/bleeding_edge/src/heap-snapshot-generator.cc Tue Feb 4
11:43:19 2014 UTC
@@ -1047,6 +1047,8 @@
ExtractCodeCacheReferences(entry, CodeCache::cast(obj));
} else if (obj->IsCode()) {
ExtractCodeReferences(entry, Code::cast(obj));
+ } else if (obj->IsBox()) {
+ ExtractBoxReferences(entry, Box::cast(obj));
} else if (obj->IsCell()) {
ExtractCellReferences(entry, Cell::cast(obj));
} else if (obj->IsPropertyCell()) {
@@ -1415,6 +1417,11 @@
Code::kNextCodeLinkOffset);
}
}
+
+
+void V8HeapExplorer::ExtractBoxReferences(int entry, Box* box) {
+ SetInternalReference(box, entry, "value", box->value(),
Box::kValueOffset);
+}
void V8HeapExplorer::ExtractCellReferences(int entry, Cell* cell) {
=======================================
--- /branches/bleeding_edge/src/heap-snapshot-generator.h Wed Jan 29
17:03:13 2014 UTC
+++ /branches/bleeding_edge/src/heap-snapshot-generator.h Tue Feb 4
11:43:19 2014 UTC
@@ -410,6 +410,7 @@
void ExtractAccessorPairReferences(int entry, AccessorPair* accessors);
void ExtractCodeCacheReferences(int entry, CodeCache* code_cache);
void ExtractCodeReferences(int entry, Code* code);
+ void ExtractBoxReferences(int entry, Box* box);
void ExtractCellReferences(int entry, Cell* cell);
void ExtractPropertyCellReferences(int entry, PropertyCell* cell);
void ExtractAllocationSiteReferences(int entry, AllocationSite* site);
=======================================
--- /branches/bleeding_edge/test/cctest/test-heap-profiler.cc Fri Jan 31
09:59:50 2014 UTC
+++ /branches/bleeding_edge/test/cctest/test-heap-profiler.cc Tue Feb 4
11:43:19 2014 UTC
@@ -2383,3 +2383,32 @@
GetProperty(arr1_buffer,
v8::HeapGraphEdge::kWeak, "weak_first_view");
CHECK_NE(NULL, first_view);
}
+
+
+TEST(BoxObject) {
+ v8::Isolate* isolate = CcTest::isolate();
+ v8::HandleScope scope(isolate);
+ LocalContext env;
+ v8::Handle<v8::Object> global_proxy = env->Global();
+ v8::Handle<v8::Object> global =
global_proxy->GetPrototype().As<v8::Object>();
+
+ i::Factory* factory = CcTest::i_isolate()->factory();
+ i::Handle<i::String> string =
+ factory->NewStringFromAscii(i::CStrVector("string"));
+ i::Handle<i::Object> box = factory->NewBox(string);
+ global->Set(0, v8::ToApiHandle<v8::Object>(box));
+
+ v8::HeapProfiler* heap_profiler = isolate->GetHeapProfiler();
+ const v8::HeapSnapshot* snapshot =
+ heap_profiler->TakeHeapSnapshot(v8_str("snapshot"));
+ CHECK(ValidateSnapshot(snapshot));
+ const v8::HeapGraphNode* global_node = GetGlobalObject(snapshot);
+ const v8::HeapGraphNode* box_node =
+ GetProperty(global_node, v8::HeapGraphEdge::kElement, "0");
+ CHECK_NE(NULL, box_node);
+ v8::String::Utf8Value box_node_name(box_node->GetName());
+ CHECK_EQ("system / Box", *box_node_name);
+ const v8::HeapGraphNode* box_value =
+ GetProperty(box_node, v8::HeapGraphEdge::kInternal, "value");
+ CHECK_NE(NULL, box_value);
+}
--
--
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.