[gn] Allow building a snapshot with unwinding information.

Add a new "v8_perf_prof_unwinding_info" option to gn that translates to building
the snapshot with "--perf-prof-unwinding-info". It allows unwinding TF generated
code from the snapshot.

Additionally, add a warning if one uses the option along with a snapshot which
was not build with unwinding information.

Running tests in this configuration revealed an issue in the checks performed
when accessing the stub cache. We would assume that the `Code::Flags` bitfield
only contains the `Kind` and `ExtraICState` fields, when there is also a
`HasUnwindingInfo` field which can now be set for stubs.

BUG=

Review-Url: https://codereview.chromium.org/2887783002
Cr-Commit-Position: refs/heads/master@{#45477}
This commit is contained in:
pierre.langlois 2017-05-23 02:47:29 -07:00 committed by Commit bot
parent 8e0daf78da
commit 73ab0f4b9f
3 changed files with 23 additions and 6 deletions

View File

@ -79,6 +79,10 @@ declare_args() {
# Sets -dV8_CONCURRENT_MARKING
v8_enable_concurrent_marking = false
# Build the snapshot with unwinding information for perf.
# Sets -dV8_USE_SNAPSHOT_WITH_UNWINDING_INFO.
v8_perf_prof_unwinding_info = false
# With post mortem support enabled, metadata is embedded into libv8 that
# describes various parameters of the VM for use by debuggers. See
# tools/gen-postmortem-metadata.py for details.
@ -256,6 +260,9 @@ config("features") {
}
if (v8_use_snapshot) {
defines += [ "V8_USE_SNAPSHOT" ]
if (v8_perf_prof_unwinding_info) {
defines += [ "V8_USE_SNAPSHOT_WITH_UNWINDING_INFO" ]
}
}
if (v8_use_external_startup_data) {
defines += [ "V8_USE_EXTERNAL_STARTUP_DATA" ]
@ -743,6 +750,10 @@ action("run_mksnapshot") {
]
}
if (v8_perf_prof_unwinding_info) {
args += [ "--perf-prof-unwinding-info" ]
}
if (v8_use_external_startup_data) {
outputs += [ "$root_out_dir/snapshot_blob.bin" ]
args += [

View File

@ -41,12 +41,10 @@ bool CommonStubCacheChecks(StubCache* stub_cache, Name* name, Map* map,
if (handler) {
DCHECK(IC::IsHandler(handler));
if (handler->IsCode()) {
Code* code = Code::cast(handler);
Code::Flags expected_flags =
Code::ComputeHandlerFlags(stub_cache->ic_kind());
Code::Flags flags = code->flags();
DCHECK_EQ(expected_flags, flags);
DCHECK_EQ(Code::HANDLER, Code::ExtractKindFromFlags(code->flags()));
Code::Flags code_flags = Code::cast(handler)->flags();
Code::Kind ic_code_kind = stub_cache->ic_kind();
DCHECK_EQ(ic_code_kind, Code::ExtractExtraICStateFromFlags(code_flags));
DCHECK_EQ(Code::HANDLER, Code::ExtractKindFromFlags(code_flags));
}
}
return true;

View File

@ -20,6 +20,14 @@ void SetupIsolateDelegate::SetupBuiltins(Isolate* isolate,
void SetupIsolateDelegate::SetupInterpreter(
interpreter::Interpreter* interpreter, bool create_heap_objects) {
#if defined(V8_USE_SNAPSHOT) && !defined(V8_USE_SNAPSHOT_WITH_UNWINDING_INFO)
if (FLAG_perf_prof_unwinding_info) {
OFStream os(stdout);
os << "Warning: The --perf-prof-unwinding-info flag can be passed at "
"mksnapshot time to get better results."
<< std::endl;
}
#endif
DCHECK(interpreter->IsDispatchTableInitialized());
}