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/453960 Reviewed-by: Michael Lippautz <mlippautz@chromium.org> Commit-Queue: Jochen Eisinger <jochen@chromium.org> Cr-Commit-Position: refs/heads/master@{#43786}
This commit is contained in:
parent
39e147593f
commit
f5a508f31f
@ -562,7 +562,6 @@ void CompilerDispatcher::ConsiderJobForBackgroundProcessing(
|
||||
void CompilerDispatcher::ScheduleMoreBackgroundTasksIfNeeded() {
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"),
|
||||
"V8.CompilerDispatcherScheduleMoreBackgroundTasksIfNeeded");
|
||||
if (FLAG_single_threaded) return;
|
||||
{
|
||||
base::LockGuard<base::Mutex> lock(&mutex_);
|
||||
if (pending_background_jobs_.empty()) return;
|
||||
|
@ -1282,6 +1282,7 @@ DEFINE_NEG_IMPLICATION(single_threaded, concurrent_recompilation)
|
||||
DEFINE_NEG_IMPLICATION(single_threaded, concurrent_sweeping)
|
||||
DEFINE_NEG_IMPLICATION(single_threaded, parallel_compaction)
|
||||
DEFINE_NEG_IMPLICATION(single_threaded, concurrent_store_buffer)
|
||||
DEFINE_NEG_IMPLICATION(single_threaded, compiler_dispatcher)
|
||||
|
||||
#undef FLAG
|
||||
|
||||
|
@ -15,7 +15,7 @@ namespace internal {
|
||||
#include "src/flag-definitions.h" // NOLINT
|
||||
|
||||
// The global list of all flags.
|
||||
class FlagList {
|
||||
class V8_EXPORT_PRIVATE FlagList {
|
||||
public:
|
||||
// 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
|
||||
|
@ -30,24 +30,27 @@ class CompilerDispatcherJobTest : public TestWithContext {
|
||||
CompilerDispatcherTracer* tracer() { return &tracer_; }
|
||||
|
||||
static void SetUpTestCase() {
|
||||
old_flag_ = i::FLAG_ignition;
|
||||
i::FLAG_ignition = true;
|
||||
CHECK_NULL(save_flags_);
|
||||
save_flags_ = new SaveFlags();
|
||||
FLAG_ignition = true;
|
||||
TestWithContext::SetUpTestCase();
|
||||
}
|
||||
|
||||
static void TearDownTestCase() {
|
||||
TestWithContext::TearDownTestCase();
|
||||
i::FLAG_ignition = old_flag_;
|
||||
CHECK_NOT_NULL(save_flags_);
|
||||
delete save_flags_;
|
||||
save_flags_ = nullptr;
|
||||
}
|
||||
|
||||
private:
|
||||
CompilerDispatcherTracer tracer_;
|
||||
static bool old_flag_;
|
||||
static SaveFlags* save_flags_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CompilerDispatcherJobTest);
|
||||
};
|
||||
|
||||
bool CompilerDispatcherJobTest::old_flag_;
|
||||
SaveFlags* CompilerDispatcherJobTest::save_flags_ = nullptr;
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -26,26 +26,27 @@ namespace internal {
|
||||
class CompilerDispatcherTestFlags {
|
||||
public:
|
||||
static void SetFlagsForTest() {
|
||||
old_compiler_dispatcher_flag_ = i::FLAG_compiler_dispatcher;
|
||||
i::FLAG_compiler_dispatcher = true;
|
||||
old_ignition_flag_ = i::FLAG_ignition;
|
||||
i::FLAG_ignition = true;
|
||||
CHECK_NULL(save_flags_);
|
||||
save_flags_ = new SaveFlags();
|
||||
FLAG_single_threaded = true;
|
||||
FLAG_ignition = true;
|
||||
FlagList::EnforceFlagImplications();
|
||||
FLAG_compiler_dispatcher = true;
|
||||
}
|
||||
|
||||
static void RestoreFlags() {
|
||||
i::FLAG_compiler_dispatcher = old_compiler_dispatcher_flag_;
|
||||
i::FLAG_ignition = old_ignition_flag_;
|
||||
CHECK_NOT_NULL(save_flags_);
|
||||
delete save_flags_;
|
||||
save_flags_ = nullptr;
|
||||
}
|
||||
|
||||
private:
|
||||
static bool old_compiler_dispatcher_flag_;
|
||||
static bool old_ignition_flag_;
|
||||
static SaveFlags* save_flags_;
|
||||
|
||||
DISALLOW_IMPLICIT_CONSTRUCTORS(CompilerDispatcherTestFlags);
|
||||
};
|
||||
|
||||
bool CompilerDispatcherTestFlags::old_compiler_dispatcher_flag_;
|
||||
bool CompilerDispatcherTestFlags::old_ignition_flag_;
|
||||
SaveFlags* CompilerDispatcherTestFlags::save_flags_ = nullptr;
|
||||
|
||||
class CompilerDispatcherTest : public TestWithContext {
|
||||
public:
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "src/base/platform/time.h"
|
||||
#include "src/flags.h"
|
||||
#include "src/isolate.h"
|
||||
#include "src/list-inl.h"
|
||||
#include "src/objects-inl.h"
|
||||
#include "src/v8.h"
|
||||
|
||||
@ -96,5 +97,20 @@ Handle<Context> TestWithNativeContext::native_context() const {
|
||||
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 v8
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "include/v8.h"
|
||||
#include "src/base/macros.h"
|
||||
#include "src/base/utils/random-number-generator.h"
|
||||
#include "src/list.h"
|
||||
#include "src/zone/accounting-allocator.h"
|
||||
#include "src/zone/zone.h"
|
||||
#include "testing/gtest-support.h"
|
||||
@ -135,6 +136,17 @@ class TestWithNativeContext : public virtual ::v8::TestWithContext,
|
||||
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 v8
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user