Commit 0eb28cd5 authored by Bill Budge's avatar Bill Budge Committed by Commit Bot

[cctest] Simplify tests that mock v8::Platform.

Adds a base class TestPlatform which implements the most common defaults
for v8::Platform methods.

Reworks existing cctests and unittests to use TestPlatform.

Bug: 
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_chromium_rel_ng
Change-Id: Ifeb28a5a190529697d5bcac227e80b10d454d9bd
Reviewed-on: https://chromium-review.googlesource.com/590194Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Commit-Queue: Bill Budge <bbudge@chromium.org>
Cr-Commit-Position: refs/heads/master@{#47050}
parent 7a5a777c
......@@ -31,6 +31,7 @@
#include <memory>
#include "include/libplatform/libplatform.h"
#include "include/v8-platform.h"
#include "src/debug/debug-interface.h"
#include "src/flags.h"
#include "src/utils.h"
......@@ -634,4 +635,58 @@ class ManualGCScope {
bool flag_stress_incremental_marking_;
};
// This is an abstract base class that can be overridden to implement a test
// platform. It delegates all operations to a given platform at the time
// of construction.
class TestPlatform : public v8::Platform {
public:
// v8::Platform implementation.
void OnCriticalMemoryPressure() override {
old_platform_->OnCriticalMemoryPressure();
}
void CallOnBackgroundThread(v8::Task* task,
ExpectedRuntime expected_runtime) override {
old_platform_->CallOnBackgroundThread(task, expected_runtime);
}
void CallOnForegroundThread(v8::Isolate* isolate, v8::Task* task) override {
old_platform_->CallOnForegroundThread(isolate, task);
}
void CallDelayedOnForegroundThread(v8::Isolate* isolate, v8::Task* task,
double delay_in_seconds) override {
old_platform_->CallDelayedOnForegroundThread(isolate, task,
delay_in_seconds);
}
double MonotonicallyIncreasingTime() override {
return old_platform_->MonotonicallyIncreasingTime();
}
void CallIdleOnForegroundThread(v8::Isolate* isolate,
v8::IdleTask* task) override {
old_platform_->CallIdleOnForegroundThread(isolate, task);
}
bool IdleTasksEnabled(v8::Isolate* isolate) override {
return old_platform_->IdleTasksEnabled(isolate);
}
v8::TracingController* GetTracingController() override {
return old_platform_->GetTracingController();
}
protected:
TestPlatform() : old_platform_(i::V8::GetCurrentPlatform()) {}
~TestPlatform() { i::V8::SetPlatformForTesting(old_platform_); }
v8::Platform* old_platform() const { return old_platform_; }
private:
v8::Platform* old_platform_;
DISALLOW_COPY_AND_ASSIGN(TestPlatform);
};
#endif // ifndef CCTEST_H_
......@@ -31,41 +31,20 @@ using v8::Isolate;
namespace v8 {
namespace internal {
class MockPlatform : public v8::Platform {
class MockPlatform : public TestPlatform {
public:
explicit MockPlatform(v8::Platform* platform)
: platform_(platform), task_(nullptr) {}
virtual ~MockPlatform() { delete task_; }
void CallOnBackgroundThread(Task* task,
ExpectedRuntime expected_runtime) override {
platform_->CallOnBackgroundThread(task, expected_runtime);
MockPlatform() : task_(nullptr) {
// Now that it's completely constructed, make this the current platform.
i::V8::SetPlatformForTesting(this);
}
virtual ~MockPlatform() { delete task_; }
void CallOnForegroundThread(v8::Isolate* isolate, Task* task) override {
task_ = task;
}
void CallDelayedOnForegroundThread(v8::Isolate* isolate, Task* task,
double delay_in_seconds) override {
platform_->CallDelayedOnForegroundThread(isolate, task, delay_in_seconds);
}
double MonotonicallyIncreasingTime() override {
return platform_->MonotonicallyIncreasingTime();
}
void CallIdleOnForegroundThread(v8::Isolate* isolate,
IdleTask* task) override {
platform_->CallIdleOnForegroundThread(isolate, task);
}
bool IdleTasksEnabled(v8::Isolate* isolate) override { return false; }
v8::TracingController* GetTracingController() override {
return platform_->GetTracingController();
}
bool PendingTask() { return task_ != nullptr; }
void PerformTask() {
......@@ -76,7 +55,6 @@ class MockPlatform : public v8::Platform {
}
private:
v8::Platform* platform_;
Task* task_;
};
......@@ -84,9 +62,7 @@ TEST(IncrementalMarkingUsingTasks) {
if (!i::FLAG_incremental_marking) return;
FLAG_stress_incremental_marking = false;
CcTest::InitializeVM();
v8::Platform* old_platform = i::V8::GetCurrentPlatform();
MockPlatform platform(old_platform);
i::V8::SetPlatformForTesting(&platform);
MockPlatform platform;
i::heap::SimulateFullSpace(CcTest::heap()->old_space());
i::IncrementalMarking* marking = CcTest::heap()->incremental_marking();
marking->Stop();
......@@ -96,7 +72,6 @@ TEST(IncrementalMarkingUsingTasks) {
platform.PerformTask();
}
CHECK(marking->IsStopped());
i::V8::SetPlatformForTesting(old_platform);
}
} // namespace internal
......
......@@ -23,54 +23,27 @@ using v8::Task;
namespace {
// Minimal implementation of platform that can receive OOM callbacks.
class MockAllocationPlatform : public v8::Platform {
// Implementation of v8::Platform that can register OOM callbacks.
class AllocationPlatform : public TestPlatform {
public:
MockAllocationPlatform() { current_platform = this; }
virtual ~MockAllocationPlatform() {}
void OnCriticalMemoryPressure() override { oom_callback_called = true; }
void CallOnBackgroundThread(Task* task,
ExpectedRuntime expected_runtime) override {}
void CallOnForegroundThread(Isolate* isolate, Task* task) override {}
void CallDelayedOnForegroundThread(Isolate* isolate, Task* task,
double delay_in_seconds) override {}
double MonotonicallyIncreasingTime() override { return 0.0; }
void CallIdleOnForegroundThread(Isolate* isolate, IdleTask* task) override {}
bool IdleTasksEnabled(Isolate* isolate) override { return false; }
v8::TracingController* GetTracingController() override {
return &tracing_controller_;
AllocationPlatform() {
current_platform = this;
// Now that it's completely constructed, make this the current platform.
i::V8::SetPlatformForTesting(this);
}
virtual ~AllocationPlatform() = default;
bool PendingIdleTask() { return false; }
void PerformIdleTask(double idle_time_in_seconds) {}
bool PendingDelayedTask() { return false; }
void PerformDelayedTask() {}
void OnCriticalMemoryPressure() override { oom_callback_called = true; }
static MockAllocationPlatform* current_platform;
static AllocationPlatform* current_platform;
bool oom_callback_called = false;
private:
v8::TracingController tracing_controller_;
DISALLOW_COPY_AND_ASSIGN(MockAllocationPlatform);
};
MockAllocationPlatform* MockAllocationPlatform::current_platform = nullptr;
AllocationPlatform* AllocationPlatform::current_platform = nullptr;
bool DidCallOnCriticalMemoryPressure() {
return MockAllocationPlatform::current_platform &&
MockAllocationPlatform::current_platform->oom_callback_called;
return AllocationPlatform::current_platform &&
AllocationPlatform::current_platform->oom_callback_called;
}
// No OS should be able to malloc/new this number of bytes. Generate enough
......@@ -112,25 +85,16 @@ void OnAlignedAllocOOM(const char* location, const char* message) {
} // namespace
TEST(AccountingAllocatorOOM) {
// TODO(bbudge) Implement a TemporaryPlatformScope to simplify test code.
v8::Platform* old_platform = i::V8::GetCurrentPlatform();
MockAllocationPlatform platform;
i::V8::SetPlatformForTesting(&platform);
AllocationPlatform platform;
v8::internal::AccountingAllocator allocator;
CHECK(!platform.oom_callback_called);
v8::internal::Segment* result = allocator.GetSegment(GetHugeMemoryAmount());
// On a few systems, allocation somehow succeeds.
CHECK_EQ(result == nullptr, platform.oom_callback_called);
i::V8::SetPlatformForTesting(old_platform);
}
TEST(MallocedOperatorNewOOM) {
v8::Platform* old_platform = i::V8::GetCurrentPlatform();
MockAllocationPlatform platform;
i::V8::SetPlatformForTesting(&platform);
AllocationPlatform platform;
CHECK(!platform.oom_callback_called);
CcTest::isolate()->SetFatalErrorHandler(OnMallocedOperatorNewOOM);
// On failure, this won't return, since a Malloced::New failure is fatal.
......@@ -138,15 +102,10 @@ TEST(MallocedOperatorNewOOM) {
void* result = v8::internal::Malloced::New(GetHugeMemoryAmount());
// On a few systems, allocation somehow succeeds.
CHECK_EQ(result == nullptr, platform.oom_callback_called);
i::V8::SetPlatformForTesting(old_platform);
}
TEST(NewArrayOOM) {
v8::Platform* old_platform = i::V8::GetCurrentPlatform();
MockAllocationPlatform platform;
i::V8::SetPlatformForTesting(&platform);
AllocationPlatform platform;
CHECK(!platform.oom_callback_called);
CcTest::isolate()->SetFatalErrorHandler(OnNewArrayOOM);
// On failure, this won't return, since a NewArray failure is fatal.
......@@ -154,15 +113,10 @@ TEST(NewArrayOOM) {
int8_t* result = v8::internal::NewArray<int8_t>(GetHugeMemoryAmount());
// On a few systems, allocation somehow succeeds.
CHECK_EQ(result == nullptr, platform.oom_callback_called);
i::V8::SetPlatformForTesting(old_platform);
}
TEST(AlignedAllocOOM) {
v8::Platform* old_platform = i::V8::GetCurrentPlatform();
MockAllocationPlatform platform;
i::V8::SetPlatformForTesting(&platform);
AllocationPlatform platform;
CHECK(!platform.oom_callback_called);
CcTest::isolate()->SetFatalErrorHandler(OnAlignedAllocOOM);
// On failure, this won't return, since an AlignedAlloc failure is fatal.
......@@ -171,15 +125,10 @@ TEST(AlignedAllocOOM) {
v8::base::OS::AllocateAlignment());
// On a few systems, allocation somehow succeeds.
CHECK_EQ(result == nullptr, platform.oom_callback_called);
i::V8::SetPlatformForTesting(old_platform);
}
TEST(AllocVirtualMemoryOOM) {
v8::Platform* old_platform = i::V8::GetCurrentPlatform();
MockAllocationPlatform platform;
i::V8::SetPlatformForTesting(&platform);
AllocationPlatform platform;
CHECK(!platform.oom_callback_called);
v8::base::VirtualMemory result;
bool success =
......@@ -187,15 +136,10 @@ TEST(AllocVirtualMemoryOOM) {
// On a few systems, allocation somehow succeeds.
CHECK_IMPLIES(success, result.IsReserved());
CHECK_IMPLIES(!success, !result.IsReserved() && platform.oom_callback_called);
i::V8::SetPlatformForTesting(old_platform);
}
TEST(AlignedAllocVirtualMemoryOOM) {
v8::Platform* old_platform = i::V8::GetCurrentPlatform();
MockAllocationPlatform platform;
i::V8::SetPlatformForTesting(&platform);
AllocationPlatform platform;
CHECK(!platform.oom_callback_called);
v8::base::VirtualMemory result;
bool success = v8::internal::AlignedAllocVirtualMemory(
......@@ -204,8 +148,6 @@ TEST(AlignedAllocVirtualMemoryOOM) {
// On a few systems, allocation somehow succeeds.
CHECK_IMPLIES(success, result.IsReserved());
CHECK_IMPLIES(!success, !result.IsReserved() && platform.oom_callback_called);
i::V8::SetPlatformForTesting(old_platform);
}
#endif // !defined(V8_USE_ADDRESS_SANITIZER) && !defined(MEMORY_SANITIZER) &&
......
......@@ -84,65 +84,39 @@ class MockTracingController : public v8::TracingController {
DISALLOW_COPY_AND_ASSIGN(MockTracingController);
};
class MockTracingPlatform : public v8::Platform {
class MockTracingPlatform : public TestPlatform {
public:
explicit MockTracingPlatform(v8::Platform* platform) {}
MockTracingPlatform() {
// Now that it's completely constructed, make this the current platform.
i::V8::SetPlatformForTesting(this);
}
virtual ~MockTracingPlatform() {}
void CallOnBackgroundThread(Task* task,
ExpectedRuntime expected_runtime) override {}
void CallOnForegroundThread(Isolate* isolate, Task* task) override {}
void CallDelayedOnForegroundThread(Isolate* isolate, Task* task,
double delay_in_seconds) override {}
double MonotonicallyIncreasingTime() override { return 0.0; }
void CallIdleOnForegroundThread(Isolate* isolate, IdleTask* task) override {}
bool IdleTasksEnabled(Isolate* isolate) override { return false; }
v8::TracingController* GetTracingController() override {
return &tracing_controller_;
}
bool PendingIdleTask() { return false; }
void PerformIdleTask(double idle_time_in_seconds) {}
bool PendingDelayedTask() { return false; }
void PerformDelayedTask() {}
MockTraceObjectList* GetMockTraceObjects() {
return tracing_controller_.GetMockTraceObjects();
}
private:
MockTracingController tracing_controller_;
DISALLOW_COPY_AND_ASSIGN(MockTracingPlatform);
};
TEST(TraceEventDisabledCategory) {
v8::Platform* old_platform = i::V8::GetCurrentPlatform();
MockTracingPlatform platform(old_platform);
i::V8::SetPlatformForTesting(&platform);
MockTracingPlatform platform;
// Disabled category, will not add events.
TRACE_EVENT_BEGIN0("cat", "e1");
TRACE_EVENT_END0("cat", "e1");
CHECK_EQ(0, GET_TRACE_OBJECTS_LIST->length());
i::V8::SetPlatformForTesting(old_platform);
}
TEST(TraceEventNoArgs) {
v8::Platform* old_platform = i::V8::GetCurrentPlatform();
MockTracingPlatform platform(old_platform);
i::V8::SetPlatformForTesting(&platform);
MockTracingPlatform platform;
// Enabled category will add 2 events.
TRACE_EVENT_BEGIN0("v8-cat", "e1");
......@@ -156,15 +130,11 @@ TEST(TraceEventNoArgs) {
CHECK_EQ('E', GET_TRACE_OBJECT(1)->phase);
CHECK_EQ("e1", GET_TRACE_OBJECT(1)->name);
CHECK_EQ(0, GET_TRACE_OBJECT(1)->num_args);
i::V8::SetPlatformForTesting(old_platform);
}
TEST(TraceEventWithOneArg) {
v8::Platform* old_platform = i::V8::GetCurrentPlatform();
MockTracingPlatform platform(old_platform);
i::V8::SetPlatformForTesting(&platform);
MockTracingPlatform platform;
TRACE_EVENT_BEGIN1("v8-cat", "e1", "arg1", 42);
TRACE_EVENT_END1("v8-cat", "e1", "arg1", 42);
......@@ -177,15 +147,11 @@ TEST(TraceEventWithOneArg) {
CHECK_EQ(1, GET_TRACE_OBJECT(1)->num_args);
CHECK_EQ(1, GET_TRACE_OBJECT(2)->num_args);
CHECK_EQ(1, GET_TRACE_OBJECT(3)->num_args);
i::V8::SetPlatformForTesting(old_platform);
}
TEST(TraceEventWithTwoArgs) {
v8::Platform* old_platform = i::V8::GetCurrentPlatform();
MockTracingPlatform platform(old_platform);
i::V8::SetPlatformForTesting(&platform);
MockTracingPlatform platform;
TRACE_EVENT_BEGIN2("v8-cat", "e1", "arg1", 42, "arg2", "abc");
TRACE_EVENT_END2("v8-cat", "e1", "arg1", 42, "arg2", "abc");
......@@ -198,15 +164,11 @@ TEST(TraceEventWithTwoArgs) {
CHECK_EQ(2, GET_TRACE_OBJECT(1)->num_args);
CHECK_EQ(2, GET_TRACE_OBJECT(2)->num_args);
CHECK_EQ(2, GET_TRACE_OBJECT(3)->num_args);
i::V8::SetPlatformForTesting(old_platform);
}
TEST(ScopedTraceEvent) {
v8::Platform* old_platform = i::V8::GetCurrentPlatform();
MockTracingPlatform platform(old_platform);
i::V8::SetPlatformForTesting(&platform);
MockTracingPlatform platform;
{ TRACE_EVENT0("v8-cat", "e"); }
......@@ -222,15 +184,11 @@ TEST(ScopedTraceEvent) {
CHECK_EQ(3, GET_TRACE_OBJECTS_LIST->length());
CHECK_EQ(2, GET_TRACE_OBJECT(2)->num_args);
i::V8::SetPlatformForTesting(old_platform);
}
TEST(TestEventWithFlow) {
v8::Platform* old_platform = i::V8::GetCurrentPlatform();
MockTracingPlatform platform(old_platform);
i::V8::SetPlatformForTesting(&platform);
MockTracingPlatform platform;
static uint64_t bind_id = 21;
{
......@@ -251,15 +209,11 @@ TEST(TestEventWithFlow) {
GET_TRACE_OBJECT(1)->flags);
CHECK_EQ(bind_id, GET_TRACE_OBJECT(2)->bind_id);
CHECK_EQ(TRACE_EVENT_FLAG_FLOW_IN, GET_TRACE_OBJECT(2)->flags);
i::V8::SetPlatformForTesting(old_platform);
}
TEST(TestEventWithId) {
v8::Platform* old_platform = i::V8::GetCurrentPlatform();
MockTracingPlatform platform(old_platform);
i::V8::SetPlatformForTesting(&platform);
MockTracingPlatform platform;
static uint64_t event_id = 21;
TRACE_EVENT_ASYNC_BEGIN0("v8-cat", "a1", event_id);
......@@ -270,14 +224,10 @@ TEST(TestEventWithId) {
CHECK_EQ(event_id, GET_TRACE_OBJECT(0)->id);
CHECK_EQ(TRACE_EVENT_PHASE_ASYNC_END, GET_TRACE_OBJECT(1)->phase);
CHECK_EQ(event_id, GET_TRACE_OBJECT(1)->id);
i::V8::SetPlatformForTesting(old_platform);
}
TEST(TestEventInContext) {
v8::Platform* old_platform = i::V8::GetCurrentPlatform();
MockTracingPlatform platform(old_platform);
i::V8::SetPlatformForTesting(&platform);
MockTracingPlatform platform;
static uint64_t isolate_id = 0x20151021;
{
......@@ -294,6 +244,4 @@ TEST(TestEventInContext) {
CHECK_EQ(TRACE_EVENT_PHASE_LEAVE_CONTEXT, GET_TRACE_OBJECT(2)->phase);
CHECK_EQ("Isolate", GET_TRACE_OBJECT(2)->name);
CHECK_EQ(isolate_id, GET_TRACE_OBJECT(2)->id);
i::V8::SetPlatformForTesting(old_platform);
}
......@@ -115,12 +115,12 @@ namespace {
class MockPlatform : public v8::Platform {
public:
explicit MockPlatform(v8::TracingController* tracing_controller)
MockPlatform()
: time_(0.0),
time_step_(0.0),
idle_task_(nullptr),
sem_(0),
tracing_controller_(tracing_controller) {}
tracing_controller_(V8::GetCurrentPlatform()->GetTracingController()) {}
~MockPlatform() override {
base::LockGuard<base::Mutex> lock(&mutex_);
EXPECT_TRUE(foreground_tasks_.empty());
......@@ -300,12 +300,12 @@ const char test_script[] = "(x) { x*x; }";
} // namespace
TEST_F(CompilerDispatcherTest, Construct) {
MockPlatform platform(V8::GetCurrentPlatform()->GetTracingController());
MockPlatform platform;
CompilerDispatcher dispatcher(i_isolate(), &platform, FLAG_stack_size);
}
TEST_F(CompilerDispatcherTest, IsEnqueued) {
MockPlatform platform(V8::GetCurrentPlatform()->GetTracingController());
MockPlatform platform;
CompilerDispatcher dispatcher(i_isolate(), &platform, FLAG_stack_size);
const char script[] = TEST_SCRIPT();
......@@ -323,7 +323,7 @@ TEST_F(CompilerDispatcherTest, IsEnqueued) {
}
TEST_F(CompilerDispatcherTest, FinishNow) {
MockPlatform platform(V8::GetCurrentPlatform()->GetTracingController());
MockPlatform platform;
CompilerDispatcher dispatcher(i_isolate(), &platform, FLAG_stack_size);
const char script[] = TEST_SCRIPT();
......@@ -342,7 +342,7 @@ TEST_F(CompilerDispatcherTest, FinishNow) {
}
TEST_F(CompilerDispatcherTest, FinishAllNow) {
MockPlatform platform(V8::GetCurrentPlatform()->GetTracingController());
MockPlatform platform;
CompilerDispatcher dispatcher(i_isolate(), &platform, FLAG_stack_size);
constexpr int num_funcs = 2;
......@@ -372,7 +372,7 @@ TEST_F(CompilerDispatcherTest, FinishAllNow) {
}
TEST_F(CompilerDispatcherTest, IdleTask) {
MockPlatform platform(V8::GetCurrentPlatform()->GetTracingController());
MockPlatform platform;
CompilerDispatcher dispatcher(i_isolate(), &platform, FLAG_stack_size);
const char script[] = TEST_SCRIPT();
......@@ -393,7 +393,7 @@ TEST_F(CompilerDispatcherTest, IdleTask) {
}
TEST_F(CompilerDispatcherTest, IdleTaskSmallIdleTime) {
MockPlatform platform(V8::GetCurrentPlatform()->GetTracingController());
MockPlatform platform;
CompilerDispatcher dispatcher(i_isolate(), &platform, FLAG_stack_size);
const char script[] = TEST_SCRIPT();
......@@ -432,7 +432,7 @@ TEST_F(CompilerDispatcherTest, IdleTaskSmallIdleTime) {
}
TEST_F(CompilerDispatcherTest, IdleTaskException) {
MockPlatform platform(V8::GetCurrentPlatform()->GetTracingController());
MockPlatform platform;
CompilerDispatcher dispatcher(i_isolate(), &platform, 50);
std::string func_name("f" STR(__LINE__));
......@@ -459,7 +459,7 @@ TEST_F(CompilerDispatcherTest, IdleTaskException) {
}
TEST_F(CompilerDispatcherTest, CompileOnBackgroundThread) {
MockPlatform platform(V8::GetCurrentPlatform()->GetTracingController());
MockPlatform platform;
CompilerDispatcher dispatcher(i_isolate(), &platform, FLAG_stack_size);
const char script[] = TEST_SCRIPT();
......@@ -503,7 +503,7 @@ TEST_F(CompilerDispatcherTest, CompileOnBackgroundThread) {
}
TEST_F(CompilerDispatcherTest, FinishNowWithBackgroundTask) {
MockPlatform platform(V8::GetCurrentPlatform()->GetTracingController());
MockPlatform platform;
CompilerDispatcher dispatcher(i_isolate(), &platform, FLAG_stack_size);
const char script[] = TEST_SCRIPT();
......@@ -543,7 +543,7 @@ TEST_F(CompilerDispatcherTest, FinishNowWithBackgroundTask) {
}
TEST_F(CompilerDispatcherTest, IdleTaskMultipleJobs) {
MockPlatform platform(V8::GetCurrentPlatform()->GetTracingController());
MockPlatform platform;
CompilerDispatcher dispatcher(i_isolate(), &platform, FLAG_stack_size);
const char script1[] = TEST_SCRIPT();
......@@ -572,7 +572,7 @@ TEST_F(CompilerDispatcherTest, IdleTaskMultipleJobs) {
}
TEST_F(CompilerDispatcherTest, FinishNowException) {
MockPlatform platform(V8::GetCurrentPlatform()->GetTracingController());
MockPlatform platform;
CompilerDispatcher dispatcher(i_isolate(), &platform, 50);
std::string func_name("f" STR(__LINE__));
......@@ -600,7 +600,7 @@ TEST_F(CompilerDispatcherTest, FinishNowException) {
}
TEST_F(CompilerDispatcherTest, AsyncAbortAllPendingBackgroundTask) {
MockPlatform platform(V8::GetCurrentPlatform()->GetTracingController());
MockPlatform platform;
CompilerDispatcher dispatcher(i_isolate(), &platform, FLAG_stack_size);
const char script[] = TEST_SCRIPT();
......@@ -643,7 +643,7 @@ TEST_F(CompilerDispatcherTest, AsyncAbortAllPendingBackgroundTask) {
}
TEST_F(CompilerDispatcherTest, AsyncAbortAllRunningBackgroundTask) {
MockPlatform platform(V8::GetCurrentPlatform()->GetTracingController());
MockPlatform platform;
CompilerDispatcher dispatcher(i_isolate(), &platform, FLAG_stack_size);
const char script1[] = TEST_SCRIPT();
......@@ -725,7 +725,7 @@ TEST_F(CompilerDispatcherTest, AsyncAbortAllRunningBackgroundTask) {
}
TEST_F(CompilerDispatcherTest, FinishNowDuringAbortAll) {
MockPlatform platform(V8::GetCurrentPlatform()->GetTracingController());
MockPlatform platform;
CompilerDispatcher dispatcher(i_isolate(), &platform, FLAG_stack_size);
const char script[] = TEST_SCRIPT();
......@@ -804,7 +804,7 @@ TEST_F(CompilerDispatcherTest, FinishNowDuringAbortAll) {
}
TEST_F(CompilerDispatcherTest, MemoryPressure) {
MockPlatform platform(V8::GetCurrentPlatform()->GetTracingController());
MockPlatform platform;
CompilerDispatcher dispatcher(i_isolate(), &platform, FLAG_stack_size);
const char script[] = TEST_SCRIPT();
......@@ -852,7 +852,7 @@ class PressureNotificationTask : public CancelableTask {
} // namespace
TEST_F(CompilerDispatcherTest, MemoryPressureFromBackground) {
MockPlatform platform(V8::GetCurrentPlatform()->GetTracingController());
MockPlatform platform;
CompilerDispatcher dispatcher(i_isolate(), &platform, FLAG_stack_size);
const char script[] = TEST_SCRIPT();
......@@ -885,7 +885,7 @@ TEST_F(CompilerDispatcherTest, MemoryPressureFromBackground) {
}
TEST_F(CompilerDispatcherTest, EnqueueJob) {
MockPlatform platform(V8::GetCurrentPlatform()->GetTracingController());
MockPlatform platform;
CompilerDispatcher dispatcher(i_isolate(), &platform, FLAG_stack_size);
const char script[] = TEST_SCRIPT();
Handle<JSFunction> f =
......@@ -904,7 +904,7 @@ TEST_F(CompilerDispatcherTest, EnqueueJob) {
}
TEST_F(CompilerDispatcherTest, EnqueueWithoutSFI) {
MockPlatform platform(V8::GetCurrentPlatform()->GetTracingController());
MockPlatform platform;
CompilerDispatcher dispatcher(i_isolate(), &platform, FLAG_stack_size);
ASSERT_TRUE(dispatcher.jobs_.empty());
ASSERT_TRUE(dispatcher.shared_to_unoptimized_job_id_.empty());
......@@ -929,7 +929,7 @@ TEST_F(CompilerDispatcherTest, EnqueueWithoutSFI) {
}
TEST_F(CompilerDispatcherTest, EnqueueAndStep) {
MockPlatform platform(V8::GetCurrentPlatform()->GetTracingController());
MockPlatform platform;
CompilerDispatcher dispatcher(i_isolate(), &platform, FLAG_stack_size);
const char script[] = TEST_SCRIPT();
......@@ -1000,7 +1000,7 @@ TEST_F(CompilerDispatcherTest, CompileLazy2FinishesDispatcherJob) {
}
TEST_F(CompilerDispatcherTest, EnqueueAndStepTwice) {
MockPlatform platform(V8::GetCurrentPlatform()->GetTracingController());
MockPlatform platform;
CompilerDispatcher dispatcher(i_isolate(), &platform, FLAG_stack_size);
const char script[] = TEST_SCRIPT();
......@@ -1026,7 +1026,7 @@ TEST_F(CompilerDispatcherTest, EnqueueAndStepTwice) {
}
TEST_F(CompilerDispatcherTest, CompileMultipleOnBackgroundThread) {
MockPlatform platform(V8::GetCurrentPlatform()->GetTracingController());
MockPlatform platform;
CompilerDispatcher dispatcher(i_isolate(), &platform, FLAG_stack_size);
const char script1[] = TEST_SCRIPT();
......
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