| Index: test/cctest/test-heap-profiler.cc
|
| diff --git a/test/cctest/test-heap-profiler.cc b/test/cctest/test-heap-profiler.cc
|
| index 2ca6e299494a906657d83520ac09da9a39aa1c93..ba6a97a4c6b11f366d24f2c65ba10194afb011bd 100644
|
| --- a/test/cctest/test-heap-profiler.cc
|
| +++ b/test/cctest/test-heap-profiler.cc
|
| @@ -92,8 +92,9 @@ class NamedEntriesDetector {
|
| static const v8::HeapGraphNode* GetGlobalObject(
|
| const v8::HeapSnapshot* snapshot) {
|
| CHECK_EQ(2, snapshot->GetRoot()->GetChildrenCount());
|
| + // The 0th-child is (GC Roots), 1st is the user root.
|
| const v8::HeapGraphNode* global_obj =
|
| - snapshot->GetRoot()->GetChild(0)->GetToNode();
|
| + snapshot->GetRoot()->GetChild(1)->GetToNode();
|
| CHECK_EQ(0, strncmp("Object", const_cast<i::HeapEntry*>(
|
| reinterpret_cast<const i::HeapEntry*>(global_obj))->name(), 6));
|
| return global_obj;
|
| @@ -339,6 +340,7 @@ TEST(HeapSnapshotHeapNumbers) {
|
| CHECK_EQ(v8::HeapGraphNode::kHeapNumber, b->GetType());
|
| }
|
|
|
| +
|
| TEST(HeapSnapshotSlicedString) {
|
| LocalContext env;
|
| v8::HandleScope scope(env->GetIsolate());
|
| @@ -363,6 +365,7 @@ TEST(HeapSnapshotSlicedString) {
|
| CHECK_EQ(parent_string, parent);
|
| }
|
|
|
| +
|
| TEST(HeapSnapshotInternalReferences) {
|
| v8::Isolate* isolate = v8::Isolate::GetCurrent();
|
| v8::HandleScope scope(isolate);
|
| @@ -480,6 +483,7 @@ TEST(HeapEntryIdsAndArrayShift) {
|
| CHECK_EQ_SNAPSHOT_OBJECT_ID(k1->GetId(), k2->GetId());
|
| }
|
|
|
| +
|
| TEST(HeapEntryIdsAndGC) {
|
| LocalContext env;
|
| v8::HandleScope scope(env->GetIsolate());
|
| @@ -658,7 +662,8 @@ TEST(HeapSnapshotJSONSerialization) {
|
| " first_edge_indexes[i] = first_edge_index;\n"
|
| " first_edge_index += edge_fields_count *\n"
|
| " parsed.nodes[i * node_fields_count + edge_count_offset];\n"
|
| - "}\n");
|
| + "}\n"
|
| + "first_edge_indexes[node_count] = first_edge_index;\n");
|
| CHECK(!meta_analysis_result.IsEmpty());
|
|
|
| // A helper function for processing encoded nodes.
|
| @@ -682,7 +687,7 @@ TEST(HeapSnapshotJSONSerialization) {
|
| "GetChildPosByProperty(\n"
|
| " GetChildPosByProperty(\n"
|
| " GetChildPosByProperty("
|
| - " parsed.edges[edge_to_node_offset],"
|
| + " parsed.edges[edge_fields_count + edge_to_node_offset],"
|
| " \"b\", property_type),\n"
|
| " \"x\", property_type),"
|
| " \"s\", property_type)");
|
| @@ -1015,6 +1020,7 @@ class TestActivityControl : public v8::ActivityControl {
|
| };
|
| }
|
|
|
| +
|
| TEST(TakeHeapSnapshotAborting) {
|
| LocalContext env;
|
| v8::HandleScope scope(env->GetIsolate());
|
| @@ -1338,6 +1344,7 @@ class NameResolver : public v8::HeapProfiler::ObjectNameResolver {
|
| }
|
| };
|
|
|
| +
|
| TEST(GlobalObjectName) {
|
| LocalContext env;
|
| v8::HandleScope scope(env->GetIsolate());
|
| @@ -1604,6 +1611,7 @@ TEST(HiddenPropertiesFastCase) {
|
| CHECK_NE(NULL, hidden_props);
|
| }
|
|
|
| +
|
| bool HasWeakEdge(const v8::HeapGraphNode* node) {
|
| for (int i = 0; i < node->GetChildrenCount(); ++i) {
|
| const v8::HeapGraphEdge* handle_edge = node->GetChild(i);
|
| @@ -1619,10 +1627,10 @@ bool HasWeakGlobalHandle() {
|
| const v8::HeapSnapshot* snapshot =
|
| heap_profiler->TakeHeapSnapshot(v8_str("weaks"));
|
| const v8::HeapGraphNode* gc_roots = GetNode(
|
| - snapshot->GetRoot(), v8::HeapGraphNode::kObject, "(GC roots)");
|
| + snapshot->GetRoot(), v8::HeapGraphNode::kSynthetic, "(GC roots)");
|
| CHECK_NE(NULL, gc_roots);
|
| const v8::HeapGraphNode* global_handles = GetNode(
|
| - gc_roots, v8::HeapGraphNode::kObject, "(Global handles)");
|
| + gc_roots, v8::HeapGraphNode::kSynthetic, "(Global handles)");
|
| CHECK_NE(NULL, global_handles);
|
| return HasWeakEdge(global_handles);
|
| }
|
| @@ -1656,10 +1664,10 @@ TEST(WeakNativeContextRefs) {
|
| const v8::HeapSnapshot* snapshot =
|
| heap_profiler->TakeHeapSnapshot(v8_str("weaks"));
|
| const v8::HeapGraphNode* gc_roots = GetNode(
|
| - snapshot->GetRoot(), v8::HeapGraphNode::kObject, "(GC roots)");
|
| + snapshot->GetRoot(), v8::HeapGraphNode::kSynthetic, "(GC roots)");
|
| CHECK_NE(NULL, gc_roots);
|
| const v8::HeapGraphNode* global_handles = GetNode(
|
| - gc_roots, v8::HeapGraphNode::kObject, "(Global handles)");
|
| + gc_roots, v8::HeapGraphNode::kSynthetic, "(Global handles)");
|
| CHECK_NE(NULL, global_handles);
|
| const v8::HeapGraphNode* native_context = GetNode(
|
| global_handles, v8::HeapGraphNode::kHidden, "system / NativeContext");
|
| @@ -1724,10 +1732,10 @@ TEST(AllStrongGcRootsHaveNames) {
|
| const v8::HeapSnapshot* snapshot =
|
| heap_profiler->TakeHeapSnapshot(v8_str("snapshot"));
|
| const v8::HeapGraphNode* gc_roots = GetNode(
|
| - snapshot->GetRoot(), v8::HeapGraphNode::kObject, "(GC roots)");
|
| + snapshot->GetRoot(), v8::HeapGraphNode::kSynthetic, "(GC roots)");
|
| CHECK_NE(NULL, gc_roots);
|
| const v8::HeapGraphNode* strong_roots = GetNode(
|
| - gc_roots, v8::HeapGraphNode::kObject, "(Strong roots)");
|
| + gc_roots, v8::HeapGraphNode::kSynthetic, "(Strong roots)");
|
| CHECK_NE(NULL, strong_roots);
|
| for (int i = 0; i < strong_roots->GetChildrenCount(); ++i) {
|
| const v8::HeapGraphEdge* edge = strong_roots->GetChild(i);
|
|
|