Commit f5a508f3 authored by Jochen Eisinger's avatar Jochen Eisinger Committed by Commit Bot

Disable other background modules while testing the CompilerDispatcher

R=rmcilroy@chromium.org,mlippautz@chromium.org
BUG=v8:6069

Change-Id: Iea0134ef3a0252f5a6f4ae2154218776dc6ff96d
Reviewed-on: https://chromium-review.googlesource.com/453960Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Commit-Queue: Jochen Eisinger <jochen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#43786}
parent 39e14759
...@@ -562,7 +562,6 @@ void CompilerDispatcher::ConsiderJobForBackgroundProcessing( ...@@ -562,7 +562,6 @@ void CompilerDispatcher::ConsiderJobForBackgroundProcessing(
void CompilerDispatcher::ScheduleMoreBackgroundTasksIfNeeded() { void CompilerDispatcher::ScheduleMoreBackgroundTasksIfNeeded() {
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"),
"V8.CompilerDispatcherScheduleMoreBackgroundTasksIfNeeded"); "V8.CompilerDispatcherScheduleMoreBackgroundTasksIfNeeded");
if (FLAG_single_threaded) return;
{ {
base::LockGuard<base::Mutex> lock(&mutex_); base::LockGuard<base::Mutex> lock(&mutex_);
if (pending_background_jobs_.empty()) return; if (pending_background_jobs_.empty()) return;
......
...@@ -1282,6 +1282,7 @@ DEFINE_NEG_IMPLICATION(single_threaded, concurrent_recompilation) ...@@ -1282,6 +1282,7 @@ DEFINE_NEG_IMPLICATION(single_threaded, concurrent_recompilation)
DEFINE_NEG_IMPLICATION(single_threaded, concurrent_sweeping) DEFINE_NEG_IMPLICATION(single_threaded, concurrent_sweeping)
DEFINE_NEG_IMPLICATION(single_threaded, parallel_compaction) DEFINE_NEG_IMPLICATION(single_threaded, parallel_compaction)
DEFINE_NEG_IMPLICATION(single_threaded, concurrent_store_buffer) DEFINE_NEG_IMPLICATION(single_threaded, concurrent_store_buffer)
DEFINE_NEG_IMPLICATION(single_threaded, compiler_dispatcher)
#undef FLAG #undef FLAG
......
...@@ -15,7 +15,7 @@ namespace internal { ...@@ -15,7 +15,7 @@ namespace internal {
#include "src/flag-definitions.h" // NOLINT #include "src/flag-definitions.h" // NOLINT
// The global list of all flags. // The global list of all flags.
class FlagList { class V8_EXPORT_PRIVATE FlagList {
public: public:
// The list of all flags with a value different from the default // The list of all flags with a value different from the default
// and their values. The format of the list is like the format of the // and their values. The format of the list is like the format of the
......
...@@ -30,24 +30,27 @@ class CompilerDispatcherJobTest : public TestWithContext { ...@@ -30,24 +30,27 @@ class CompilerDispatcherJobTest : public TestWithContext {
CompilerDispatcherTracer* tracer() { return &tracer_; } CompilerDispatcherTracer* tracer() { return &tracer_; }
static void SetUpTestCase() { static void SetUpTestCase() {
old_flag_ = i::FLAG_ignition; CHECK_NULL(save_flags_);
i::FLAG_ignition = true; save_flags_ = new SaveFlags();
FLAG_ignition = true;
TestWithContext::SetUpTestCase(); TestWithContext::SetUpTestCase();
} }
static void TearDownTestCase() { static void TearDownTestCase() {
TestWithContext::TearDownTestCase(); TestWithContext::TearDownTestCase();
i::FLAG_ignition = old_flag_; CHECK_NOT_NULL(save_flags_);
delete save_flags_;
save_flags_ = nullptr;
} }
private: private:
CompilerDispatcherTracer tracer_; CompilerDispatcherTracer tracer_;
static bool old_flag_; static SaveFlags* save_flags_;
DISALLOW_COPY_AND_ASSIGN(CompilerDispatcherJobTest); DISALLOW_COPY_AND_ASSIGN(CompilerDispatcherJobTest);
}; };
bool CompilerDispatcherJobTest::old_flag_; SaveFlags* CompilerDispatcherJobTest::save_flags_ = nullptr;
namespace { namespace {
......
...@@ -26,26 +26,27 @@ namespace internal { ...@@ -26,26 +26,27 @@ namespace internal {
class CompilerDispatcherTestFlags { class CompilerDispatcherTestFlags {
public: public:
static void SetFlagsForTest() { static void SetFlagsForTest() {
old_compiler_dispatcher_flag_ = i::FLAG_compiler_dispatcher; CHECK_NULL(save_flags_);
i::FLAG_compiler_dispatcher = true; save_flags_ = new SaveFlags();
old_ignition_flag_ = i::FLAG_ignition; FLAG_single_threaded = true;
i::FLAG_ignition = true; FLAG_ignition = true;
FlagList::EnforceFlagImplications();
FLAG_compiler_dispatcher = true;
} }
static void RestoreFlags() { static void RestoreFlags() {
i::FLAG_compiler_dispatcher = old_compiler_dispatcher_flag_; CHECK_NOT_NULL(save_flags_);
i::FLAG_ignition = old_ignition_flag_; delete save_flags_;
save_flags_ = nullptr;
} }
private: private:
static bool old_compiler_dispatcher_flag_; static SaveFlags* save_flags_;
static bool old_ignition_flag_;
DISALLOW_IMPLICIT_CONSTRUCTORS(CompilerDispatcherTestFlags); DISALLOW_IMPLICIT_CONSTRUCTORS(CompilerDispatcherTestFlags);
}; };
bool CompilerDispatcherTestFlags::old_compiler_dispatcher_flag_; SaveFlags* CompilerDispatcherTestFlags::save_flags_ = nullptr;
bool CompilerDispatcherTestFlags::old_ignition_flag_;
class CompilerDispatcherTest : public TestWithContext { class CompilerDispatcherTest : public TestWithContext {
public: public:
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "src/base/platform/time.h" #include "src/base/platform/time.h"
#include "src/flags.h" #include "src/flags.h"
#include "src/isolate.h" #include "src/isolate.h"
#include "src/list-inl.h"
#include "src/objects-inl.h" #include "src/objects-inl.h"
#include "src/v8.h" #include "src/v8.h"
...@@ -96,5 +97,20 @@ Handle<Context> TestWithNativeContext::native_context() const { ...@@ -96,5 +97,20 @@ Handle<Context> TestWithNativeContext::native_context() const {
return isolate()->native_context(); return isolate()->native_context();
} }
SaveFlags::SaveFlags() { non_default_flags_ = FlagList::argv(); }
SaveFlags::~SaveFlags() {
FlagList::ResetAllFlags();
int argc = non_default_flags_->length();
FlagList::SetFlagsFromCommandLine(
&argc, const_cast<char**>(non_default_flags_->begin()),
false /* remove_flags */);
for (auto flag = non_default_flags_->begin();
flag != non_default_flags_->end(); ++flag) {
delete[] * flag;
}
delete non_default_flags_;
}
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "include/v8.h" #include "include/v8.h"
#include "src/base/macros.h" #include "src/base/macros.h"
#include "src/base/utils/random-number-generator.h" #include "src/base/utils/random-number-generator.h"
#include "src/list.h"
#include "src/zone/accounting-allocator.h" #include "src/zone/accounting-allocator.h"
#include "src/zone/zone.h" #include "src/zone/zone.h"
#include "testing/gtest-support.h" #include "testing/gtest-support.h"
...@@ -135,6 +136,17 @@ class TestWithNativeContext : public virtual ::v8::TestWithContext, ...@@ -135,6 +136,17 @@ class TestWithNativeContext : public virtual ::v8::TestWithContext,
DISALLOW_COPY_AND_ASSIGN(TestWithNativeContext); DISALLOW_COPY_AND_ASSIGN(TestWithNativeContext);
}; };
class SaveFlags {
public:
SaveFlags();
~SaveFlags();
private:
List<const char*>* non_default_flags_;
DISALLOW_COPY_AND_ASSIGN(SaveFlags);
};
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment