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); |
+} |