Adding a SetRAILMode API.
BUG=chromium:613518 LOG=n Review-Url: https://codereview.chromium.org/1999743002 Cr-Commit-Position: refs/heads/master@{#36411}
This commit is contained in:
parent
fdd9f6b92d
commit
ba8ecfd58f
34
include/v8.h
34
include/v8.h
@ -5356,6 +5356,31 @@ struct JitCodeEvent {
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Option flags passed to the SetRAILMode function.
|
||||
* See documentation https://developers.google.com/web/tools/chrome-devtools/
|
||||
* profile/evaluate-performance/rail
|
||||
*/
|
||||
enum RAILMode {
|
||||
// Default performance mode: V8 will optimize for both latency and
|
||||
// throughput in this mode.
|
||||
PERFORMANCE_DEFAULT,
|
||||
// Response performance mode: In this mode very low virtual machine latency
|
||||
// is provided. V8 will try to avoid JavaScript execution interruptions.
|
||||
// Throughput may be throttled.
|
||||
PERFORMANCE_RESPONSE,
|
||||
// Animation performance mode: In this mode low virtual machine latency is
|
||||
// provided. V8 will try to avoid as many JavaScript execution interruptions
|
||||
// as possible. Throughput may be throttled
|
||||
PERFORMANCE_ANIMATION,
|
||||
// Idle performance mode: The embedder is idle. V8 can complete deferred work
|
||||
// in this mode.
|
||||
PERFORMANCE_IDLE,
|
||||
// Load performance mode: In this mode high throughput is provided. V8 may
|
||||
// turn off latency optimizations.
|
||||
PERFORMANCE_LOAD
|
||||
};
|
||||
|
||||
/**
|
||||
* Option flags passed to the SetJitCodeEventHandler function.
|
||||
*/
|
||||
@ -6157,6 +6182,15 @@ class V8_EXPORT Isolate {
|
||||
*/
|
||||
void IsolateInBackgroundNotification();
|
||||
|
||||
/**
|
||||
* Optional notification to tell V8 the current performance requirements
|
||||
* of the embedder based on RAIL.
|
||||
* V8 uses these notifications to guide heuristics.
|
||||
* This is an unfinished experimental feature. Semantics and implementation
|
||||
* may change frequently.
|
||||
*/
|
||||
void SetRAILMode(RAILMode rail_mode);
|
||||
|
||||
/**
|
||||
* Allows the host application to provide the address of a function that is
|
||||
* notified each time code is added, moved or removed.
|
||||
|
@ -7686,6 +7686,11 @@ void Isolate::MemoryPressureNotification(MemoryPressureLevel level) {
|
||||
Locker::IsLocked(this));
|
||||
}
|
||||
|
||||
void Isolate::SetRAILMode(RAILMode rail_mode) {
|
||||
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
|
||||
return isolate->SetRAILMode(rail_mode);
|
||||
}
|
||||
|
||||
void Isolate::SetJitCodeEventHandler(JitCodeEventOptions options,
|
||||
JitCodeEventHandler event_handler) {
|
||||
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
|
||||
|
@ -840,6 +840,7 @@ DEFINE_BOOL(randomize_hashes, true,
|
||||
DEFINE_INT(hash_seed, 0,
|
||||
"Fixed seed to use to hash property keys (0 means random)"
|
||||
"(with snapshots this option cannot override the baked-in seed)")
|
||||
DEFINE_BOOL(trace_rail, false, "trace RAIL mode")
|
||||
|
||||
// runtime.cc
|
||||
DEFINE_BOOL(runtime_call_stats, false, "report runtime call counts and times")
|
||||
|
@ -1883,6 +1883,7 @@ Isolate::Isolate(bool enable_serializer)
|
||||
// TODO(bmeurer) Initialized lazily because it depends on flags; can
|
||||
// be fixed once the default isolate cleanup is done.
|
||||
random_number_generator_(NULL),
|
||||
rail_mode_(PERFORMANCE_DEFAULT),
|
||||
serializer_enabled_(enable_serializer),
|
||||
has_fatal_error_(false),
|
||||
initialized_from_snapshot_(false),
|
||||
@ -3026,6 +3027,12 @@ void Isolate::CheckDetachedContextsAfterGC() {
|
||||
}
|
||||
}
|
||||
|
||||
void Isolate::SetRAILMode(RAILMode rail_mode) {
|
||||
rail_mode_ = rail_mode;
|
||||
if (FLAG_trace_rail) {
|
||||
PrintIsolate(this, "RAIL mode: %s\n", RAILModeName(rail_mode_));
|
||||
}
|
||||
}
|
||||
|
||||
bool StackLimitCheck::JsHasOverflowed(uintptr_t gap) const {
|
||||
StackGuard* stack_guard = isolate_->stack_guard();
|
||||
|
@ -1110,6 +1110,8 @@ class Isolate {
|
||||
|
||||
bool IsInAnyContext(Object* object, uint32_t index);
|
||||
|
||||
void SetRAILMode(RAILMode rail_mode);
|
||||
|
||||
protected:
|
||||
explicit Isolate(bool enable_serializer);
|
||||
bool IsArrayOrObjectPrototype(Object* object);
|
||||
@ -1221,6 +1223,24 @@ class Isolate {
|
||||
|
||||
void RunMicrotasksInternal();
|
||||
|
||||
const char* RAILModeName(RAILMode rail_mode) const {
|
||||
switch (rail_mode) {
|
||||
case PERFORMANCE_DEFAULT:
|
||||
return "DEFAULT";
|
||||
case PERFORMANCE_RESPONSE:
|
||||
return "RESPONSE";
|
||||
case PERFORMANCE_ANIMATION:
|
||||
return "ANIMATION";
|
||||
case PERFORMANCE_IDLE:
|
||||
return "IDLE";
|
||||
case PERFORMANCE_LOAD:
|
||||
return "LOAD";
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
base::Atomic32 id_;
|
||||
EntryStackItem* entry_stack_;
|
||||
int stack_trace_nesting_level_;
|
||||
@ -1267,6 +1287,7 @@ class Isolate {
|
||||
DateCache* date_cache_;
|
||||
CallInterfaceDescriptorData* call_descriptor_data_;
|
||||
base::RandomNumberGenerator* random_number_generator_;
|
||||
RAILMode rail_mode_;
|
||||
|
||||
// Whether the isolate has been created for snapshotting.
|
||||
bool serializer_enabled_;
|
||||
|
Loading…
Reference in New Issue
Block a user