Commit 854f704e authored by Camillo Bruni's avatar Camillo Bruni Committed by Commit Bot

[api] Improving ablation API

Bug: chromium:1193459
Change-Id: I6d9dace9341e96f2586a469d7e16bfa38bf68029
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2810845Reviewed-by: 's avatarVictor Gomes <victorgomes@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#73901}
parent a5ce9ac6
......@@ -1920,26 +1920,44 @@ MaybeLocal<Value> Script::Run(Local<Context> context) {
ENTER_V8(isolate, context, Script, Run, MaybeLocal<Value>(),
InternalEscapableScope);
i::HistogramTimerScope execute_timer(isolate->counters()->execute(), true);
i::AggregatingHistogramTimerScope timer(isolate->counters()->compile_lazy());
i::AggregatingHistogramTimerScope histogram_timer(
isolate->counters()->compile_lazy());
i::TimerEventScope<i::TimerEventExecute> timer_scope(isolate);
auto fun = i::Handle<i::JSFunction>::cast(Utils::OpenHandle(this));
// TODO(crbug.com/1193459): remove once ablation study is completed
if (i::FLAG_script_run_delay) {
v8::base::OS::Sleep(
v8::base::TimeDelta::FromMilliseconds(i::FLAG_script_run_delay));
base::ElapsedTimer timer;
base::TimeDelta delta;
if (i::FLAG_script_delay) {
delta = v8::base::TimeDelta::FromMillisecondsD(i::FLAG_script_delay);
}
if (i::FLAG_script_run_delay_once && !isolate->did_run_script_delay()) {
v8::base::OS::Sleep(
v8::base::TimeDelta::FromMilliseconds(i::FLAG_script_run_delay_once));
if (i::FLAG_script_delay_once && !isolate->did_run_script_delay()) {
delta = v8::base::TimeDelta::FromMillisecondsD(i::FLAG_script_delay_once);
isolate->set_did_run_script_delay(true);
}
if (i::FLAG_script_delay_fraction > 0.0) {
timer.Start();
} else if (delta.InMicroseconds() > 0) {
timer.Start();
while (timer.Elapsed() < delta) {
// Busy wait.
}
}
i::Handle<i::Object> receiver = isolate->global_proxy();
Local<Value> result;
has_pending_exception = !ToLocal<Value>(
i::Execution::Call(isolate, fun, receiver, 0, nullptr), &result);
if (i::FLAG_script_delay_fraction > 0.0) {
delta = v8::base::TimeDelta::FromMillisecondsD(
timer.Elapsed().InMillisecondsF() * i::FLAG_script_delay_fraction);
timer.Restart();
while (timer.Elapsed() < delta) {
// Busy wait.
}
}
RETURN_ON_FAILED_EXECUTION(Value);
RETURN_ESCAPED(result);
}
......
......@@ -829,8 +829,11 @@ DEFINE_BOOL(turbo_collect_feedback_in_generic_lowering, true,
DEFINE_BOOL(isolate_script_cache_ageing, true,
"enable ageing of the isolate script cache.")
DEFINE_INT(script_run_delay, 0, "sleep [ms] on every Script::Run")
DEFINE_INT(script_run_delay_once, 0, "sleep [ms] on the first Script::Run")
DEFINE_FLOAT(script_delay, 0, "busy wait [ms] on every Script::Run")
DEFINE_FLOAT(script_delay_once, 0, "busy wait [ms] on the first Script::Run")
DEFINE_FLOAT(script_delay_fraction, 0.0,
"busy wait after each Script::Run by the given fraction of the "
"run's duration")
// Favor memory over execution speed.
DEFINE_BOOL(optimize_for_size, false,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment