Index: test/cctest/test-profile-generator.cc |
diff --git a/test/cctest/test-profile-generator.cc b/test/cctest/test-profile-generator.cc |
index 70b34e3d7c276688c27a49755d1081899f5ec499..a18422a748a160a3a56b2885b434aafa3f2800f6 100644 |
--- a/test/cctest/test-profile-generator.cc |
+++ b/test/cctest/test-profile-generator.cc |
@@ -855,6 +855,7 @@ v8::Handle<v8::Value> ProfilerExtension::StopProfiling( |
static ProfilerExtension kProfilerExtension; |
v8::DeclareExtension kProfilerExtensionDeclaration(&kProfilerExtension); |
+static v8::Persistent<v8::Context> env; |
static const ProfileNode* PickChild(const ProfileNode* parent, |
const char* name) { |
@@ -871,12 +872,14 @@ TEST(RecordStackTraceAtStartProfiling) { |
// don't appear in the stack trace. |
i::FLAG_use_inlining = false; |
- v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
- v8::HandleScope scope(isolate); |
- const char* extensions[] = { "v8/profiler" }; |
- v8::ExtensionConfiguration config(1, extensions); |
- v8::Local<v8::Context> context = v8::Context::New(isolate); |
- context->Enter(); |
+ if (env.IsEmpty()) { |
+ v8::HandleScope scope(v8::Isolate::GetCurrent()); |
+ const char* extensions[] = { "v8/profiler" }; |
+ v8::ExtensionConfiguration config(1, extensions); |
+ env = v8::Context::New(&config); |
+ } |
+ v8::HandleScope scope(v8::Isolate::GetCurrent()); |
+ (*env)->Enter(); |
CpuProfiler* profiler = i::Isolate::Current()->cpu_profiler(); |
CHECK_EQ(0, profiler->GetProfilesCount()); |