Index: test/cctest/test-hashing.cc |
diff --git a/test/cctest/test-hashing.cc b/test/cctest/test-hashing.cc |
index 154761313935d7fce15d4decdcb64e3dbdef01a7..6cf63d9fbbb95eb7d0cd81be057e8df14e6ecdde 100644 |
--- a/test/cctest/test-hashing.cc |
+++ b/test/cctest/test-hashing.cc |
@@ -47,6 +47,8 @@ using namespace v8::internal; |
typedef uint32_t (*HASH_FUNCTION)(); |
+static v8::Persistent<v8::Context> env; |
+ |
#define __ masm-> |
@@ -233,10 +235,7 @@ static uint32_t PseudoRandom(uint32_t i, uint32_t j) { |
TEST(StringHash) { |
- v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
- v8::HandleScope handle_scope(isolate); |
- v8::Context::Scope context_scope(v8::Context::New(isolate)); |
- |
+ if (env.IsEmpty()) env = v8::Context::New(); |
for (uint8_t a = 0; a < String::kMaxOneByteCharCode; a++) { |
// Numbers are hashed differently. |
if (a >= '0' && a <= '9') continue; |
@@ -254,9 +253,7 @@ TEST(StringHash) { |
TEST(NumberHash) { |
- v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
- v8::HandleScope handle_scope(isolate); |
- v8::Context::Scope context_scope(v8::Context::New(isolate)); |
+ if (env.IsEmpty()) env = v8::Context::New(); |
// Some specific numbers |
for (uint32_t key = 0; key < 42; key += 7) { |