| 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 ENABLE_LOGGING_AND_PROFILING | 5 #ifdef ENABLE_LOGGING_AND_PROFILING |
| 6 | 6 |
| 7 #include "v8.h" | 7 #include "v8.h" |
| 8 | 8 |
| 9 #include "log.h" | 9 #include "log.h" |
| 10 #include "cctest.h" | 10 #include "cctest.h" |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 CHECK_EQ(0, Logger::GetLogLines(100, NULL, 100)); | 122 CHECK_EQ(0, Logger::GetLogLines(100, NULL, 100)); |
| 123 Logger::TearDown(); | 123 Logger::TearDown(); |
| 124 } | 124 } |
| 125 | 125 |
| 126 | 126 |
| 127 static void CompileAndRunScript(const char *src) { | 127 static void CompileAndRunScript(const char *src) { |
| 128 v8::Script::Compile(v8::String::New(src))->Run(); | 128 v8::Script::Compile(v8::String::New(src))->Run(); |
| 129 } | 129 } |
| 130 | 130 |
| 131 | 131 |
| 132 // Exclude the following test from ARM because profiling can |
| 133 // malfunction there. |
| 134 // TODO(mikhail.naganov): Fix it. |
| 135 #ifndef V8_TARGET_ARCH_ARM |
| 136 |
| 132 namespace v8 { | 137 namespace v8 { |
| 133 namespace internal { | 138 namespace internal { |
| 134 | 139 |
| 135 class LoggerTestHelper : public AllStatic { | 140 class LoggerTestHelper : public AllStatic { |
| 136 public: | 141 public: |
| 137 static bool IsSamplerActive() { return Logger::IsProfilerSamplerActive(); } | 142 static bool IsSamplerActive() { return Logger::IsProfilerSamplerActive(); } |
| 138 }; | 143 }; |
| 139 | 144 |
| 140 } // namespace v8::internal | 145 } // namespace v8::internal |
| 141 } // namespace v8 | 146 } // namespace v8 |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 // Check that profiling can be resumed again. | 236 // Check that profiling can be resumed again. |
| 232 CheckThatProfilerWorks(log_pos); | 237 CheckThatProfilerWorks(log_pos); |
| 233 | 238 |
| 234 env->Exit(); | 239 env->Exit(); |
| 235 Logger::TearDown(); | 240 Logger::TearDown(); |
| 236 i::FLAG_prof_lazy = saved_prof_lazy; | 241 i::FLAG_prof_lazy = saved_prof_lazy; |
| 237 i::FLAG_prof = saved_prof; | 242 i::FLAG_prof = saved_prof; |
| 238 i::FLAG_prof_auto = saved_prof_auto; | 243 i::FLAG_prof_auto = saved_prof_auto; |
| 239 } | 244 } |
| 240 | 245 |
| 246 #endif // V8_TARGET_ARCH_ARM |
| 247 |
| 241 | 248 |
| 242 static inline bool IsStringEqualTo(const char* r, const char* s) { | 249 static inline bool IsStringEqualTo(const char* r, const char* s) { |
| 243 return strncmp(r, s, strlen(r)) == 0; | 250 return strncmp(r, s, strlen(r)) == 0; |
| 244 } | 251 } |
| 245 | 252 |
| 246 | 253 |
| 247 static bool Consume(const char* str, char** buf) { | 254 static bool Consume(const char* str, char** buf) { |
| 248 if (IsStringEqualTo(str, *buf)) { | 255 if (IsStringEqualTo(str, *buf)) { |
| 249 *buf += strlen(str); | 256 *buf += strlen(str); |
| 250 return true; | 257 return true; |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 694 } | 701 } |
| 695 // Make sure that all log data is written prior crash due to CHECK failure. | 702 // Make sure that all log data is written prior crash due to CHECK failure. |
| 696 fflush(stdout); | 703 fflush(stdout); |
| 697 CHECK(results_equal); | 704 CHECK(results_equal); |
| 698 | 705 |
| 699 env->Exit(); | 706 env->Exit(); |
| 700 Logger::TearDown(); | 707 Logger::TearDown(); |
| 701 i::FLAG_always_compact = saved_always_compact; | 708 i::FLAG_always_compact = saved_always_compact; |
| 702 } | 709 } |
| 703 | 710 |
| 704 | |
| 705 #endif // ENABLE_LOGGING_AND_PROFILING | 711 #endif // ENABLE_LOGGING_AND_PROFILING |
| OLD | NEW |