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

Side by Side Diff: test/cctest/test-heap-profiler.cc

Issue 18420019: Change the type of system root nodes in heap snapshot to kSynthetic (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/heap-snapshot-generator.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1603 matching lines...) Expand 10 before | Expand all | Expand 10 after
1614 return false; 1614 return false;
1615 } 1615 }
1616 1616
1617 1617
1618 bool HasWeakGlobalHandle() { 1618 bool HasWeakGlobalHandle() {
1619 v8::Isolate* isolate = v8::Isolate::GetCurrent(); 1619 v8::Isolate* isolate = v8::Isolate::GetCurrent();
1620 v8::HeapProfiler* heap_profiler = isolate->GetHeapProfiler(); 1620 v8::HeapProfiler* heap_profiler = isolate->GetHeapProfiler();
1621 const v8::HeapSnapshot* snapshot = 1621 const v8::HeapSnapshot* snapshot =
1622 heap_profiler->TakeHeapSnapshot(v8_str("weaks")); 1622 heap_profiler->TakeHeapSnapshot(v8_str("weaks"));
1623 const v8::HeapGraphNode* gc_roots = GetNode( 1623 const v8::HeapGraphNode* gc_roots = GetNode(
1624 snapshot->GetRoot(), v8::HeapGraphNode::kObject, "(GC roots)"); 1624 snapshot->GetRoot(), v8::HeapGraphNode::kSynthetic, "(GC roots)");
1625 CHECK_NE(NULL, gc_roots); 1625 CHECK_NE(NULL, gc_roots);
1626 const v8::HeapGraphNode* global_handles = GetNode( 1626 const v8::HeapGraphNode* global_handles = GetNode(
1627 gc_roots, v8::HeapGraphNode::kObject, "(Global handles)"); 1627 gc_roots, v8::HeapGraphNode::kSynthetic, "(Global handles)");
1628 CHECK_NE(NULL, global_handles); 1628 CHECK_NE(NULL, global_handles);
1629 return HasWeakEdge(global_handles); 1629 return HasWeakEdge(global_handles);
1630 } 1630 }
1631 1631
1632 1632
1633 static void PersistentHandleCallback(v8::Isolate* isolate, 1633 static void PersistentHandleCallback(v8::Isolate* isolate,
1634 v8::Persistent<v8::Value>* handle, 1634 v8::Persistent<v8::Value>* handle,
1635 void*) { 1635 void*) {
1636 handle->Dispose(isolate); 1636 handle->Dispose(isolate);
1637 } 1637 }
(...skipping 13 matching lines...) Expand all
1651 1651
1652 1652
1653 TEST(WeakNativeContextRefs) { 1653 TEST(WeakNativeContextRefs) {
1654 LocalContext env; 1654 LocalContext env;
1655 v8::HandleScope scope(env->GetIsolate()); 1655 v8::HandleScope scope(env->GetIsolate());
1656 v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler(); 1656 v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler();
1657 1657
1658 const v8::HeapSnapshot* snapshot = 1658 const v8::HeapSnapshot* snapshot =
1659 heap_profiler->TakeHeapSnapshot(v8_str("weaks")); 1659 heap_profiler->TakeHeapSnapshot(v8_str("weaks"));
1660 const v8::HeapGraphNode* gc_roots = GetNode( 1660 const v8::HeapGraphNode* gc_roots = GetNode(
1661 snapshot->GetRoot(), v8::HeapGraphNode::kObject, "(GC roots)"); 1661 snapshot->GetRoot(), v8::HeapGraphNode::kSynthetic, "(GC roots)");
1662 CHECK_NE(NULL, gc_roots); 1662 CHECK_NE(NULL, gc_roots);
1663 const v8::HeapGraphNode* global_handles = GetNode( 1663 const v8::HeapGraphNode* global_handles = GetNode(
1664 gc_roots, v8::HeapGraphNode::kObject, "(Global handles)"); 1664 gc_roots, v8::HeapGraphNode::kSynthetic, "(Global handles)");
1665 CHECK_NE(NULL, global_handles); 1665 CHECK_NE(NULL, global_handles);
1666 const v8::HeapGraphNode* native_context = GetNode( 1666 const v8::HeapGraphNode* native_context = GetNode(
1667 global_handles, v8::HeapGraphNode::kHidden, "system / NativeContext"); 1667 global_handles, v8::HeapGraphNode::kHidden, "system / NativeContext");
1668 CHECK_NE(NULL, native_context); 1668 CHECK_NE(NULL, native_context);
1669 CHECK(HasWeakEdge(native_context)); 1669 CHECK(HasWeakEdge(native_context));
1670 } 1670 }
1671 1671
1672 1672
1673 TEST(SfiAndJsFunctionWeakRefs) { 1673 TEST(SfiAndJsFunctionWeakRefs) {
1674 LocalContext env; 1674 LocalContext env;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1719 1719
1720 TEST(AllStrongGcRootsHaveNames) { 1720 TEST(AllStrongGcRootsHaveNames) {
1721 LocalContext env; 1721 LocalContext env;
1722 v8::HandleScope scope(env->GetIsolate()); 1722 v8::HandleScope scope(env->GetIsolate());
1723 v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler(); 1723 v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler();
1724 1724
1725 CompileRun("foo = {};"); 1725 CompileRun("foo = {};");
1726 const v8::HeapSnapshot* snapshot = 1726 const v8::HeapSnapshot* snapshot =
1727 heap_profiler->TakeHeapSnapshot(v8_str("snapshot")); 1727 heap_profiler->TakeHeapSnapshot(v8_str("snapshot"));
1728 const v8::HeapGraphNode* gc_roots = GetNode( 1728 const v8::HeapGraphNode* gc_roots = GetNode(
1729 snapshot->GetRoot(), v8::HeapGraphNode::kObject, "(GC roots)"); 1729 snapshot->GetRoot(), v8::HeapGraphNode::kSynthetic, "(GC roots)");
1730 CHECK_NE(NULL, gc_roots); 1730 CHECK_NE(NULL, gc_roots);
1731 const v8::HeapGraphNode* strong_roots = GetNode( 1731 const v8::HeapGraphNode* strong_roots = GetNode(
1732 gc_roots, v8::HeapGraphNode::kObject, "(Strong roots)"); 1732 gc_roots, v8::HeapGraphNode::kSynthetic, "(Strong roots)");
1733 CHECK_NE(NULL, strong_roots); 1733 CHECK_NE(NULL, strong_roots);
1734 for (int i = 0; i < strong_roots->GetChildrenCount(); ++i) { 1734 for (int i = 0; i < strong_roots->GetChildrenCount(); ++i) {
1735 const v8::HeapGraphEdge* edge = strong_roots->GetChild(i); 1735 const v8::HeapGraphEdge* edge = strong_roots->GetChild(i);
1736 CHECK_EQ(v8::HeapGraphEdge::kInternal, edge->GetType()); 1736 CHECK_EQ(v8::HeapGraphEdge::kInternal, edge->GetType());
1737 v8::String::Utf8Value name(edge->GetName()); 1737 v8::String::Utf8Value name(edge->GetName());
1738 CHECK(isalpha(**name)); 1738 CHECK(isalpha(**name));
1739 } 1739 }
1740 } 1740 }
1741 1741
1742 1742
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
1819 // Check all the objects have got their names. 1819 // Check all the objects have got their names.
1820 // ... well check just every 8th because otherwise it's too slow in debug. 1820 // ... well check just every 8th because otherwise it's too slow in debug.
1821 for (int i = 0; i < num_objects - 1; i += 8) { 1821 for (int i = 0; i < num_objects - 1; i += 8) {
1822 i::EmbeddedVector<char, 100> var_name; 1822 i::EmbeddedVector<char, 100> var_name;
1823 i::OS::SNPrintF(var_name, "f_%d", i); 1823 i::OS::SNPrintF(var_name, "f_%d", i);
1824 const v8::HeapGraphNode* f_object = GetProperty( 1824 const v8::HeapGraphNode* f_object = GetProperty(
1825 context_object, v8::HeapGraphEdge::kContextVariable, var_name.start()); 1825 context_object, v8::HeapGraphEdge::kContextVariable, var_name.start());
1826 CHECK_NE(NULL, f_object); 1826 CHECK_NE(NULL, f_object);
1827 } 1827 }
1828 } 1828 }
OLDNEW
« 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