| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 1333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1344 return --abort_count_ != 0 ? kContinue : kAbort; | 1344 return --abort_count_ != 0 ? kContinue : kAbort; |
| 1345 } | 1345 } |
| 1346 int done() { return done_; } | 1346 int done() { return done_; } |
| 1347 int total() { return total_; } | 1347 int total() { return total_; } |
| 1348 | 1348 |
| 1349 private: | 1349 private: |
| 1350 int done_; | 1350 int done_; |
| 1351 int total_; | 1351 int total_; |
| 1352 int abort_count_; | 1352 int abort_count_; |
| 1353 }; | 1353 }; |
| 1354 } | 1354 |
| 1355 } // namespace |
| 1355 | 1356 |
| 1356 | 1357 |
| 1357 TEST(TakeHeapSnapshotAborting) { | 1358 TEST(TakeHeapSnapshotAborting) { |
| 1358 LocalContext env; | 1359 LocalContext env; |
| 1359 v8::HandleScope scope(env->GetIsolate()); | 1360 v8::HandleScope scope(env->GetIsolate()); |
| 1360 | 1361 |
| 1361 v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler(); | 1362 v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler(); |
| 1362 const int snapshots_count = heap_profiler->GetSnapshotCount(); | 1363 const int snapshots_count = heap_profiler->GetSnapshotCount(); |
| 1363 TestActivityControl aborting_control(1); | 1364 TestActivityControl aborting_control(1); |
| 1364 const v8::HeapSnapshot* no_snapshot = | 1365 const v8::HeapSnapshot* no_snapshot = |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1437 bool disposed_; | 1438 bool disposed_; |
| 1438 int hash_; | 1439 int hash_; |
| 1439 const char* group_label_; | 1440 const char* group_label_; |
| 1440 const char* label_; | 1441 const char* label_; |
| 1441 intptr_t element_count_; | 1442 intptr_t element_count_; |
| 1442 intptr_t size_; | 1443 intptr_t size_; |
| 1443 }; | 1444 }; |
| 1444 | 1445 |
| 1445 | 1446 |
| 1446 i::List<TestRetainedObjectInfo*> TestRetainedObjectInfo::instances; | 1447 i::List<TestRetainedObjectInfo*> TestRetainedObjectInfo::instances; |
| 1447 } | 1448 |
| 1449 } // namespace |
| 1448 | 1450 |
| 1449 | 1451 |
| 1450 static const v8::HeapGraphNode* GetNode(const v8::HeapGraphNode* parent, | 1452 static const v8::HeapGraphNode* GetNode(const v8::HeapGraphNode* parent, |
| 1451 v8::HeapGraphNode::Type type, | 1453 v8::HeapGraphNode::Type type, |
| 1452 const char* name) { | 1454 const char* name) { |
| 1453 for (int i = 0, count = parent->GetChildrenCount(); i < count; ++i) { | 1455 for (int i = 0, count = parent->GetChildrenCount(); i < count; ++i) { |
| 1454 const v8::HeapGraphNode* node = parent->GetChild(i)->GetToNode(); | 1456 const v8::HeapGraphNode* node = parent->GetChild(i)->GetToNode(); |
| 1455 if (node->GetType() == type && strcmp(name, | 1457 if (node->GetType() == type && strcmp(name, |
| 1456 const_cast<i::HeapEntry*>( | 1458 const_cast<i::HeapEntry*>( |
| 1457 reinterpret_cast<const i::HeapEntry*>(node))->name()) == 0) { | 1459 reinterpret_cast<const i::HeapEntry*>(node))->name()) == 0) { |
| (...skipping 1335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2793 map.AddRange(ToAddress(0x180), 0x80, 6U); | 2795 map.AddRange(ToAddress(0x180), 0x80, 6U); |
| 2794 map.AddRange(ToAddress(0x180), 0x80, 7U); | 2796 map.AddRange(ToAddress(0x180), 0x80, 7U); |
| 2795 CHECK_EQ(7u, map.GetTraceNodeId(ToAddress(0x180))); | 2797 CHECK_EQ(7u, map.GetTraceNodeId(ToAddress(0x180))); |
| 2796 CHECK_EQ(5u, map.GetTraceNodeId(ToAddress(0x200))); | 2798 CHECK_EQ(5u, map.GetTraceNodeId(ToAddress(0x200))); |
| 2797 CHECK_EQ(3u, map.size()); | 2799 CHECK_EQ(3u, map.size()); |
| 2798 | 2800 |
| 2799 map.Clear(); | 2801 map.Clear(); |
| 2800 CHECK_EQ(0u, map.size()); | 2802 CHECK_EQ(0u, map.size()); |
| 2801 CHECK_EQ(0u, map.GetTraceNodeId(ToAddress(0x400))); | 2803 CHECK_EQ(0u, map.GetTraceNodeId(ToAddress(0x400))); |
| 2802 } | 2804 } |
| OLD | NEW |