| 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 1284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1295 } | 1295 } |
| 1296 | 1296 |
| 1297 | 1297 |
| 1298 TEST(NoHandleLeaks) { | 1298 TEST(NoHandleLeaks) { |
| 1299 v8::HandleScope scope; | 1299 v8::HandleScope scope; |
| 1300 LocalContext env; | 1300 LocalContext env; |
| 1301 | 1301 |
| 1302 CompileRun("document = { URL:\"abcdefgh\" };"); | 1302 CompileRun("document = { URL:\"abcdefgh\" };"); |
| 1303 | 1303 |
| 1304 v8::Handle<v8::String> name(v8_str("leakz")); | 1304 v8::Handle<v8::String> name(v8_str("leakz")); |
| 1305 int count_before = i::HandleScope::NumberOfHandles(); | 1305 i::Isolate* isolate = i::Isolate::Current(); |
| 1306 int count_before = i::HandleScope::NumberOfHandles(isolate); |
| 1306 v8::HeapProfiler::TakeSnapshot(name); | 1307 v8::HeapProfiler::TakeSnapshot(name); |
| 1307 int count_after = i::HandleScope::NumberOfHandles(); | 1308 int count_after = i::HandleScope::NumberOfHandles(isolate); |
| 1308 CHECK_EQ(count_before, count_after); | 1309 CHECK_EQ(count_before, count_after); |
| 1309 } | 1310 } |
| 1310 | 1311 |
| 1311 | 1312 |
| 1312 TEST(NodesIteration) { | 1313 TEST(NodesIteration) { |
| 1313 v8::HandleScope scope; | 1314 v8::HandleScope scope; |
| 1314 LocalContext env; | 1315 LocalContext env; |
| 1315 const v8::HeapSnapshot* snapshot = | 1316 const v8::HeapSnapshot* snapshot = |
| 1316 v8::HeapProfiler::TakeSnapshot(v8_str("iteration")); | 1317 v8::HeapProfiler::TakeSnapshot(v8_str("iteration")); |
| 1317 const v8::HeapGraphNode* global = GetGlobalObject(snapshot); | 1318 const v8::HeapGraphNode* global = GetGlobalObject(snapshot); |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1694 const v8::HeapGraphNode* map = | 1695 const v8::HeapGraphNode* map = |
| 1695 GetProperty(global_object, v8::HeapGraphEdge::kInternal, "map"); | 1696 GetProperty(global_object, v8::HeapGraphEdge::kInternal, "map"); |
| 1696 CHECK_NE(NULL, map); | 1697 CHECK_NE(NULL, map); |
| 1697 const v8::HeapGraphNode* own_descriptors = GetProperty( | 1698 const v8::HeapGraphNode* own_descriptors = GetProperty( |
| 1698 map, v8::HeapGraphEdge::kInternal, "descriptors"); | 1699 map, v8::HeapGraphEdge::kInternal, "descriptors"); |
| 1699 CHECK_NE(NULL, own_descriptors); | 1700 CHECK_NE(NULL, own_descriptors); |
| 1700 const v8::HeapGraphNode* own_transitions = GetProperty( | 1701 const v8::HeapGraphNode* own_transitions = GetProperty( |
| 1701 map, v8::HeapGraphEdge::kInternal, "transitions"); | 1702 map, v8::HeapGraphEdge::kInternal, "transitions"); |
| 1702 CHECK_EQ(NULL, own_transitions); | 1703 CHECK_EQ(NULL, own_transitions); |
| 1703 } | 1704 } |
| OLD | NEW |