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

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

Issue 19397002: Provide named links to code objects in heap snapshot. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Added a test. 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 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 079f4a43641045ca91b0acec997ed51a79715d5c..c5c88bfe687cc7a289d716ab362264a7d412431d 100644
--- a/test/cctest/test-heap-profiler.cc
+++ b/test/cctest/test-heap-profiler.cc
@@ -1963,3 +1963,21 @@ TEST(AllocationSitesAreVisible) {
CHECK_EQ(v8::Integer::New(2), array->Get(v8::Integer::New(1)));
CHECK_EQ(v8::Integer::New(1), array->Get(v8::Integer::New(2)));
}
+
+
+TEST(JSFunctionHasCodeLink) {
+ LocalContext env;
+ v8::HandleScope scope(env->GetIsolate());
+ v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler();
+ CompileRun("function foo(x, y) { return x + y; }\n");
+ const v8::HeapSnapshot* snapshot =
+ heap_profiler->TakeHeapSnapshot(v8_str("snapshot"));
+ CHECK(ValidateSnapshot(snapshot, 3));
yurys 2013/07/17 10:24:01 Could you make 3 a default parameter please.
+ const v8::HeapGraphNode* global = GetGlobalObject(snapshot);
+ const v8::HeapGraphNode* foo_func =
+ GetProperty(global, v8::HeapGraphEdge::kProperty, "foo");
+ CHECK_NE(NULL, foo_func);
+ const v8::HeapGraphNode* code =
+ GetProperty(foo_func, v8::HeapGraphEdge::kInternal, "code");
+ CHECK_NE(NULL, code);
+}
« 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