Commit f23e66e6 authored by Camillo Bruni's avatar Camillo Bruni Committed by Commit Bot

[api] Implement flags for V8 performance ablation study

This Cl adds the two following flags to artificially slow down script
execution in a controlled way:

--script_run_delay      delays the first every v8::Execute per isolate
--script_run_delay_once delays every v8::Execute

Bug: chromium:1193459
Change-Id: I78fcf940513e9f82fde57ff222e95df9202d00a7
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2739641Reviewed-by: 's avatarVictor Gomes <victorgomes@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#73710}
parent 6d26cb05
......@@ -1924,6 +1924,17 @@ MaybeLocal<Value> Script::Run(Local<Context> context) {
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));
}
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));
isolate->set_did_run_script_delay(true);
}
i::Handle<i::Object> receiver = isolate->global_proxy();
Local<Value> result;
has_pending_exception = !ToLocal<Value>(
......
......@@ -465,7 +465,9 @@ using DebugObjectCache = std::vector<Handle<HeapObject>>;
V(bool, detailed_source_positions_for_profiling, FLAG_detailed_line_info) \
V(int, embedder_wrapper_type_index, -1) \
V(int, embedder_wrapper_object_index, -1) \
V(compiler::NodeObserver*, node_observer, nullptr)
V(compiler::NodeObserver*, node_observer, nullptr) \
/* Used in combination with --script-run-delay-once */ \
V(bool, did_run_script_delay, false)
#define THREAD_LOCAL_TOP_ACCESSOR(type, name) \
inline void set_##name(type v) { thread_local_top()->name##_ = v; } \
......
......@@ -819,6 +819,9 @@ 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")
// Favor memory over execution speed.
DEFINE_BOOL(optimize_for_size, false,
"Enables optimizations which favor memory size over execution "
......
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