Revision: 20325
Author:   [email protected]
Date:     Fri Mar 28 09:24:49 2014 UTC
Log:      Deprecate Start/StopCpuProfiling methods

BUG=v8:3213
LOG=Y
[email protected], [email protected]

Review URL: https://codereview.chromium.org/197513005
http://code.google.com/p/v8/source/detail?r=20325

Modified:
 /branches/bleeding_edge/include/v8-profiler.h
 /branches/bleeding_edge/test/cctest/profiler-extension.cc
 /branches/bleeding_edge/test/cctest/profiler-extension.h
 /branches/bleeding_edge/test/cctest/test-api.cc
 /branches/bleeding_edge/test/cctest/test-cpu-profiler.cc

=======================================
--- /branches/bleeding_edge/include/v8-profiler.h Mon Mar 17 07:09:49 2014 UTC +++ /branches/bleeding_edge/include/v8-profiler.h Fri Mar 28 09:24:49 2014 UTC
@@ -164,7 +164,9 @@
   void StartProfiling(Handle<String> title, bool record_samples = false);

   /** Deprecated. Use StartProfiling instead. */
- void StartCpuProfiling(Handle<String> title, bool record_samples = false);
+  V8_DEPRECATED("Use StartProfiling",
+      void StartCpuProfiling(Handle<String> title,
+                             bool record_samples = false));

   /**
    * Stops collecting CPU profile with a given title and returns it.
@@ -173,7 +175,8 @@
   CpuProfile* StopProfiling(Handle<String> title);

   /** Deprecated. Use StopProfiling instead. */
