| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // | 2 // |
| 3 // Tests for heap profiler | 3 // Tests for heap profiler |
| 4 | 4 |
| 5 #include <ctype.h> | 5 #include <ctype.h> |
| 6 | 6 |
| 7 #include "v8.h" | 7 #include "v8.h" |
| 8 | 8 |
| 9 #include "cctest.h" | 9 #include "cctest.h" |
| 10 #include "hashmap.h" | 10 #include "hashmap.h" |
| (...skipping 1545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1556 const v8::HeapGraphNode* shared = | 1556 const v8::HeapGraphNode* shared = |
| 1557 GetProperty(fun, v8::HeapGraphEdge::kInternal, "shared"); | 1557 GetProperty(fun, v8::HeapGraphEdge::kInternal, "shared"); |
| 1558 CHECK(HasWeakEdge(shared)); | 1558 CHECK(HasWeakEdge(shared)); |
| 1559 } | 1559 } |
| 1560 | 1560 |
| 1561 | 1561 |
| 1562 TEST(NoDebugObjectInSnapshot) { | 1562 TEST(NoDebugObjectInSnapshot) { |
| 1563 v8::HandleScope scope; | 1563 v8::HandleScope scope; |
| 1564 LocalContext env; | 1564 LocalContext env; |
| 1565 | 1565 |
| 1566 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 1566 v8::internal::Isolate::Current()->debug()->Load(); | 1567 v8::internal::Isolate::Current()->debug()->Load(); |
| 1568 #endif |
| 1567 CompileRun("foo = {};"); | 1569 CompileRun("foo = {};"); |
| 1568 const v8::HeapSnapshot* snapshot = | 1570 const v8::HeapSnapshot* snapshot = |
| 1569 v8::HeapProfiler::TakeSnapshot(v8_str("snapshot")); | 1571 v8::HeapProfiler::TakeSnapshot(v8_str("snapshot")); |
| 1570 const v8::HeapGraphNode* root = snapshot->GetRoot(); | 1572 const v8::HeapGraphNode* root = snapshot->GetRoot(); |
| 1571 int globals_count = 0; | 1573 int globals_count = 0; |
| 1572 for (int i = 0; i < root->GetChildrenCount(); ++i) { | 1574 for (int i = 0; i < root->GetChildrenCount(); ++i) { |
| 1573 const v8::HeapGraphEdge* edge = root->GetChild(i); | 1575 const v8::HeapGraphEdge* edge = root->GetChild(i); |
| 1574 if (edge->GetType() == v8::HeapGraphEdge::kShortcut) { | 1576 if (edge->GetType() == v8::HeapGraphEdge::kShortcut) { |
| 1575 ++globals_count; | 1577 ++globals_count; |
| 1576 const v8::HeapGraphNode* global = edge->GetToNode(); | 1578 const v8::HeapGraphNode* global = edge->GetToNode(); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1649 const v8::HeapGraphNode* global_object = | 1651 const v8::HeapGraphNode* global_object = |
| 1650 GetProperty(global, v8::HeapGraphEdge::kProperty, "global_object"); | 1652 GetProperty(global, v8::HeapGraphEdge::kProperty, "global_object"); |
| 1651 CHECK_NE(NULL, global_object); | 1653 CHECK_NE(NULL, global_object); |
| 1652 const v8::HeapGraphNode* properties = | 1654 const v8::HeapGraphNode* properties = |
| 1653 GetProperty(global_object, v8::HeapGraphEdge::kInternal, "properties"); | 1655 GetProperty(global_object, v8::HeapGraphEdge::kInternal, "properties"); |
| 1654 CHECK_EQ(NULL, properties); | 1656 CHECK_EQ(NULL, properties); |
| 1655 const v8::HeapGraphNode* elements = | 1657 const v8::HeapGraphNode* elements = |
| 1656 GetProperty(global_object, v8::HeapGraphEdge::kInternal, "elements"); | 1658 GetProperty(global_object, v8::HeapGraphEdge::kInternal, "elements"); |
| 1657 CHECK_EQ(NULL, elements); | 1659 CHECK_EQ(NULL, elements); |
| 1658 } | 1660 } |
| OLD | NEW |