diff options
Diffstat (limited to 'deps/v8/test/cctest/cctest.h')
-rw-r--r-- | deps/v8/test/cctest/cctest.h | 45 |
1 files changed, 27 insertions, 18 deletions
diff --git a/deps/v8/test/cctest/cctest.h b/deps/v8/test/cctest/cctest.h index 383771710a..9d4af5af3f 100644 --- a/deps/v8/test/cctest/cctest.h +++ b/deps/v8/test/cctest/cctest.h @@ -37,6 +37,7 @@ #include "src/heap/factory.h" #include "src/isolate.h" #include "src/objects.h" +#include "src/register-configuration.h" #include "src/utils.h" #include "src/v8.h" #include "src/zone/accounting-allocator.h" @@ -50,6 +51,13 @@ class RandomNumberGenerator; namespace internal { +#if defined(V8_TARGET_ARCH_IA32) && defined(V8_EMBEDDED_BUILTINS) +// TODO(v8:6666): Fold into Default config once root is fully supported. +const auto GetRegConfig = RegisterConfiguration::PreserveRootIA32; +#else +const auto GetRegConfig = RegisterConfiguration::Default; +#endif + class HandleScope; class Zone; @@ -131,9 +139,9 @@ class CcTest { static i::Heap* heap(); static void CollectGarbage(i::AllocationSpace space); - static void CollectAllGarbage(); - static void CollectAllGarbage(int flags); - static void CollectAllAvailableGarbage(); + static void CollectAllGarbage(i::Isolate* isolate = nullptr); + static void CollectAllAvailableGarbage(i::Isolate* isolate = nullptr); + static void PreciseCollectAllGarbage(i::Isolate* isolate = nullptr); static v8::base::RandomNumberGenerator* random_number_generator(); @@ -193,7 +201,7 @@ class ApiTestFuzzer: public v8::base::Thread { void CallTest(); // The ApiTestFuzzer is also a Thread, so it has a Run method. - virtual void Run(); + void Run() override; enum PartOfTest { FIRST_PART, @@ -220,7 +228,7 @@ class ApiTestFuzzer: public v8::base::Thread { test_number_(num), gate_(0), active_(true) {} - ~ApiTestFuzzer() {} + ~ApiTestFuzzer() override = default; static bool fuzzing_; static int tests_being_run_; @@ -275,14 +283,15 @@ class RegisterThreadedTest { // A LocalContext holds a reference to a v8::Context. class LocalContext { public: - LocalContext(v8::Isolate* isolate, v8::ExtensionConfiguration* extensions = 0, + LocalContext(v8::Isolate* isolate, + v8::ExtensionConfiguration* extensions = nullptr, v8::Local<v8::ObjectTemplate> global_template = v8::Local<v8::ObjectTemplate>(), v8::Local<v8::Value> global_object = v8::Local<v8::Value>()) { Initialize(isolate, extensions, global_template, global_object); } - LocalContext(v8::ExtensionConfiguration* extensions = 0, + LocalContext(v8::ExtensionConfiguration* extensions = nullptr, v8::Local<v8::ObjectTemplate> global_template = v8::Local<v8::ObjectTemplate>(), v8::Local<v8::Value> global_object = v8::Local<v8::Value>()) { @@ -506,9 +515,7 @@ static inline void ExpectInt32(const char* code, int expected) { static inline void ExpectBoolean(const char* code, bool expected) { v8::Local<v8::Value> result = CompileRun(code); CHECK(result->IsBoolean()); - CHECK_EQ(expected, - result->BooleanValue(v8::Isolate::GetCurrent()->GetCurrentContext()) - .FromJust()); + CHECK_EQ(expected, result->BooleanValue(v8::Isolate::GetCurrent())); } @@ -597,11 +604,11 @@ class StaticOneByteResource : public v8::String::ExternalOneByteStringResource { public: explicit StaticOneByteResource(const char* data) : data_(data) {} - ~StaticOneByteResource() {} + ~StaticOneByteResource() override = default; - const char* data() const { return data_; } + const char* data() const override { return data_; } - size_t length() const { return strlen(data_); } + size_t length() const override { return strlen(data_); } private: const char* data_; @@ -677,13 +684,14 @@ class TestPlatform : public v8::Platform { } void CallOnForegroundThread(v8::Isolate* isolate, v8::Task* task) override { - old_platform_->CallOnForegroundThread(isolate, task); + // This is a deprecated function and should not be called anymore. + UNREACHABLE(); } void CallDelayedOnForegroundThread(v8::Isolate* isolate, v8::Task* task, double delay_in_seconds) override { - old_platform_->CallDelayedOnForegroundThread(isolate, task, - delay_in_seconds); + // This is a deprecated function and should not be called anymore. + UNREACHABLE(); } double MonotonicallyIncreasingTime() override { @@ -696,7 +704,8 @@ class TestPlatform : public v8::Platform { void CallIdleOnForegroundThread(v8::Isolate* isolate, v8::IdleTask* task) override { - old_platform_->CallIdleOnForegroundThread(isolate, task); + // This is a deprecated function and should not be called anymore. + UNREACHABLE(); } bool IdleTasksEnabled(v8::Isolate* isolate) override { @@ -709,7 +718,7 @@ class TestPlatform : public v8::Platform { protected: TestPlatform() : old_platform_(i::V8::GetCurrentPlatform()) {} - ~TestPlatform() { i::V8::SetPlatformForTesting(old_platform_); } + ~TestPlatform() override { i::V8::SetPlatformForTesting(old_platform_); } v8::Platform* old_platform() const { return old_platform_; } |