Revert of [profiler] reduce incorrectly unaccounted ticks. (patchset #4 id:60001 of https://codereview.chromium.org/2799603005/ )
Reason for revert:
https://build.chromium.org/p/client.v8/builders/V8%20Win32%20-%20debug/builds/8247/steps/Check%20%28flakes%29/logs/CollectOptimizedTople..
Original issue's description:
> [profiler] reduce incorrectly unaccounted ticks.
>
> No longer invalidate the tick sample if there is no JS frame or only one
> non-interpreted JS frame on the stack.
>
> R=jarin@chromium.org
>
> Review-Url: https://codereview.chromium.org/2799603005
> Cr-Commit-Position: refs/heads/master@{#44465}
> Committed: 57bef9a1e2
TBR=jarin@chromium.org,cbruni@chromium.org,yangguo@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
Review-Url: https://codereview.chromium.org/2804593005
Cr-Commit-Position: refs/heads/master@{#44469}
This commit is contained in:
parent
5824c72dd8
commit
fae3f6bf44
@ -225,7 +225,12 @@ bool TickSample::GetStackSample(Isolate* v8_isolate, RegisterState* regs,
|
||||
i::SafeStackFrameIterator it(isolate, reinterpret_cast<i::Address>(regs->fp),
|
||||
reinterpret_cast<i::Address>(regs->sp),
|
||||
js_entry_sp);
|
||||
if (it.done()) return true;
|
||||
|
||||
// If at this point iterator does not see any frames,
|
||||
// is usually means something is wrong with the FP,
|
||||
// e.g. it is used as a general purpose register in the function.
|
||||
// Bailout.
|
||||
if (it.done()) return false;
|
||||
|
||||
size_t i = 0;
|
||||
if (record_c_entry_frame == kIncludeCEntryFrame &&
|
||||
|
@ -117,7 +117,6 @@
|
||||
['arch == arm64', {
|
||||
|
||||
'test-cpu-profiler/CollectDeoptEvents': [PASS, FAIL],
|
||||
'test-cpu-profiler/CollectOptimizedToplevelProfile': [PASS, FAIL],
|
||||
|
||||
'test-api/Bug618': [PASS],
|
||||
|
||||
|
@ -621,51 +621,6 @@ TEST(CollectCpuProfile) {
|
||||
profile->Delete();
|
||||
}
|
||||
|
||||
static const char* cpu_profiler_toplevel_source =
|
||||
"for (var i = 0; i < 1E5; i++) {"
|
||||
" var s = 0;"
|
||||
" for (var j = 0; j < 1E2; j++) s += i;"
|
||||
"}";
|
||||
|
||||
TEST(CollectOptimizedToplevelProfile) {
|
||||
LocalContext env;
|
||||
v8::HandleScope scope(env->GetIsolate());
|
||||
|
||||
v8::CpuProfiler* profiler = v8::CpuProfiler::New(env->GetIsolate());
|
||||
v8::Local<v8::String> profile_name = v8_str("my_profile");
|
||||
|
||||
profiler->SetSamplingInterval(100);
|
||||
profiler->StartProfiling(profile_name, true);
|
||||
v8::internal::CpuProfiler* iprofiler =
|
||||
reinterpret_cast<v8::internal::CpuProfiler*>(profiler);
|
||||
v8::sampler::Sampler* sampler = iprofiler->processor()->sampler();
|
||||
sampler->StartCountingSamples();
|
||||
|
||||
CompileRun(cpu_profiler_toplevel_source);
|
||||
|
||||
v8::CpuProfile* profile = profiler->StopProfiling(profile_name);
|
||||
reinterpret_cast<i::CpuProfile*>(profile)->Print();
|
||||
|
||||
const v8::CpuProfileNode* root = profile->GetTopDownRoot();
|
||||
v8::Local<v8::String> empty = v8::String::Empty(env->GetIsolate());
|
||||
unsigned toplevel_hitcount = 0;
|
||||
unsigned unaccounted_hitcount = 0;
|
||||
for (int i = 0; i < root->GetChildrenCount(); i++) {
|
||||
const v8::CpuProfileNode* child = root->GetChild(i);
|
||||
if (empty->Equals(env.local(), child->GetFunctionName()).FromJust()) {
|
||||
toplevel_hitcount += child->GetHitCount();
|
||||
} else {
|
||||
unaccounted_hitcount += child->GetHitCount();
|
||||
}
|
||||
}
|
||||
// Check that we are getting more ticks from the toplevel function than
|
||||
// unaccounted ticks.
|
||||
DCHECK(toplevel_hitcount > unaccounted_hitcount);
|
||||
|
||||
profile->Delete();
|
||||
profiler->Dispose();
|
||||
}
|
||||
|
||||
static const char* hot_deopt_no_frame_entry_test_source =
|
||||
"%NeverOptimizeFunction(foo);\n"
|
||||
"%NeverOptimizeFunction(start);\n"
|
||||
|
Loading…
Reference in New Issue
Block a user