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

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

Issue 23460027: HeapProfiler: very slow ~4min "take snapshot time" for 80MB gmail heap. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 3 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 04f6e0fa130b996bc32b1bc4347b215111628558..0cf9cdaedf58d51c14ce094d1592f3f03dce00c3 100644
--- a/test/cctest/test-heap-profiler.cc
+++ b/test/cctest/test-heap-profiler.cc
@@ -404,12 +404,57 @@ TEST(HeapSnapshotSlicedString) {
const v8::HeapGraphNode* child_string =
GetProperty(global, v8::HeapGraphEdge::kProperty, "child_string");
CHECK_NE(NULL, child_string);
+ CHECK_EQ(v8::HeapGraphNode::kSlicedString, child_string->GetType());
const v8::HeapGraphNode* parent =
GetProperty(child_string, v8::HeapGraphEdge::kInternal, "parent");
CHECK_EQ(parent_string, parent);
+ heap_profiler->DeleteAllHeapSnapshots();
}
+TEST(HeapSnapshotConsString) {
+ v8::Isolate* isolate = v8::Isolate::GetCurrent();
+ v8::HandleScope scope(isolate);
+ v8::Local<v8::ObjectTemplate> global_template = v8::ObjectTemplate::New();
+ global_template->SetInternalFieldCount(1);
+ LocalContext env(NULL, global_template);
+ v8::Handle<v8::Object> global_proxy = env->Global();
+ v8::Handle<v8::Object> global = global_proxy->GetPrototype().As<v8::Object>();
+ CHECK_EQ(1, global->InternalFieldCount());
+
+ i::Factory* factory = i::Isolate::Current()->factory();
+ i::Handle<i::String> first =
+ factory->NewStringFromAscii(i::CStrVector("0123456789"));
+ i::Handle<i::String> second =
+ factory->NewStringFromAscii(i::CStrVector("0123456789"));
+ i::Handle<i::String> cons_string = factory->NewConsString(first, second);
+
+ global->SetInternalField(0, v8::ToApiHandle<v8::String>(cons_string));
+
+ v8::HeapProfiler* heap_profiler = isolate->GetHeapProfiler();
+ const v8::HeapSnapshot* snapshot =
+ heap_profiler->TakeHeapSnapshot(v8_str("cons_strings"));
+ CHECK(ValidateSnapshot(snapshot));
+ const v8::HeapGraphNode* global_node = GetGlobalObject(snapshot);
+
+ const v8::HeapGraphNode* string_node =
+ GetProperty(global_node, v8::HeapGraphEdge::kInternal, "0");
+ CHECK_NE(NULL, string_node);
+ CHECK_EQ(v8::HeapGraphNode::kConsString, string_node->GetType());
+
+ const v8::HeapGraphNode* first_node =
+ GetProperty(string_node, v8::HeapGraphEdge::kInternal, "first");
+ CHECK_EQ(v8::HeapGraphNode::kString, first_node->GetType());
+
+ const v8::HeapGraphNode* second_node =
+ GetProperty(string_node, v8::HeapGraphEdge::kInternal, "second");
+ CHECK_EQ(v8::HeapGraphNode::kString, second_node->GetType());
+
+ heap_profiler->DeleteAllHeapSnapshots();
+}
+
+
+
TEST(HeapSnapshotInternalReferences) {
v8::Isolate* isolate = v8::Isolate::GetCurrent();
v8::HandleScope scope(isolate);
« 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