OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. |
2 // | 2 // |
3 // Tests of logging functions from log.h | 3 // Tests of logging functions from log.h |
4 | 4 |
5 #ifdef __linux__ | 5 #ifdef __linux__ |
6 #include <math.h> | 6 #include <math.h> |
7 #include <pthread.h> | 7 #include <pthread.h> |
8 #include <signal.h> | 8 #include <signal.h> |
9 #include <unistd.h> | 9 #include <unistd.h> |
10 #endif // __linux__ | 10 #endif // __linux__ |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 // Start with profiling to capture all code events from the beginning. | 487 // Start with profiling to capture all code events from the beginning. |
488 ScopedLoggerInitializer initialize_logger(false); | 488 ScopedLoggerInitializer initialize_logger(false); |
489 | 489 |
490 // Compile and run a function that creates other functions. | 490 // Compile and run a function that creates other functions. |
491 CompileRun( | 491 CompileRun( |
492 "(function f(obj) {\n" | 492 "(function f(obj) {\n" |
493 " obj.test =\n" | 493 " obj.test =\n" |
494 " (function a(j) { return function b() { return j; } })(100);\n" | 494 " (function a(j) { return function b() { return j; } })(100);\n" |
495 "})(this);"); | 495 "})(this);"); |
496 v8::V8::PauseProfiler(); | 496 v8::V8::PauseProfiler(); |
497 HEAP->CollectAllGarbage(true); | 497 HEAP->CollectAllGarbage(i::Heap::kMakeHeapIterableMask); |
498 LOGGER->StringEvent("test-logging-done", ""); | 498 LOGGER->StringEvent("test-logging-done", ""); |
499 | 499 |
500 // Iterate heap to find compiled functions, will write to log. | 500 // Iterate heap to find compiled functions, will write to log. |
501 LOGGER->LogCompiledFunctions(); | 501 LOGGER->LogCompiledFunctions(); |
502 LOGGER->StringEvent("test-traversal-done", ""); | 502 LOGGER->StringEvent("test-traversal-done", ""); |
503 | 503 |
504 bool exists = false; | 504 bool exists = false; |
505 i::Vector<const char> log( | 505 i::Vector<const char> log( |
506 i::ReadFile(initialize_logger.StopLoggingGetTempFile(), &exists, true)); | 506 i::ReadFile(initialize_logger.StopLoggingGetTempFile(), &exists, true)); |
507 CHECK(exists); | 507 CHECK(exists); |
(...skipping 21 matching lines...) Expand all Loading... |
529 v8::Local<v8::String> s = result->ToString(); | 529 v8::Local<v8::String> s = result->ToString(); |
530 i::ScopedVector<char> data(s->Length() + 1); | 530 i::ScopedVector<char> data(s->Length() + 1); |
531 CHECK_NE(NULL, data.start()); | 531 CHECK_NE(NULL, data.start()); |
532 s->WriteAscii(data.start()); | 532 s->WriteAscii(data.start()); |
533 printf("%s\n", data.start()); | 533 printf("%s\n", data.start()); |
534 // Make sure that our output is written prior crash due to CHECK failure. | 534 // Make sure that our output is written prior crash due to CHECK failure. |
535 fflush(stdout); | 535 fflush(stdout); |
536 CHECK(false); | 536 CHECK(false); |
537 } | 537 } |
538 } | 538 } |
OLD | NEW |