Index: test/cctest/test-heap-profiler.cc |
diff --git a/test/cctest/test-heap-profiler.cc b/test/cctest/test-heap-profiler.cc |
index 1bd0e671d62fca4bdc8e2acb15426ee5df2d1e79..94b072fa8aaa8e85d1878ae83869c3117f6f0dc9 100644 |
--- a/test/cctest/test-heap-profiler.cc |
+++ b/test/cctest/test-heap-profiler.cc |
@@ -7,6 +7,7 @@ |
#include "cctest.h" |
#include "heap-profiler.h" |
#include "snapshot.h" |
+#include "debug.h" |
#include "utils-inl.h" |
#include "../include/v8-profiler.h" |
@@ -1563,6 +1564,30 @@ TEST(SfiAndJsFunctionWeakRefs) { |
} |
+TEST(NoDebugObjectInSnapshot) { |
+ v8::HandleScope scope; |
+ LocalContext env; |
+ |
+ v8::internal::Isolate::Current()->debug()->Load(); |
+ CompileRun("foo = {};"); |
+ const v8::HeapSnapshot* snapshot = |
+ v8::HeapProfiler::TakeSnapshot(v8_str("snapshot")); |
+ const v8::HeapGraphNode* root = snapshot->GetRoot(); |
+ int count_globals = 0; |
mnaganov (inactive)
2012/04/17 14:16:14
nit: globals_count sounds more appropriate
alexeif
2012/04/17 15:30:10
Done.
|
+ for (int i = 0; i < root->GetChildrenCount(); ++i) { |
+ const v8::HeapGraphEdge* edge = root->GetChild(i); |
+ if (edge->GetType() == v8::HeapGraphEdge::kShortcut) { |
mnaganov (inactive)
2012/04/17 14:16:14
Perhaps, expose IsWindowReference to public and us
alexeif
2012/04/17 15:30:10
I don't think we need to make it public.
|
+ ++count_globals; |
+ const v8::HeapGraphNode* global = edge->GetToNode(); |
mnaganov (inactive)
2012/04/17 14:16:14
You can use "GetProperty" helper function defined
alexeif
2012/04/17 15:30:10
I don't know the name of the user global.
mnaganov (inactive)
2012/04/17 15:35:52
Sorry, I have misread your code.
|
+ const v8::HeapGraphNode* foo = |
+ GetProperty(global, v8::HeapGraphEdge::kProperty, "foo"); |
+ CHECK_NE(NULL, foo); |
+ } |
+ } |
+ CHECK_EQ(1, count_globals); |
+} |
+ |
+ |
TEST(PersistentHandleCount) { |
v8::HandleScope scope; |
LocalContext env; |