| Index: test/cctest/test-log.cc
|
| diff --git a/test/cctest/test-log.cc b/test/cctest/test-log.cc
|
| index 8bcb5f7d2942d4ab865a9adc8695d8f29b6899ad..6bf56f0fa40395405586c842d197e4ff56cf508c 100644
|
| --- a/test/cctest/test-log.cc
|
| +++ b/test/cctest/test-log.cc
|
| @@ -27,7 +27,6 @@
|
| //
|
| // Tests of logging functions from log.h
|
|
|
| -#define V8_DISABLE_DEPRECATIONS 1
|
| #ifdef __linux__
|
| #include <pthread.h>
|
| #include <signal.h>
|
| @@ -44,7 +43,6 @@
|
| #include "v8utils.h"
|
| #include "cctest.h"
|
| #include "vm-state-inl.h"
|
| -#undef V8_DISABLE_DEPRECATIONS
|
|
|
| using v8::internal::Address;
|
| using v8::internal::EmbeddedVector;
|
| @@ -56,13 +54,12 @@ namespace {
|
|
|
| class ScopedLoggerInitializer {
|
| public:
|
| - explicit ScopedLoggerInitializer(bool prof_lazy)
|
| + ScopedLoggerInitializer()
|
| : saved_log_(i::FLAG_log),
|
| - saved_prof_lazy_(i::FLAG_prof_lazy),
|
| saved_prof_(i::FLAG_prof),
|
| temp_file_(NULL),
|
| // Need to run this prior to creating the scope.
|
| - trick_to_run_init_flags_(init_flags_(prof_lazy)),
|
| + trick_to_run_init_flags_(init_flags_()),
|
| scope_(v8::Isolate::GetCurrent()),
|
| env_(v8::Context::New(v8::Isolate::GetCurrent())),
|
| logger_(i::Isolate::Current()->logger()) {
|
| @@ -73,7 +70,6 @@ class ScopedLoggerInitializer {
|
| env_->Exit();
|
| logger_->TearDown();
|
| if (temp_file_ != NULL) fclose(temp_file_);
|
| - i::FLAG_prof_lazy = saved_prof_lazy_;
|
| i::FLAG_prof = saved_prof_;
|
| i::FLAG_log = saved_log_;
|
| }
|
| @@ -91,16 +87,14 @@ class ScopedLoggerInitializer {
|
| }
|
|
|
| private:
|
| - static bool init_flags_(bool prof_lazy) {
|
| + static bool init_flags_() {
|
| i::FLAG_log = true;
|
| i::FLAG_prof = true;
|
| - i::FLAG_prof_lazy = prof_lazy;
|
| i::FLAG_logfile = i::Log::kLogToTemporaryFile;
|
| - return prof_lazy;
|
| + return false;
|
| }
|
|
|
| const bool saved_log_;
|
| - const bool saved_prof_lazy_;
|
| const bool saved_prof_;
|
| FILE* temp_file_;
|
| const bool trick_to_run_init_flags_;
|
| @@ -124,70 +118,6 @@ static const char* StrNStr(const char* s1, const char* s2, int n) {
|
| }
|
|
|
|
|
| -TEST(ProfLazyMode) {
|
| - ScopedLoggerInitializer initialize_logger(true);
|
| - Logger* logger = initialize_logger.logger();
|
| -
|
| - if (!i::V8::UseCrankshaft()) return;
|
| -
|
| - logger->StringEvent("test-start", "");
|
| - CompileRun("var a = (function(x) { return x + 1; })(10);");
|
| - logger->StringEvent("test-profiler-start", "");
|
| - v8::V8::ResumeProfiler();
|
| - CompileRun(
|
| - "var b = (function(x) { return x + 2; })(10);\n"
|
| - "var c = (function(x) { return x + 3; })(10);\n"
|
| - "var d = (function(x) { return x + 4; })(10);\n"
|
| - "var e = (function(x) { return x + 5; })(10);");
|
| - v8::V8::PauseProfiler();
|
| - logger->StringEvent("test-profiler-stop", "");
|
| - CompileRun("var f = (function(x) { return x + 6; })(10);");
|
| - // Check that profiling can be resumed again.
|
| - logger->StringEvent("test-profiler-start-2", "");
|
| - v8::V8::ResumeProfiler();
|
| - CompileRun(
|
| - "var g = (function(x) { return x + 7; })(10);\n"
|
| - "var h = (function(x) { return x + 8; })(10);\n"
|
| - "var i = (function(x) { return x + 9; })(10);\n"
|
| - "var j = (function(x) { return x + 10; })(10);");
|
| - v8::V8::PauseProfiler();
|
| - logger->StringEvent("test-profiler-stop-2", "");
|
| - logger->StringEvent("test-stop", "");
|
| -
|
| - bool exists = false;
|
| - i::Vector<const char> log(
|
| - i::ReadFile(initialize_logger.StopLoggingGetTempFile(), &exists, true));
|
| - CHECK(exists);
|
| -
|
| - const char* test_start_position =
|
| - StrNStr(log.start(), "test-start,", log.length());
|
| - CHECK_NE(NULL, test_start_position);
|
| - const char* test_profiler_start_position =
|
| - StrNStr(log.start(), "test-profiler-start,", log.length());
|
| - CHECK_NE(NULL, test_profiler_start_position);
|
| - CHECK_GT(test_profiler_start_position, test_start_position);
|
| - const char* test_profiler_stop_position =
|
| - StrNStr(log.start(), "test-profiler-stop,", log.length());
|
| - CHECK_NE(NULL, test_profiler_stop_position);
|
| - CHECK_GT(test_profiler_stop_position, test_profiler_start_position);
|
| - const char* test_profiler_start_2_position =
|
| - StrNStr(log.start(), "test-profiler-start-2,", log.length());
|
| - CHECK_NE(NULL, test_profiler_start_2_position);
|
| - CHECK_GT(test_profiler_start_2_position, test_profiler_stop_position);
|
| -
|
| - // Nothing must be logged until profiling is resumed.
|
| - CHECK_EQ(NULL, StrNStr(test_start_position,
|
| - "code-creation,",
|
| - static_cast<int>(test_profiler_start_position -
|
| - test_start_position)));
|
| - // Nothing must be logged while profiling is suspended.
|
| - CHECK_EQ(NULL, StrNStr(test_profiler_stop_position,
|
| - "code-creation,",
|
| - static_cast<int>(test_profiler_start_2_position -
|
| - test_profiler_stop_position)));
|
| -}
|
| -
|
| -
|
| // BUG(913). Need to implement support for profiling multiple VM threads.
|
| #if 0
|
|
|
| @@ -396,7 +326,7 @@ static void ObjMethod1(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
|
|
|
|
| TEST(LogCallbacks) {
|
| - ScopedLoggerInitializer initialize_logger(false);
|
| + ScopedLoggerInitializer initialize_logger;
|
| Logger* logger = initialize_logger.logger();
|
|
|
| v8::Local<v8::FunctionTemplate> obj =
|
| @@ -445,7 +375,7 @@ static void Prop2Getter(v8::Local<v8::String> property,
|
|
|
|
|
| TEST(LogAccessorCallbacks) {
|
| - ScopedLoggerInitializer initialize_logger(false);
|
| + ScopedLoggerInitializer initialize_logger;
|
| Logger* logger = initialize_logger.logger();
|
|
|
| v8::Local<v8::FunctionTemplate> obj =
|
| @@ -486,18 +416,6 @@ TEST(LogAccessorCallbacks) {
|
| }
|
|
|
|
|
| -TEST(IsLoggingPreserved) {
|
| - ScopedLoggerInitializer initialize_logger(false);
|
| - Logger* logger = initialize_logger.logger();
|
| -
|
| - CHECK(logger->is_logging());
|
| - logger->ResumeProfiler();
|
| - CHECK(logger->is_logging());
|
| - logger->PauseProfiler();
|
| - CHECK(logger->is_logging());
|
| -}
|
| -
|
| -
|
| typedef i::NativesCollection<i::TEST> TestSources;
|
|
|
|
|
| @@ -514,7 +432,7 @@ TEST(EquivalenceOfLoggingAndTraversal) {
|
| CHECK(!i::V8::IsRunning());
|
|
|
| // Start with profiling to capture all code events from the beginning.
|
| - ScopedLoggerInitializer initialize_logger(false);
|
| + ScopedLoggerInitializer initialize_logger;
|
| Logger* logger = initialize_logger.logger();
|
|
|
| // Compile and run a function that creates other functions.
|
| @@ -523,7 +441,7 @@ TEST(EquivalenceOfLoggingAndTraversal) {
|
| " obj.test =\n"
|
| " (function a(j) { return function b() { return j; } })(100);\n"
|
| "})(this);");
|
| - v8::V8::PauseProfiler();
|
| + logger->StopProfiler();
|
| HEAP->CollectAllGarbage(i::Heap::kMakeHeapIterableMask);
|
| logger->StringEvent("test-logging-done", "");
|
|
|
|
|