Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(399)

Unified Diff: test/cctest/test-api.cc

Issue 358363002: Move platform abstraction to base library (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: updates Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: test/cctest/test-api.cc
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
index 7d251f2a754ed578149bb766e5e7821a1923b3e1..5f78134ec144f2c8f297241448a2e7d21535303b 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -39,13 +39,13 @@
#include "include/v8-util.h"
#include "src/api.h"
#include "src/arguments.h"
+#include "src/base/platform/platform.h"
#include "src/compilation-cache.h"
#include "src/cpu-profiler.h"
#include "src/execution.h"
#include "src/isolate.h"
#include "src/objects.h"
#include "src/parser.h"
-#include "src/platform.h"
#include "src/snapshot.h"
#include "src/unicode-inl.h"
#include "src/utils.h"
@@ -5399,7 +5399,7 @@ THREADED_TEST(Equality) {
CHECK(v8_num(1)->StrictEquals(v8_num(1)));
CHECK(!v8_num(1)->StrictEquals(v8_num(2)));
CHECK(v8_num(0.0)->StrictEquals(v8_num(-0.0)));
- Local<Value> not_a_number = v8_num(i::OS::nan_value());
+ Local<Value> not_a_number = v8_num(v8::base::OS::nan_value());
CHECK(!not_a_number->StrictEquals(not_a_number));
CHECK(v8::False(isolate)->StrictEquals(v8::False(isolate)));
CHECK(!v8::False(isolate)->StrictEquals(v8::Undefined(isolate)));
@@ -13096,7 +13096,7 @@ THREADED_TEST(ObjectGetConstructorName) {
bool ApiTestFuzzer::fuzzing_ = false;
-i::Semaphore ApiTestFuzzer::all_tests_done_(0);
+v8::base::Semaphore ApiTestFuzzer::all_tests_done_(0);
int ApiTestFuzzer::active_tests_;
int ApiTestFuzzer::tests_being_run_;
int ApiTestFuzzer::current_;
@@ -15158,7 +15158,7 @@ struct RegExpInterruptionData {
} regexp_interruption_data;
-class RegExpInterruptionThread : public i::Thread {
+class RegExpInterruptionThread : public v8::base::Thread {
public:
explicit RegExpInterruptionThread(v8::Isolate* isolate)
: Thread("TimeoutThread"), isolate_(isolate) {}
@@ -15167,10 +15167,10 @@ class RegExpInterruptionThread : public i::Thread {
for (regexp_interruption_data.loop_count = 0;
regexp_interruption_data.loop_count < 7;
regexp_interruption_data.loop_count++) {
- i::OS::Sleep(50); // Wait a bit before requesting GC.
+ v8::base::OS::Sleep(50); // Wait a bit before requesting GC.
reinterpret_cast<i::Isolate*>(isolate_)->stack_guard()->RequestGC();
}
- i::OS::Sleep(50); // Wait a bit before terminating.
+ v8::base::OS::Sleep(50); // Wait a bit before terminating.
v8::V8::TerminateExecution(isolate_);
}
@@ -16252,7 +16252,7 @@ static void ObjectWithExternalArrayTestHelper(
CHECK_EQ(0, result->Int32Value());
if (array_type == v8::kExternalFloat64Array ||
array_type == v8::kExternalFloat32Array) {
- CHECK_EQ(static_cast<int>(i::OS::nan_value()),
+ CHECK_EQ(static_cast<int>(v8::base::OS::nan_value()),
static_cast<int>(
i::Object::GetElement(
isolate, jsobj, 7).ToHandleChecked()->Number()));
@@ -18031,7 +18031,7 @@ static uint64_t DoubleToBits(double value) {
static double DoubleToDateTime(double input) {
double date_limit = 864e13;
if (std::isnan(input) || input < -date_limit || input > date_limit) {
- return i::OS::nan_value();
+ return v8::base::OS::nan_value();
}
return (input < 0) ? -(std::floor(-input)) : std::floor(input);
}
@@ -19362,7 +19362,7 @@ static int CalcFibonacci(v8::Isolate* isolate, int limit) {
return static_cast<int>(value->NumberValue());
}
-class IsolateThread : public v8::internal::Thread {
+class IsolateThread : public v8::base::Thread {
public:
IsolateThread(v8::Isolate* isolate, int fib_limit)
: Thread("IsolateThread"),
@@ -19436,7 +19436,7 @@ TEST(IsolateDifferentContexts) {
isolate->Dispose();
}
-class InitDefaultIsolateThread : public v8::internal::Thread {
+class InitDefaultIsolateThread : public v8::base::Thread {
public:
enum TestCase {
SetResourceConstraints,
@@ -20546,13 +20546,13 @@ uint8_t callback_fired = 0;
void CallCompletedCallback1() {
- i::OS::Print("Firing callback 1.\n");
+ v8::base::OS::Print("Firing callback 1.\n");
callback_fired ^= 1; // Toggle first bit.
}
void CallCompletedCallback2() {
- i::OS::Print("Firing callback 2.\n");
+ v8::base::OS::Print("Firing callback 2.\n");
callback_fired ^= 2; // Toggle second bit.
}
@@ -20561,15 +20561,15 @@ void RecursiveCall(const v8::FunctionCallbackInfo<v8::Value>& args) {
int32_t level = args[0]->Int32Value();
if (level < 3) {
level++;
- i::OS::Print("Entering recursion level %d.\n", level);
+ v8::base::OS::Print("Entering recursion level %d.\n", level);
char script[64];
i::Vector<char> script_vector(script, sizeof(script));
i::SNPrintF(script_vector, "recursion(%d)", level);
CompileRun(script_vector.start());
- i::OS::Print("Leaving recursion level %d.\n", level);
+ v8::base::OS::Print("Leaving recursion level %d.\n", level);
CHECK_EQ(0, callback_fired);
} else {
- i::OS::Print("Recursion ends.\n");
+ v8::base::OS::Print("Recursion ends.\n");
CHECK_EQ(0, callback_fired);
}
}
@@ -20586,19 +20586,19 @@ TEST(CallCompletedCallback) {
env->GetIsolate()->AddCallCompletedCallback(CallCompletedCallback1);
env->GetIsolate()->AddCallCompletedCallback(CallCompletedCallback1);
env->GetIsolate()->AddCallCompletedCallback(CallCompletedCallback2);
- i::OS::Print("--- Script (1) ---\n");
+ v8::base::OS::Print("--- Script (1) ---\n");
Local<Script> script = v8::Script::Compile(
v8::String::NewFromUtf8(env->GetIsolate(), "recursion(0)"));
script->Run();
CHECK_EQ(3, callback_fired);
- i::OS::Print("\n--- Script (2) ---\n");
+ v8::base::OS::Print("\n--- Script (2) ---\n");
callback_fired = 0;
env->GetIsolate()->RemoveCallCompletedCallback(CallCompletedCallback1);
script->Run();
CHECK_EQ(2, callback_fired);
- i::OS::Print("\n--- Function ---\n");
+ v8::base::OS::Print("\n--- Function ---\n");
callback_fired = 0;
Local<Function> recursive_function =
Local<Function>::Cast(env->Global()->Get(v8_str("recursion")));
@@ -21506,7 +21506,7 @@ class ThreadInterruptTest {
private:
static const int kExpectedValue = 1;
- class InterruptThread : public i::Thread {
+ class InterruptThread : public v8::base::Thread {
public:
explicit InterruptThread(ThreadInterruptTest* test)
: Thread("InterruptThread"), test_(test) {}
@@ -21515,7 +21515,7 @@ class ThreadInterruptTest {
struct sigaction action;
// Ensure that we'll enter waiting condition
- i::OS::Sleep(100);
+ v8::base::OS::Sleep(100);
// Setup signal handler
memset(&action, 0, sizeof(action));
@@ -21526,7 +21526,7 @@ class ThreadInterruptTest {
kill(getpid(), SIGCHLD);
// Ensure that if wait has returned because of error
- i::OS::Sleep(100);
+ v8::base::OS::Sleep(100);
// Set value and signal semaphore
test_->sem_value_ = 1;
@@ -21540,7 +21540,7 @@ class ThreadInterruptTest {
ThreadInterruptTest* test_;
};
- i::Semaphore sem_;
+ v8::base::Semaphore sem_;
volatile int sem_value_;
};
@@ -21900,7 +21900,7 @@ class RequestInterruptTestBase {
LocalContext env_;
v8::Isolate* isolate_;
- i::Semaphore sem_;
+ v8::base::Semaphore sem_;
int warmup_;
bool should_continue_;
};
@@ -21916,7 +21916,7 @@ class RequestInterruptTestBaseWithSimpleInterrupt
}
private:
- class InterruptThread : public i::Thread {
+ class InterruptThread : public v8::base::Thread {
public:
explicit InterruptThread(RequestInterruptTestBase* test)
: Thread("RequestInterruptTest"), test_(test) {}
@@ -22136,7 +22136,7 @@ class ClearInterruptFromAnotherThread
}
private:
- class InterruptThread : public i::Thread {
+ class InterruptThread : public v8::base::Thread {
public:
explicit InterruptThread(ClearInterruptFromAnotherThread* test)
: Thread("RequestInterruptTest"), test_(test) {}
@@ -22153,7 +22153,7 @@ class ClearInterruptFromAnotherThread
ClearInterruptFromAnotherThread* test =
reinterpret_cast<ClearInterruptFromAnotherThread*>(data);
test->sem_.Signal();
- bool success = test->sem2_.WaitFor(i::TimeDelta::FromSeconds(2));
+ bool success = test->sem2_.WaitFor(v8::base::TimeDelta::FromSeconds(2));
// Crash instead of timeout to make this failure more prominent.
CHECK(success);
test->should_continue_ = false;
@@ -22164,7 +22164,7 @@ class ClearInterruptFromAnotherThread
};
InterruptThread i_thread;
- i::Semaphore sem2_;
+ v8::base::Semaphore sem2_;
};

Powered by Google App Engine
This is Rietveld 408576698