Index: test/cctest/test-random.cc |
diff --git a/test/cctest/test-random.cc b/test/cctest/test-random.cc |
index 0837ab3e360307febecf069582a8914da89e6b04..6b6e0e0ff1a101292703b0b3799650a38094d29c 100644 |
--- a/test/cctest/test-random.cc |
+++ b/test/cctest/test-random.cc |
@@ -39,6 +39,8 @@ |
using namespace v8::internal; |
+static v8::Persistent<v8::Context> env; |
+ |
void SetSeeds(Handle<ByteArray> seeds, uint32_t state0, uint32_t state1) { |
for (int i = 0; i < 4; i++) { |
@@ -71,12 +73,11 @@ void TestSeeds(Handle<JSFunction> fun, |
TEST(CrankshaftRandom) { |
- v8::V8::Initialize(); |
+ if (env.IsEmpty()) env = v8::Context::New(); |
// Skip test if crankshaft is disabled. |
if (!V8::UseCrankshaft()) return; |
- v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
- v8::HandleScope scope(isolate); |
- v8::Context::Scope context_scope(v8::Context::New(isolate)); |
+ v8::HandleScope scope(env->GetIsolate()); |
+ env->Enter(); |
Handle<Context> context(Isolate::Current()->context()); |
Handle<JSObject> global(context->global_object()); |