Commit 0da1a0c0 authored by jochen's avatar jochen Committed by Commit bot

Remove v8::i::Isolate::Current from cctests

BUG=2487
R=yangguo@chromium.org
LOG=n

Review URL: https://codereview.chromium.org/1468943002

Cr-Commit-Position: refs/heads/master@{#32176}
parent 6fb0f563
...@@ -118,7 +118,7 @@ static void InitializeVM() { ...@@ -118,7 +118,7 @@ static void InitializeVM() {
// Run tests with the simulator. // Run tests with the simulator.
#define SETUP_SIZE(buf_size) \ #define SETUP_SIZE(buf_size) \
Isolate* isolate = Isolate::Current(); \ Isolate* isolate = CcTest::i_isolate(); \
HandleScope scope(isolate); \ HandleScope scope(isolate); \
DCHECK(isolate != NULL); \ DCHECK(isolate != NULL); \
byte* buf = new byte[buf_size]; \ byte* buf = new byte[buf_size]; \
...@@ -171,12 +171,12 @@ static void InitializeVM() { ...@@ -171,12 +171,12 @@ static void InitializeVM() {
#else // ifdef USE_SIMULATOR. #else // ifdef USE_SIMULATOR.
// Run the test on real hardware or models. // Run the test on real hardware or models.
#define SETUP_SIZE(buf_size) \ #define SETUP_SIZE(buf_size) \
Isolate* isolate = Isolate::Current(); \ Isolate* isolate = CcTest::i_isolate(); \
HandleScope scope(isolate); \ HandleScope scope(isolate); \
DCHECK(isolate != NULL); \ DCHECK(isolate != NULL); \
byte* buf = new byte[buf_size]; \ byte* buf = new byte[buf_size]; \
MacroAssembler masm(isolate, buf, buf_size); \ MacroAssembler masm(isolate, buf, buf_size); \
RegisterDump core; RegisterDump core;
#define RESET() \ #define RESET() \
......
...@@ -51,7 +51,7 @@ typedef Object* (*F4)(void* p0, void* p1, int p2, int p3, int p4); ...@@ -51,7 +51,7 @@ typedef Object* (*F4)(void* p0, void* p1, int p2, int p3, int p4);
// Simple add parameter 1 to parameter 2 and return // Simple add parameter 1 to parameter 2 and return
TEST(0) { TEST(0) {
CcTest::InitializeVM(); CcTest::InitializeVM();
Isolate* isolate = Isolate::Current(); Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate); HandleScope scope(isolate);
Assembler assm(isolate, NULL, 0); Assembler assm(isolate, NULL, 0);
...@@ -79,7 +79,7 @@ TEST(0) { ...@@ -79,7 +79,7 @@ TEST(0) {
// Loop 100 times, adding loop counter to result // Loop 100 times, adding loop counter to result
TEST(1) { TEST(1) {
CcTest::InitializeVM(); CcTest::InitializeVM();
Isolate* isolate = Isolate::Current(); Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate); HandleScope scope(isolate);
Assembler assm(isolate, NULL, 0); Assembler assm(isolate, NULL, 0);
...@@ -117,7 +117,7 @@ TEST(1) { ...@@ -117,7 +117,7 @@ TEST(1) {
TEST(2) { TEST(2) {
CcTest::InitializeVM(); CcTest::InitializeVM();
Isolate* isolate = Isolate::Current(); Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate); HandleScope scope(isolate);
Assembler assm(isolate, NULL, 0); Assembler assm(isolate, NULL, 0);
...@@ -168,7 +168,7 @@ TEST(2) { ...@@ -168,7 +168,7 @@ TEST(2) {
TEST(3) { TEST(3) {
CcTest::InitializeVM(); CcTest::InitializeVM();
Isolate* isolate = Isolate::Current(); Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate); HandleScope scope(isolate);
typedef struct { typedef struct {
...@@ -178,7 +178,7 @@ TEST(3) { ...@@ -178,7 +178,7 @@ TEST(3) {
} T; } T;
T t; T t;
Assembler assm(Isolate::Current(), NULL, 0); Assembler assm(CcTest::i_isolate(), NULL, 0);
Label L, C; Label L, C;
__ function_descriptor(); __ function_descriptor();
...@@ -248,7 +248,7 @@ TEST(3) { ...@@ -248,7 +248,7 @@ TEST(3) {
TEST(4) { TEST(4) {
// Test the VFP floating point instructions. // Test the VFP floating point instructions.
CcTest::InitializeVM(); CcTest::InitializeVM();
Isolate* isolate = Isolate::Current(); Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate); HandleScope scope(isolate);
typedef struct { typedef struct {
...@@ -270,7 +270,7 @@ TEST(4) { ...@@ -270,7 +270,7 @@ TEST(4) {
// Create a function that accepts &t, and loads, manipulates, and stores // Create a function that accepts &t, and loads, manipulates, and stores
// the doubles and floats. // the doubles and floats.
Assembler assm(Isolate::Current(), NULL, 0); Assembler assm(CcTest::i_isolate(), NULL, 0);
Label L, C; Label L, C;
if (CpuFeatures::IsSupported(VFP3)) { if (CpuFeatures::IsSupported(VFP3)) {
...@@ -383,7 +383,7 @@ TEST(4) { ...@@ -383,7 +383,7 @@ TEST(4) {
TEST(5) { TEST(5) {
// Test the ARMv7 bitfield instructions. // Test the ARMv7 bitfield instructions.
CcTest::InitializeVM(); CcTest::InitializeVM();
Isolate* isolate = Isolate::Current(); Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate); HandleScope scope(isolate);
Assembler assm(isolate, NULL, 0); Assembler assm(isolate, NULL, 0);
...@@ -420,7 +420,7 @@ TEST(5) { ...@@ -420,7 +420,7 @@ TEST(5) {
TEST(6) { TEST(6) {
// Test saturating instructions. // Test saturating instructions.
CcTest::InitializeVM(); CcTest::InitializeVM();
Isolate* isolate = Isolate::Current(); Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate); HandleScope scope(isolate);
Assembler assm(isolate, NULL, 0); Assembler assm(isolate, NULL, 0);
...@@ -463,7 +463,7 @@ static void TestRoundingMode(VCVTTypes types, ...@@ -463,7 +463,7 @@ static void TestRoundingMode(VCVTTypes types,
int expected, int expected,
bool expected_exception = false) { bool expected_exception = false) {
CcTest::InitializeVM(); CcTest::InitializeVM();
Isolate* isolate = Isolate::Current(); Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate); HandleScope scope(isolate);
Assembler assm(isolate, NULL, 0); Assembler assm(isolate, NULL, 0);
...@@ -642,7 +642,7 @@ TEST(7) { ...@@ -642,7 +642,7 @@ TEST(7) {
TEST(8) { TEST(8) {
// Test VFP multi load/store with ia_w. // Test VFP multi load/store with ia_w.
CcTest::InitializeVM(); CcTest::InitializeVM();
Isolate* isolate = Isolate::Current(); Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate); HandleScope scope(isolate);
typedef struct { typedef struct {
...@@ -754,7 +754,7 @@ TEST(8) { ...@@ -754,7 +754,7 @@ TEST(8) {
TEST(9) { TEST(9) {
// Test VFP multi load/store with ia. // Test VFP multi load/store with ia.
CcTest::InitializeVM(); CcTest::InitializeVM();
Isolate* isolate = Isolate::Current(); Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate); HandleScope scope(isolate);
typedef struct { typedef struct {
...@@ -870,7 +870,7 @@ TEST(9) { ...@@ -870,7 +870,7 @@ TEST(9) {
TEST(10) { TEST(10) {
// Test VFP multi load/store with db_w. // Test VFP multi load/store with db_w.
CcTest::InitializeVM(); CcTest::InitializeVM();
Isolate* isolate = Isolate::Current(); Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate); HandleScope scope(isolate);
typedef struct { typedef struct {
...@@ -982,7 +982,7 @@ TEST(10) { ...@@ -982,7 +982,7 @@ TEST(10) {
TEST(11) { TEST(11) {
// Test instructions using the carry flag. // Test instructions using the carry flag.
CcTest::InitializeVM(); CcTest::InitializeVM();
Isolate* isolate = Isolate::Current(); Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate); HandleScope scope(isolate);
typedef struct { typedef struct {
...@@ -1048,7 +1048,7 @@ TEST(11) { ...@@ -1048,7 +1048,7 @@ TEST(11) {
TEST(12) { TEST(12) {
// Test chaining of label usages within instructions (issue 1644). // Test chaining of label usages within instructions (issue 1644).
CcTest::InitializeVM(); CcTest::InitializeVM();
Isolate* isolate = Isolate::Current(); Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate); HandleScope scope(isolate);
Assembler assm(isolate, NULL, 0); Assembler assm(isolate, NULL, 0);
......
...@@ -149,7 +149,7 @@ int32_t RunGeneratedCodeCallWrapper(ConvertDToIFunc func, ...@@ -149,7 +149,7 @@ int32_t RunGeneratedCodeCallWrapper(ConvertDToIFunc func,
Simulator::CallArgument(from), Simulator::CallArgument(from),
Simulator::CallArgument::End() Simulator::CallArgument::End()
}; };
return static_cast<int32_t>(Simulator::current(Isolate::Current()) return static_cast<int32_t>(Simulator::current(CcTest::i_isolate())
->CallInt64(FUNCTION_ADDR(func), args)); ->CallInt64(FUNCTION_ADDR(func), args));
#else #else
return (*func)(from); return (*func)(from);
......
...@@ -159,8 +159,9 @@ static Isolate* GetIsolateFrom(LocalContext* context) { ...@@ -159,8 +159,9 @@ static Isolate* GetIsolateFrom(LocalContext* context) {
int32_t RunGeneratedCodeCallWrapper(ConvertDToIFunc func, int32_t RunGeneratedCodeCallWrapper(ConvertDToIFunc func,
double from) { double from) {
#ifdef USE_SIMULATOR #ifdef USE_SIMULATOR
Simulator::current(Isolate::Current())->CallFP(FUNCTION_ADDR(func), from, 0.); Simulator::current(CcTest::i_isolate())
return Simulator::current(Isolate::Current())->get_register(v0.code()); ->CallFP(FUNCTION_ADDR(func), from, 0.);
return Simulator::current(CcTest::i_isolate())->get_register(v0.code());
#else #else
return (*func)(from); return (*func)(from);
#endif #endif
......
...@@ -157,9 +157,10 @@ static Isolate* GetIsolateFrom(LocalContext* context) { ...@@ -157,9 +157,10 @@ static Isolate* GetIsolateFrom(LocalContext* context) {
int32_t RunGeneratedCodeCallWrapper(ConvertDToIFunc func, int32_t RunGeneratedCodeCallWrapper(ConvertDToIFunc func,
double from) { double from) {
#ifdef USE_SIMULATOR #ifdef USE_SIMULATOR
Simulator::current(Isolate::Current())->CallFP(FUNCTION_ADDR(func), from, 0.); Simulator::current(CcTest::i_isolate())
->CallFP(FUNCTION_ADDR(func), from, 0.);
return static_cast<int32_t>( return static_cast<int32_t>(
Simulator::current(Isolate::Current())->get_register(v0.code())); Simulator::current(CcTest::i_isolate())->get_register(v0.code()));
#else #else
return (*func)(from); return (*func)(from);
#endif #endif
......
...@@ -50,7 +50,7 @@ using namespace v8::internal; ...@@ -50,7 +50,7 @@ using namespace v8::internal;
#define INSTR_SIZE (1024) #define INSTR_SIZE (1024)
#define SET_UP_CLASS(ASMCLASS) \ #define SET_UP_CLASS(ASMCLASS) \
InitializeVM(); \ InitializeVM(); \
Isolate* isolate = Isolate::Current(); \ Isolate* isolate = CcTest::i_isolate(); \
HandleScope scope(isolate); \ HandleScope scope(isolate); \
byte* buf = static_cast<byte*>(malloc(INSTR_SIZE)); \ byte* buf = static_cast<byte*>(malloc(INSTR_SIZE)); \
uint32_t encoding = 0; \ uint32_t encoding = 0; \
......
...@@ -67,7 +67,7 @@ bool DisassembleAndCompare(byte* pc, const char* compare_string) { ...@@ -67,7 +67,7 @@ bool DisassembleAndCompare(byte* pc, const char* compare_string) {
// in the rest of the macros. // in the rest of the macros.
#define SET_UP() \ #define SET_UP() \
CcTest::InitializeVM(); \ CcTest::InitializeVM(); \
Isolate* isolate = Isolate::Current(); \ Isolate* isolate = CcTest::i_isolate(); \
HandleScope scope(isolate); \ HandleScope scope(isolate); \
byte* buffer = reinterpret_cast<byte*>(malloc(4 * 1024)); \ byte* buffer = reinterpret_cast<byte*>(malloc(4 * 1024)); \
Assembler assm(isolate, buffer, 4 * 1024); \ Assembler assm(isolate, buffer, 4 * 1024); \
......
...@@ -69,8 +69,7 @@ class KangarooThread : public v8::base::Thread { ...@@ -69,8 +69,7 @@ class KangarooThread : public v8::base::Thread {
{ {
v8::Locker locker(isolate_); v8::Locker locker(isolate_);
v8::Isolate::Scope isolate_scope(isolate_); v8::Isolate::Scope isolate_scope(isolate_);
CHECK_EQ(reinterpret_cast<v8::internal::Isolate*>(isolate_), CHECK_EQ(isolate_, v8::Isolate::GetCurrent());
v8::internal::Isolate::Current());
v8::HandleScope scope(isolate_); v8::HandleScope scope(isolate_);
v8::Local<v8::Context> context = v8::Local<v8::Context> context =
v8::Local<v8::Context>::New(isolate_, context_); v8::Local<v8::Context>::New(isolate_, context_);
...@@ -111,8 +110,7 @@ TEST(KangarooIsolates) { ...@@ -111,8 +110,7 @@ TEST(KangarooIsolates) {
v8::HandleScope handle_scope(isolate); v8::HandleScope handle_scope(isolate);
v8::Local<v8::Context> context = v8::Context::New(isolate); v8::Local<v8::Context> context = v8::Context::New(isolate);
v8::Context::Scope context_scope(context); v8::Context::Scope context_scope(context);
CHECK_EQ(reinterpret_cast<v8::internal::Isolate*>(isolate), CHECK_EQ(isolate, v8::Isolate::GetCurrent());
v8::internal::Isolate::Current());
CompileRun("function getValue() { return 30; }"); CompileRun("function getValue() { return 30; }");
thread1.Reset(new KangarooThread(isolate, context)); thread1.Reset(new KangarooThread(isolate, context));
} }
...@@ -190,8 +188,7 @@ class IsolateLockingThreadWithLocalContext : public JoinableThread { ...@@ -190,8 +188,7 @@ class IsolateLockingThreadWithLocalContext : public JoinableThread {
v8::Isolate::Scope isolate_scope(isolate_); v8::Isolate::Scope isolate_scope(isolate_);
v8::HandleScope handle_scope(isolate_); v8::HandleScope handle_scope(isolate_);
LocalContext local_context(isolate_); LocalContext local_context(isolate_);
CHECK_EQ(reinterpret_cast<v8::internal::Isolate*>(isolate_), CHECK_EQ(isolate_, v8::Isolate::GetCurrent());
v8::internal::Isolate::Current());
CalcFibAndCheck(local_context.local()); CalcFibAndCheck(local_context.local());
} }
private: private:
...@@ -688,11 +685,12 @@ class IsolateGenesisThread : public JoinableThread { ...@@ -688,11 +685,12 @@ class IsolateGenesisThread : public JoinableThread {
v8::Isolate* isolate = v8::Isolate::New(create_params); v8::Isolate* isolate = v8::Isolate::New(create_params);
{ {
v8::Isolate::Scope isolate_scope(isolate); v8::Isolate::Scope isolate_scope(isolate);
CHECK(!i::Isolate::Current()->has_installed_extensions()); CHECK(
!reinterpret_cast<i::Isolate*>(isolate)->has_installed_extensions());
v8::ExtensionConfiguration extensions(count_, extension_names_); v8::ExtensionConfiguration extensions(count_, extension_names_);
v8::HandleScope handle_scope(isolate); v8::HandleScope handle_scope(isolate);
v8::Context::New(isolate, &extensions); v8::Context::New(isolate, &extensions);
CHECK(i::Isolate::Current()->has_installed_extensions()); CHECK(reinterpret_cast<i::Isolate*>(isolate)->has_installed_extensions());
} }
isolate->Dispose(); isolate->Dispose();
} }
......
...@@ -64,7 +64,7 @@ static bool all_zeroes(const byte* beg, const byte* end) { ...@@ -64,7 +64,7 @@ static bool all_zeroes(const byte* beg, const byte* end) {
TEST(CopyBytes) { TEST(CopyBytes) {
CcTest::InitializeVM(); CcTest::InitializeVM();
Isolate* isolate = Isolate::Current(); Isolate* isolate = CcTest::i_isolate();
HandleScope handles(isolate); HandleScope handles(isolate);
const int data_size = 1 * KB; const int data_size = 1 * KB;
......
...@@ -65,7 +65,7 @@ static bool all_zeroes(const byte* beg, const byte* end) { ...@@ -65,7 +65,7 @@ static bool all_zeroes(const byte* beg, const byte* end) {
TEST(CopyBytes) { TEST(CopyBytes) {
CcTest::InitializeVM(); CcTest::InitializeVM();
Isolate* isolate = Isolate::Current(); Isolate* isolate = CcTest::i_isolate();
HandleScope handles(isolate); HandleScope handles(isolate);
const int data_size = 1 * KB; const int data_size = 1 * KB;
......
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