| Index: test/cctest/test-cpu-profiler.cc
|
| diff --git a/test/cctest/test-cpu-profiler.cc b/test/cctest/test-cpu-profiler.cc
|
| index f4d9936329981a650ce3fb27caa29b29aadb8a17..251a4a529095eb260742d8fa613b679adc301656 100644
|
| --- a/test/cctest/test-cpu-profiler.cc
|
| +++ b/test/cctest/test-cpu-profiler.cc
|
| @@ -1023,80 +1023,3 @@ TEST(BoundFunctionCall) {
|
|
|
| cpu_profiler->DeleteAllCpuProfiles();
|
| }
|
| -
|
| -
|
| -static const char* call_function_test_source = "function bar(iterations) {\n"
|
| -"}\n"
|
| -"function start(duration) {\n"
|
| -" var start = Date.now();\n"
|
| -" while (Date.now() - start < duration) {\n"
|
| -" try {\n"
|
| -" bar.call(this, 10 * 1000);\n"
|
| -" } catch(e) {}\n"
|
| -" }\n"
|
| -"}";
|
| -
|
| -
|
| -// Test that if we sampled thread when it was inside FunctionCall buitin then
|
| -// its caller frame will be '(unresolved function)' as we have no reliable way
|
| -// to resolve it.
|
| -//
|
| -// [Top down]:
|
| -// 96 0 (root) [-1] #1
|
| -// 1 1 (garbage collector) [-1] #4
|
| -// 5 0 (unresolved function) [-1] #5
|
| -// 5 5 call [-1] #6
|
| -// 71 70 start [-1] #3
|
| -// 1 1 bar [-1] #7
|
| -// 19 19 (program) [-1] #2
|
| -TEST(FunctionCallSample) {
|
| - LocalContext env;
|
| - v8::HandleScope scope(env->GetIsolate());
|
| -
|
| - v8::Script::Compile(v8::String::New(call_function_test_source))->Run();
|
| - v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(
|
| - env->Global()->Get(v8::String::New("start")));
|
| -
|
| - v8::CpuProfiler* cpu_profiler = env->GetIsolate()->GetCpuProfiler();
|
| - v8::Local<v8::String> profile_name = v8::String::New("my_profile");
|
| -
|
| - cpu_profiler->StartCpuProfiling(profile_name);
|
| - int32_t duration_ms = 100;
|
| - v8::Handle<v8::Value> args[] = { v8::Integer::New(duration_ms) };
|
| - function->Call(env->Global(), ARRAY_SIZE(args), args);
|
| - const v8::CpuProfile* profile = cpu_profiler->StopCpuProfiling(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();
|
| -
|
| - const v8::CpuProfileNode* root = profile->GetTopDownRoot();
|
| - {
|
| - ScopedVector<v8::Handle<v8::String> > names(4);
|
| - names[0] = v8::String::New(ProfileGenerator::kGarbageCollectorEntryName);
|
| - names[1] = v8::String::New(ProfileGenerator::kProgramEntryName);
|
| - names[2] = v8::String::New("start");
|
| - names[3] = v8::String::New(i::ProfileGenerator::kUnresolvedFunctionName);
|
| - // Don't allow |bar| and |call| nodes to be at the top level.
|
| - CheckChildrenNames(root, names);
|
| - }
|
| -
|
| - const v8::CpuProfileNode* startNode = GetChild(root, "start");
|
| - {
|
| - ScopedVector<v8::Handle<v8::String> > names(1);
|
| - names[0] = v8::String::New("bar");
|
| - CheckChildrenNames(startNode, names);
|
| - }
|
| -
|
| - const v8::CpuProfileNode* unresolvedNode =
|
| - FindChild(root, i::ProfileGenerator::kUnresolvedFunctionName);
|
| - if (unresolvedNode) {
|
| - ScopedVector<v8::Handle<v8::String> > names(1);
|
| - names[0] = v8::String::New("call");
|
| - CheckChildrenNames(unresolvedNode, names);
|
| - }
|
| -
|
| - cpu_profiler->DeleteAllCpuProfiles();
|
| -}
|
| -
|
|
|