Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(439)

Unified Diff: test/cctest/test-heap-profiler.cc

Issue 143343006: Add Box object to heap profiler. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Added a test. Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/heap-snapshot-generator.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-heap-profiler.cc
diff --git a/test/cctest/test-heap-profiler.cc b/test/cctest/test-heap-profiler.cc
index 026dfbc7da2e92124ad5164f7410206f9d4a8508..ae0ade411646222e4e53af622d621725cee22c37 100644
--- a/test/cctest/test-heap-profiler.cc
+++ b/test/cctest/test-heap-profiler.cc
@@ -2359,3 +2359,37 @@ TEST(ArrayBufferAndArrayBufferView) {
GetProperty(arr1_buffer, v8::HeapGraphEdge::kWeak, "weak_first_view");
CHECK_NE(NULL, first_view);
}
+
+
+TEST(BoxObject) {
+ LocalContext env;
+ v8::HandleScope scope(env->GetIsolate());
+ v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler();
+ CompileRun("1");
+ const v8::HeapSnapshot* snapshot =
+ heap_profiler->TakeHeapSnapshot(v8_str("snapshot"));
+ CHECK(ValidateSnapshot(snapshot));
+ const v8::HeapGraphNode* global = GetGlobalObject(snapshot);
+ const v8::HeapGraphNode* properties =
+ GetProperty(global, v8::HeapGraphEdge::kInternal, "properties");
+ int num_objects = properties->GetChildrenCount();
+ int i;
+ for (i = 0; i < num_objects; ++i) {
+ const v8::HeapGraphEdge* prop = properties->GetChild(i);
+ const v8::HeapGraphNode* node = prop->GetToNode();
+ v8::String::Utf8Value node_name(node->GetName());
+ if (strcmp(*node_name, "system / PropertyCell") != 0)
+ continue;
+ const v8::HeapGraphNode* type_node =
+ GetProperty(node, v8::HeapGraphEdge::kInternal, "type");
+ CHECK_NE(NULL, type_node);
+ v8::String::Utf8Value type_node_name(type_node->GetName());
+ if (strcmp(*type_node_name, "system / Box") != 0)
yurys 2014/01/30 13:34:34 This looks a bit fragile, would it be enough to se
+ continue;
+ const v8::HeapGraphNode* box_value =
+ GetProperty(type_node, v8::HeapGraphEdge::kInternal, "value");
+ CHECK_NE(NULL, box_value);
+ break;
+ }
+ CHECK_NE(num_objects, i);
+}
« no previous file with comments | « src/heap-snapshot-generator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698