-  const CpuProfile* StopCpuProfiling(Handle<String> title);
+  V8_DEPRECATED("Use StopProfiling",
+      const CpuProfile* StopCpuProfiling(Handle<String> title));

   /**
    * Tells the profiler whether the embedder is idle.
=======================================
--- /branches/bleeding_edge/test/cctest/profiler-extension.cc Fri Jan 17 10:52:00 2014 UTC +++ /branches/bleeding_edge/test/cctest/profiler-extension.cc Fri Mar 28 09:24:49 2014 UTC
@@ -34,7 +34,7 @@
 namespace internal {


-const v8::CpuProfile* ProfilerExtension::last_profile = NULL;
+v8::CpuProfile* ProfilerExtension::last_profile = NULL;
 const char* ProfilerExtension::kSource =
     "native function startProfiling();"
     "native function stopProfiling();";
@@ -58,7 +58,7 @@
     const v8::FunctionCallbackInfo<v8::Value>& args) {
   last_profile = NULL;
   v8::CpuProfiler* cpu_profiler = args.GetIsolate()->GetCpuProfiler();
-  cpu_profiler->StartCpuProfiling((args.Length() > 0)
+  cpu_profiler->StartProfiling((args.Length() > 0)
       ? args[0].As<v8::String>()
       : v8::String::Empty(args.GetIsolate()));
 }
@@ -67,7 +67,7 @@
 void ProfilerExtension::StopProfiling(
     const v8::FunctionCallbackInfo<v8::Value>& args) {
   v8::CpuProfiler* cpu_profiler = args.GetIsolate()->GetCpuProfiler();
-  last_profile = cpu_profiler->StopCpuProfiling((args.Length() > 0)
+  last_profile = cpu_profiler->StopProfiling((args.Length() > 0)
       ? args[0].As<v8::String>()
       : v8::String::Empty(args.GetIsolate()));
 }
=======================================
--- /branches/bleeding_edge/test/cctest/profiler-extension.h Fri Jan 17 10:52:00 2014 UTC +++ /branches/bleeding_edge/test/cctest/profiler-extension.h Fri Mar 28 09:24:49 2014 UTC
@@ -43,7 +43,7 @@
       v8::Handle<v8::String> name);
static void StartProfiling(const v8::FunctionCallbackInfo<v8::Value>& args); static void StopProfiling(const v8::FunctionCallbackInfo<v8::Value>& args);
-  static const v8::CpuProfile* last_profile;
+  static v8::CpuProfile* last_profile;
  private:
   static const char* kSource;
 };
=======================================
--- /branches/bleeding_edge/test/cctest/test-api.cc Thu Mar 27 16:42:34 2014 UTC +++ /branches/bleeding_edge/test/cctest/test-api.cc Fri Mar 28 09:24:49 2014 UTC
@@ -93,7 +93,7 @@
       v8::String::NewFromUtf8(env->GetIsolate(), "my_profile1");
   v8::CpuProfiler* cpu_profiler = env->GetIsolate()->GetCpuProfiler();

-  cpu_profiler->StartCpuProfiling(profile_name);
+  cpu_profiler->StartProfiling(profile_name);
   (*test)();
   reinterpret_cast<i::CpuProfiler*>(cpu_profiler)->DeleteAllProfiles();
 }
=======================================
--- /branches/bleeding_edge/test/cctest/test-cpu-profiler.cc Fri Mar 14 10:20:33 2014 UTC +++ /branches/bleeding_edge/test/cctest/test-cpu-profiler.cc Fri Mar 28 09:24:49 2014 UTC
@@ -355,33 +355,33 @@

   CHECK_EQ(0, iprofiler->GetProfilesCount());
v8::Local<v8::String> name1 = v8::String::NewFromUtf8(env->GetIsolate(), "1");
-  cpu_profiler->StartCpuProfiling(name1);
-  const v8::CpuProfile* p1 = cpu_profiler->StopCpuProfiling(name1);
+  cpu_profiler->StartProfiling(name1);
+  v8::CpuProfile* p1 = cpu_profiler->StopProfiling(name1);
   CHECK_NE(NULL, p1);
   CHECK_EQ(1, iprofiler->GetProfilesCount());
   CHECK(FindCpuProfile(cpu_profiler, p1));
-  const_cast<v8::CpuProfile*>(p1)->Delete();
+  p1->Delete();
   CHECK_EQ(0, iprofiler->GetProfilesCount());

v8::Local<v8::String> name2 = v8::String::NewFromUtf8(env->GetIsolate(), "2");
-  cpu_profiler->StartCpuProfiling(name2);
-  const v8::CpuProfile* p2 = cpu_profiler->StopCpuProfiling(name2);
+  cpu_profiler->StartProfiling(name2);
+  v8::CpuProfile* p2 = cpu_profiler->StopProfiling(name2);
   CHECK_NE(NULL, p2);
   CHECK_EQ(1, iprofiler->GetProfilesCount());
   CHECK(FindCpuProfile(cpu_profiler, p2));
v8::Local<v8::String> name3 = v8::String::NewFromUtf8(env->GetIsolate(), "3");
-  cpu_profiler->StartCpuProfiling(name3);
-  const v8::CpuProfile* p3 = cpu_profiler->StopCpuProfiling(name3);
+  cpu_profiler->StartProfiling(name3);
+  v8::CpuProfile* p3 = cpu_profiler->StopProfiling(name3);
   CHECK_NE(NULL, p3);
   CHECK_EQ(2, iprofiler->GetProfilesCount());
   CHECK_NE(p2, p3);
   CHECK(FindCpuProfile(cpu_profiler, p3));
   CHECK(FindCpuProfile(cpu_profiler, p2));
-  const_cast<v8::CpuProfile*>(p2)->Delete();
+  p2->Delete();
   CHECK_EQ(1, iprofiler->GetProfilesCount());
   CHECK(!FindCpuProfile(cpu_profiler, p2));
   CHECK(FindCpuProfile(cpu_profiler, p3));
-  const_cast<v8::CpuProfile*>(p3)->Delete();
+  p3->Delete();
   CHECK_EQ(0, iprofiler->GetProfilesCount());
 }

@@ -393,13 +393,13 @@

   v8::Local<v8::String> profile_name =
       v8::String::NewFromUtf8(env->GetIsolate(), "test");
-  cpu_profiler->StartCpuProfiling(profile_name);
- const v8::CpuProfile* profile = cpu_profiler->StopCpuProfiling(profile_name);
+  cpu_profiler->StartProfiling(profile_name);
+ const v8::CpuProfile* profile = cpu_profiler->StopProfiling(profile_name);
   CHECK(profile->GetStartTime() <= profile->GetEndTime());
 }


-static const v8::CpuProfile* RunProfiler(
+static v8::CpuProfile* RunProfiler(
     v8::Handle<v8::Context> env, v8::Handle<v8::Function> function,
     v8::Handle<v8::Value> argv[], int argc,
     unsigned min_js_samples) {
@@ -407,7 +407,7 @@
   v8::Local<v8::String> profile_name =
       v8::String::NewFromUtf8(env->GetIsolate(), "my_profile");

-  cpu_profiler->StartCpuProfiling(profile_name);
+  cpu_profiler->StartProfiling(profile_name);

   i::Sampler* sampler =
reinterpret_cast<i::Isolate*>(env->GetIsolate())->logger()->sampler();
@@ -416,12 +416,11 @@
     function->Call(env->Global(), argc, argv);
   } while (sampler->js_and_external_sample_count() < min_js_samples);

- const v8::CpuProfile* profile = cpu_profiler->StopCpuProfiling(profile_name);
+  v8::CpuProfile* profile = cpu_profiler->StopProfiling(profile_name);

   CHECK_NE(NULL, profile);
   // Dump collected profile to have a better diagnostic in case of failure.
-  reinterpret_cast<i::CpuProfile*>(
-      const_cast<v8::CpuProfile*>(profile))->Print();
+  reinterpret_cast<i::CpuProfile*>(profile)->Print();

   return profile;
 }
@@ -553,7 +552,7 @@
   v8::Handle<v8::Value> args[] = {
     v8::Integer::New(env->GetIsolate(), profiling_interval_ms)
   };
-  const v8::CpuProfile* profile =
+  v8::CpuProfile* profile =
       RunProfiler(env.local(), function, args, ARRAY_SIZE(args), 200);
   function->Call(env->Global(), ARRAY_SIZE(args), args);

@@ -585,7 +584,7 @@
   CheckSimpleBranch(env->GetIsolate(), fooNode, delayBranch,
                     ARRAY_SIZE(delayBranch));

-  const_cast<v8::CpuProfile*>(profile)->Delete();
+  profile->Delete();
 }


@@ -627,7 +626,7 @@
   v8::Handle<v8::Value> args[] = {
     v8::Integer::New(env->GetIsolate(), repeat_count)
   };
-  const v8::CpuProfile* profile =
+  v8::CpuProfile* profile =
       RunProfiler(env.local(), function, args, ARRAY_SIZE(args), 100);

   const v8::CpuProfileNode* root = profile->GetTopDownRoot();
@@ -654,7 +653,7 @@
     }
   }

-  const_cast<v8::CpuProfile*>(profile)->Delete();
+  profile->Delete();
 }


@@ -747,7 +746,7 @@

   int32_t repeat_count = 1;
v8::Handle<v8::Value> args[] = { v8::Integer::New(isolate, repeat_count) };
-  const v8::CpuProfile* profile =
+  v8::CpuProfile* profile =
       RunProfiler(env.local(), function, args, ARRAY_SIZE(args), 180);

   const v8::CpuProfileNode* root = profile->GetTopDownRoot();
@@ -756,7 +755,7 @@
   GetChild(isolate, startNode, "get foo");
   GetChild(isolate, startNode, "set foo");

-  const_cast<v8::CpuProfile*>(profile)->Delete();
+  profile->Delete();
 }


@@ -804,7 +803,7 @@

   int32_t repeat_count = 100;
v8::Handle<v8::Value> args[] = { v8::Integer::New(isolate, repeat_count) };
-  const v8::CpuProfile* profile =
+  v8::CpuProfile* profile =
       RunProfiler(env.local(), function, args, ARRAY_SIZE(args), 200);

   const v8::CpuProfileNode* root = profile->GetTopDownRoot();
@@ -813,7 +812,7 @@
   GetChild(isolate, startNode, "get foo");
   GetChild(isolate, startNode, "set foo");

-  const_cast<v8::CpuProfile*>(profile)->Delete();
+  profile->Delete();
 }


@@ -858,7 +857,7 @@

   int32_t repeat_count = 1;
v8::Handle<v8::Value> args[] = { v8::Integer::New(isolate, repeat_count) };
-  const v8::CpuProfile* profile =
+  v8::CpuProfile* profile =
       RunProfiler(env.local(), function, args, ARRAY_SIZE(args), 100);

   const v8::CpuProfileNode* root = profile->GetTopDownRoot();
@@ -866,7 +865,7 @@
       GetChild(isolate, root, "start");
   GetChild(isolate, startNode, "fooMethod");

-  const_cast<v8::CpuProfile*>(profile)->Delete();
+  profile->Delete();
 }


@@ -915,7 +914,7 @@

   int32_t repeat_count = 100;
v8::Handle<v8::Value> args[] = { v8::Integer::New(isolate, repeat_count) };
-  const v8::CpuProfile* profile =
+  v8::CpuProfile* profile =
       RunProfiler(env.local(), function, args, ARRAY_SIZE(args), 100);

   const v8::CpuProfileNode* root = profile->GetTopDownRoot();
@@ -924,7 +923,7 @@
       GetChild(isolate, root, "start");
   GetChild(isolate, startNode, "fooMethod");

-  const_cast<v8::CpuProfile*>(profile)->Delete();
+  profile->Delete();
 }


@@ -956,7 +955,7 @@
   v8::Handle<v8::Value> args[] = {
     v8::Integer::New(env->GetIsolate(), duration_ms)
   };
-  const v8::CpuProfile* profile =
+  v8::CpuProfile* profile =
       RunProfiler(env.local(), function, args, ARRAY_SIZE(args), 100);

   const v8::CpuProfileNode* root = profile->GetTopDownRoot();
@@ -973,7 +972,7 @@
       GetChild(env->GetIsolate(), root, "start");
   GetChild(env->GetIsolate(), startNode, "foo");

-  const_cast<v8::CpuProfile*>(profile)->Delete();
+  profile->Delete();
 }


@@ -1017,7 +1016,7 @@
   v8::Handle<v8::Value> args[] = {
     v8::Integer::New(env->GetIsolate(), duration_ms)
   };
-  const v8::CpuProfile* profile =
+  v8::CpuProfile* profile =
       RunProfiler(env.local(), function, args, ARRAY_SIZE(args), 100);

   const v8::CpuProfileNode* root = profile->GetTopDownRoot();
@@ -1056,7 +1055,7 @@
     CheckChildrenNames(unresolvedNode, names);
   }

-  const_cast<v8::CpuProfile*>(profile)->Delete();
+  profile->Delete();
 }


@@ -1100,7 +1099,7 @@
     v8::Integer::New(env->GetIsolate(), duration_ms)
   };

-  const v8::CpuProfile* profile =
+  v8::CpuProfile* profile =
       RunProfiler(env.local(), function, args, ARRAY_SIZE(args), 100);

   const v8::CpuProfileNode* root = profile->GetTopDownRoot();
@@ -1145,7 +1144,7 @@
     }
   }

-  const_cast<v8::CpuProfile*>(profile)->Delete();
+  profile->Delete();
 }


@@ -1207,7 +1206,7 @@
   v8::Handle<v8::Value> args[] = {
     v8::Integer::New(env->GetIsolate(), duration_ms)
   };
-  const v8::CpuProfile* profile =
+  v8::CpuProfile* profile =
       RunProfiler(env, function, args, ARRAY_SIZE(args), 10);

   const v8::CpuProfileNode* root = profile->GetTopDownRoot();
@@ -1234,7 +1233,7 @@
   CHECK_EQ(1, barNode->GetChildrenCount());
   GetChild(env->GetIsolate(), barNode, "foo");

-  const_cast<v8::CpuProfile*>(profile)->Delete();
+  profile->Delete();
 }


@@ -1292,7 +1291,7 @@
   v8::Handle<v8::Value> args[] = {
     v8::Integer::New(env->GetIsolate(), duration_ms)
   };
-  const v8::CpuProfile* profile =
+  v8::CpuProfile* profile =
       RunProfiler(env, function, args, ARRAY_SIZE(args), 10);

   const v8::CpuProfileNode* root = profile->GetTopDownRoot();
@@ -1317,7 +1316,7 @@
   CHECK_EQ(1, barNode->GetChildrenCount());
   GetChild(env->GetIsolate(), barNode, "foo");

-  const_cast<v8::CpuProfile*>(profile)->Delete();
+  profile->Delete();
 }


@@ -1386,7 +1385,7 @@
   v8::Handle<v8::Value> args[] = {
     v8::Integer::New(env->GetIsolate(), duration_ms)
   };
-  const v8::CpuProfile* profile =
+  v8::CpuProfile* profile =
       RunProfiler(env, function, args, ARRAY_SIZE(args), 10);

   const v8::CpuProfileNode* root = profile->GetTopDownRoot();
@@ -1415,7 +1414,7 @@
   CHECK_EQ(1, nativeNode2->GetChildrenCount());
   GetChild(env->GetIsolate(), nativeNode2, "foo");

-  const_cast<v8::CpuProfile*>(profile)->Delete();
+  profile->Delete();
 }


@@ -1430,7 +1429,7 @@

   v8::Local<v8::String> profile_name =
       v8::String::NewFromUtf8(env->GetIsolate(), "my_profile");
-  cpu_profiler->StartCpuProfiling(profile_name);
+  cpu_profiler->StartProfiling(profile_name);

   i::Isolate* isolate = CcTest::i_isolate();
i::ProfilerEventsProcessor* processor = isolate->cpu_profiler()->processor();
@@ -1446,11 +1445,10 @@
   processor->AddCurrentStack(isolate);


- const v8::CpuProfile* profile = cpu_profiler->StopCpuProfiling(profile_name);
+  v8::CpuProfile* profile = cpu_profiler->StopProfiling(profile_name);
   CHECK_NE(NULL, profile);
   // Dump collected profile to have a better diagnostic in case of failure.
-  reinterpret_cast<i::CpuProfile*>(
-      const_cast<v8::CpuProfile*>(profile))->Print();
+  reinterpret_cast<i::CpuProfile*>(profile)->Print();

   const v8::CpuProfileNode* root = profile->GetTopDownRoot();
   ScopedVector<v8::Handle<v8::String> > names(3);
@@ -1472,7 +1470,7 @@
   CHECK_EQ(0, idleNode->GetChildrenCount());
   CHECK_GE(idleNode->GetHitCount(), 3);

-  const_cast<v8::CpuProfile*>(profile)->Delete();
+  profile->Delete();
 }


@@ -1545,24 +1543,24 @@

   CHECK_EQ(0, iprofiler->GetProfilesCount());
   v8::Handle<v8::String> outer = v8::String::NewFromUtf8(isolate, "outer");
-  profiler->StartCpuProfiling(outer);
+  profiler->StartProfiling(outer);
   CHECK_EQ(0, iprofiler->GetProfilesCount());

   v8::Handle<v8::String> inner = v8::String::NewFromUtf8(isolate, "inner");
-  profiler->StartCpuProfiling(inner);
+  profiler->StartProfiling(inner);
   CHECK_EQ(0, iprofiler->GetProfilesCount());

-  const v8::CpuProfile* inner_profile = profiler->StopCpuProfiling(inner);
+  v8::CpuProfile* inner_profile = profiler->StopProfiling(inner);
   CHECK(inner_profile);
   CHECK_EQ(1, iprofiler->GetProfilesCount());
-  const_cast<v8::CpuProfile*>(inner_profile)->Delete();
+  inner_profile->Delete();
   inner_profile = NULL;
   CHECK_EQ(0, iprofiler->GetProfilesCount());

-  const v8::CpuProfile* outer_profile = profiler->StopCpuProfiling(outer);
+  v8::CpuProfile* outer_profile = profiler->StopProfiling(outer);
   CHECK(outer_profile);
   CHECK_EQ(1, iprofiler->GetProfilesCount());
-  const_cast<v8::CpuProfile*>(outer_profile)->Delete();
+  outer_profile->Delete();
   outer_profile = NULL;
   CHECK_EQ(0, iprofiler->GetProfilesCount());
 }

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to