| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 the V8 project authors. All rights reserved. |
| 2 // | 2 // |
| 3 // Tests for heap profiler | 3 // Tests for heap profiler |
| 4 | 4 |
| 5 #ifdef ENABLE_LOGGING_AND_PROFILING | 5 #ifdef ENABLE_LOGGING_AND_PROFILING |
| 6 | 6 |
| 7 #include "v8.h" | 7 #include "v8.h" |
| 8 #include "heap-profiler.h" | 8 #include "heap-profiler.h" |
| 9 #include "string-stream.h" | 9 #include "string-stream.h" |
| 10 #include "cctest.h" | 10 #include "cctest.h" |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 i::HeapIterator iterator; | 377 i::HeapIterator iterator; |
| 378 while (iterator.has_next()) { | 378 while (iterator.has_next()) { |
| 379 i::HeapObject* obj = iterator.next(); | 379 i::HeapObject* obj = iterator.next(); |
| 380 ret_profile.CollectStats(obj); | 380 ret_profile.CollectStats(obj); |
| 381 } | 381 } |
| 382 RetainerProfilePrinter printer; | 382 RetainerProfilePrinter printer; |
| 383 ret_profile.DebugPrintStats(&printer); | 383 ret_profile.DebugPrintStats(&printer); |
| 384 const char* retainers_of_a = printer.GetRetainers("A"); | 384 const char* retainers_of_a = printer.GetRetainers("A"); |
| 385 // The order of retainers is unspecified, so we check string length, and | 385 // The order of retainers is unspecified, so we check string length, and |
| 386 // verify each retainer separately. | 386 // verify each retainer separately. |
| 387 CHECK_EQ(static_cast<int>(strlen("(global property);1,B;2,C;2")), | 387 CHECK_EQ(i::StrLength("(global property);1,B;2,C;2"), |
| 388 static_cast<int>(strlen(retainers_of_a))); | 388 i::StrLength(retainers_of_a)); |
| 389 CHECK(strstr(retainers_of_a, "(global property);1") != NULL); | 389 CHECK(strstr(retainers_of_a, "(global property);1") != NULL); |
| 390 CHECK(strstr(retainers_of_a, "B;2") != NULL); | 390 CHECK(strstr(retainers_of_a, "B;2") != NULL); |
| 391 CHECK(strstr(retainers_of_a, "C;2") != NULL); | 391 CHECK(strstr(retainers_of_a, "C;2") != NULL); |
| 392 CHECK_EQ("(global property);2", printer.GetRetainers("B")); | 392 CHECK_EQ("(global property);2", printer.GetRetainers("B")); |
| 393 CHECK_EQ("(global property);1", printer.GetRetainers("C")); | 393 CHECK_EQ("(global property);1", printer.GetRetainers("C")); |
| 394 } | 394 } |
| 395 | 395 |
| 396 #endif // ENABLE_LOGGING_AND_PROFILING | 396 #endif // ENABLE_LOGGING_AND_PROFILING |
| OLD | NEW |