| 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 1245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1256 } | 1256 } |
| 1257 | 1257 |
| 1258 | 1258 |
| 1259 TEST(NoHandleLeaks) { | 1259 TEST(NoHandleLeaks) { |
| 1260 v8::HandleScope scope; | 1260 v8::HandleScope scope; |
| 1261 LocalContext env; | 1261 LocalContext env; |
| 1262 | 1262 |
| 1263 CompileRun("document = { URL:\"abcdefgh\" };"); | 1263 CompileRun("document = { URL:\"abcdefgh\" };"); |
| 1264 | 1264 |
| 1265 v8::Handle<v8::String> name(v8_str("leakz")); | 1265 v8::Handle<v8::String> name(v8_str("leakz")); |
| 1266 int count_before = i::HandleScope::NumberOfHandles(); | 1266 i::Isolate* isolate = i::Isolate::Current(); |
| 1267 int count_before = i::HandleScope::NumberOfHandles(isolate); |
| 1267 v8::HeapProfiler::TakeSnapshot(name); | 1268 v8::HeapProfiler::TakeSnapshot(name); |
| 1268 int count_after = i::HandleScope::NumberOfHandles(); | 1269 int count_after = i::HandleScope::NumberOfHandles(isolate); |
| 1269 CHECK_EQ(count_before, count_after); | 1270 CHECK_EQ(count_before, count_after); |
| 1270 } | 1271 } |
| 1271 | 1272 |
| 1272 | 1273 |
| 1273 TEST(NodesIteration) { | 1274 TEST(NodesIteration) { |
| 1274 v8::HandleScope scope; | 1275 v8::HandleScope scope; |
| 1275 LocalContext env; | 1276 LocalContext env; |
| 1276 const v8::HeapSnapshot* snapshot = | 1277 const v8::HeapSnapshot* snapshot = |
| 1277 v8::HeapProfiler::TakeSnapshot(v8_str("iteration")); | 1278 v8::HeapProfiler::TakeSnapshot(v8_str("iteration")); |
| 1278 const v8::HeapGraphNode* global = GetGlobalObject(snapshot); | 1279 const v8::HeapGraphNode* global = GetGlobalObject(snapshot); |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1655 const v8::HeapGraphNode* map = | 1656 const v8::HeapGraphNode* map = |
| 1656 GetProperty(global_object, v8::HeapGraphEdge::kInternal, "map"); | 1657 GetProperty(global_object, v8::HeapGraphEdge::kInternal, "map"); |
| 1657 CHECK_NE(NULL, map); | 1658 CHECK_NE(NULL, map); |
| 1658 const v8::HeapGraphNode* own_descriptors = GetProperty( | 1659 const v8::HeapGraphNode* own_descriptors = GetProperty( |
| 1659 map, v8::HeapGraphEdge::kInternal, "descriptors"); | 1660 map, v8::HeapGraphEdge::kInternal, "descriptors"); |
| 1660 CHECK_NE(NULL, own_descriptors); | 1661 CHECK_NE(NULL, own_descriptors); |
| 1661 const v8::HeapGraphNode* own_transitions = GetProperty( | 1662 const v8::HeapGraphNode* own_transitions = GetProperty( |
| 1662 map, v8::HeapGraphEdge::kInternal, "transitions"); | 1663 map, v8::HeapGraphEdge::kInternal, "transitions"); |
| 1663 CHECK_EQ(NULL, own_transitions); | 1664 CHECK_EQ(NULL, own_transitions); |
| 1664 } | 1665 } |
| OLD | NEW |