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

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

Issue 3572003: Fix HeapSnapshotsDiff test and a bug introduced during snapshot size optimization. (Closed)
Patch Set: Created 10 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 | « test/cctest/cctest.status ('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 5e570f34de3dc97a3eb8974ae24932de36e3fc44..6340da53d8ce2ac7c08d2465e9356175f20bdcf8 100644
--- a/test/cctest/test-heap-profiler.cc
+++ b/test/cctest/test-heap-profiler.cc
@@ -787,6 +787,7 @@ TEST(HeapSnapshotsDiff) {
CompileAndRunScript(
"function A() {}\n"
"function B(x) { this.x = x; }\n"
+ "function A2(a) { for (var i = 0; i < a; ++i) this[i] = i; }\n"
"var a = new A();\n"
"var b = new B(a);");
const v8::HeapSnapshot* snapshot1 =
@@ -795,7 +796,7 @@ TEST(HeapSnapshotsDiff) {
CompileAndRunScript(
"delete a;\n"
"b.x = null;\n"
- "var a = new A();\n"
+ "var a = new A2(20);\n"
"var b2 = new B(a);");
const v8::HeapSnapshot* snapshot2 =
v8::HeapProfiler::TakeSnapshot(v8::String::New("s2"));
@@ -811,7 +812,7 @@ TEST(HeapSnapshotsDiff) {
const v8::HeapGraphNode* node = prop->GetToNode();
if (node->GetType() == v8::HeapGraphNode::kObject) {
v8::String::AsciiValue node_name(node->GetName());
- if (strcmp(*node_name, "A") == 0) {
+ if (strcmp(*node_name, "A2") == 0) {
CHECK(IsNodeRetainedAs(node, v8::HeapGraphEdge::kProperty, "a"));
CHECK(!found_A);
found_A = true;
@@ -849,6 +850,19 @@ TEST(HeapSnapshotsDiff) {
}
+TEST(HeapSnapshotRootPreservedAfterSorting) {
+ v8::HandleScope scope;
+ LocalContext env;
+ const v8::HeapSnapshot* snapshot =
+ v8::HeapProfiler::TakeSnapshot(v8::String::New("s"));
+ const v8::HeapGraphNode* root1 = snapshot->GetRoot();
+ const_cast<i::HeapSnapshot*>(reinterpret_cast<const i::HeapSnapshot*>(
+ snapshot))->GetSortedEntriesList();
+ const v8::HeapGraphNode* root2 = snapshot->GetRoot();
+ CHECK_EQ(root1, root2);
+}
+
+
namespace v8 {
namespace internal {
« no previous file with comments | « test/cctest/cctest.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698