Commit 1cf0fc80 authored by Benedikt Meurer's avatar Benedikt Meurer Committed by Commit Bot

[turbofan] Allow to disable liveness analysis in CompilationInfo.

This way we can teach the debugger to disable liveness analysis when
running with (potential) breakpoints, so that the developers always
have (read) access to all scoped variable values.

Bug: v8:7608, chromium:826613
Change-Id: I7e6cea105f111c99d2620546144201624dfe1d8b
Reviewed-on: https://chromium-review.googlesource.com/985838Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#52293}
parent 8db86316
...@@ -48,6 +48,11 @@ CompilationInfo::CompilationInfo(Zone* zone, Isolate* isolate, ...@@ -48,6 +48,11 @@ CompilationInfo::CompilationInfo(Zone* zone, Isolate* isolate,
if (!FLAG_turbo_disable_switch_jump_table) SetFlag(kSwitchJumpTableEnabled); if (!FLAG_turbo_disable_switch_jump_table) SetFlag(kSwitchJumpTableEnabled);
if (FLAG_untrusted_code_mitigations) MarkAsPoisoningRegisterArguments(); if (FLAG_untrusted_code_mitigations) MarkAsPoisoningRegisterArguments();
// TODO(yangguo): Disable this in case of debugging for crbug.com/826613
if (FLAG_analyze_environment_liveness) {
MarkAsAnalyzeEnvironmentLiveness();
}
// Collect source positions for optimized code when profiling or if debugger // Collect source positions for optimized code when profiling or if debugger
// is active, to be able to get more precise source positions at the price of // is active, to be able to get more precise source positions at the price of
// more memory consumption. // more memory consumption.
......
...@@ -55,7 +55,8 @@ class V8_EXPORT_PRIVATE CompilationInfo final { ...@@ -55,7 +55,8 @@ class V8_EXPORT_PRIVATE CompilationInfo final {
kSwitchJumpTableEnabled = 1 << 13, kSwitchJumpTableEnabled = 1 << 13,
kCalledWithCodeStartRegister = 1 << 14, kCalledWithCodeStartRegister = 1 << 14,
kPoisonRegisterArguments = 1 << 15, kPoisonRegisterArguments = 1 << 15,
kAllocationFoldingEnabled = 1 << 16 kAllocationFoldingEnabled = 1 << 16,
kAnalyzeEnvironmentLiveness = 1 << 17,
}; };
// TODO(mtrofin): investigate if this might be generalized outside wasm, with // TODO(mtrofin): investigate if this might be generalized outside wasm, with
...@@ -200,6 +201,13 @@ class V8_EXPORT_PRIVATE CompilationInfo final { ...@@ -200,6 +201,13 @@ class V8_EXPORT_PRIVATE CompilationInfo final {
return GetFlag(kAllocationFoldingEnabled); return GetFlag(kAllocationFoldingEnabled);
} }
void MarkAsAnalyzeEnvironmentLiveness() {
SetFlag(kAnalyzeEnvironmentLiveness);
}
bool is_analyze_environment_liveness() const {
return GetFlag(kAnalyzeEnvironmentLiveness);
}
// Code getters and setters. // Code getters and setters.
void SetCode(Handle<Code> code) { code_ = code; } void SetCode(Handle<Code> code) { code_ = code; }
......
...@@ -516,7 +516,8 @@ BytecodeGraphBuilder::BytecodeGraphBuilder( ...@@ -516,7 +516,8 @@ BytecodeGraphBuilder::BytecodeGraphBuilder(
Handle<FeedbackVector> feedback_vector, BailoutId osr_offset, Handle<FeedbackVector> feedback_vector, BailoutId osr_offset,
JSGraph* jsgraph, CallFrequency invocation_frequency, JSGraph* jsgraph, CallFrequency invocation_frequency,
SourcePositionTable* source_positions, Handle<Context> native_context, SourcePositionTable* source_positions, Handle<Context> native_context,
int inlining_id, JSTypeHintLowering::Flags flags, bool stack_check) int inlining_id, JSTypeHintLowering::Flags flags, bool stack_check,
bool analyze_environment_liveness)
: local_zone_(local_zone), : local_zone_(local_zone),
jsgraph_(jsgraph), jsgraph_(jsgraph),
invocation_frequency_(invocation_frequency), invocation_frequency_(invocation_frequency),
...@@ -533,6 +534,7 @@ BytecodeGraphBuilder::BytecodeGraphBuilder( ...@@ -533,6 +534,7 @@ BytecodeGraphBuilder::BytecodeGraphBuilder(
osr_offset_(osr_offset), osr_offset_(osr_offset),
currently_peeled_loop_offset_(-1), currently_peeled_loop_offset_(-1),
stack_check_(stack_check), stack_check_(stack_check),
analyze_environment_liveness_(analyze_environment_liveness),
merge_environments_(local_zone), merge_environments_(local_zone),
generator_merge_environments_(local_zone), generator_merge_environments_(local_zone),
exception_handlers_(local_zone), exception_handlers_(local_zone),
...@@ -869,7 +871,7 @@ void BytecodeGraphBuilder::VisitSingleBytecode( ...@@ -869,7 +871,7 @@ void BytecodeGraphBuilder::VisitSingleBytecode(
void BytecodeGraphBuilder::VisitBytecodes() { void BytecodeGraphBuilder::VisitBytecodes() {
BytecodeAnalysis bytecode_analysis(bytecode_array(), local_zone(), BytecodeAnalysis bytecode_analysis(bytecode_array(), local_zone(),
FLAG_analyze_environment_liveness); analyze_environment_liveness());
bytecode_analysis.Analyze(osr_offset_); bytecode_analysis.Analyze(osr_offset_);
set_bytecode_analysis(&bytecode_analysis); set_bytecode_analysis(&bytecode_analysis);
...@@ -878,7 +880,7 @@ void BytecodeGraphBuilder::VisitBytecodes() { ...@@ -878,7 +880,7 @@ void BytecodeGraphBuilder::VisitBytecodes() {
SourcePositionTableIterator source_position_iterator( SourcePositionTableIterator source_position_iterator(
handle(bytecode_array()->SourcePositionTable())); handle(bytecode_array()->SourcePositionTable()));
if (FLAG_trace_environment_liveness) { if (analyze_environment_liveness() && FLAG_trace_environment_liveness) {
OFStream of(stdout); OFStream of(stdout);
bytecode_analysis.PrintLivenessTo(of); bytecode_analysis.PrintLivenessTo(of);
......
...@@ -35,7 +35,7 @@ class BytecodeGraphBuilder { ...@@ -35,7 +35,7 @@ class BytecodeGraphBuilder {
SourcePositionTable* source_positions, Handle<Context> native_context, SourcePositionTable* source_positions, Handle<Context> native_context,
int inlining_id = SourcePosition::kNotInlined, int inlining_id = SourcePosition::kNotInlined,
JSTypeHintLowering::Flags flags = JSTypeHintLowering::kNoFlags, JSTypeHintLowering::Flags flags = JSTypeHintLowering::kNoFlags,
bool stack_check = true); bool stack_check = true, bool analyze_environment_liveness = true);
// Creates a graph by visiting bytecodes. // Creates a graph by visiting bytecodes.
void CreateGraph(); void CreateGraph();
...@@ -349,6 +349,10 @@ class BytecodeGraphBuilder { ...@@ -349,6 +349,10 @@ class BytecodeGraphBuilder {
void set_stack_check(bool stack_check) { stack_check_ = stack_check; } void set_stack_check(bool stack_check) { stack_check_ = stack_check; }
bool analyze_environment_liveness() const {
return analyze_environment_liveness_;
}
int current_exception_handler() { return current_exception_handler_; } int current_exception_handler() { return current_exception_handler_; }
void set_current_exception_handler(int index) { void set_current_exception_handler(int index) {
...@@ -379,6 +383,7 @@ class BytecodeGraphBuilder { ...@@ -379,6 +383,7 @@ class BytecodeGraphBuilder {
BailoutId osr_offset_; BailoutId osr_offset_;
int currently_peeled_loop_offset_; int currently_peeled_loop_offset_;
bool stack_check_; bool stack_check_;
bool analyze_environment_liveness_;
// Merge environments are snapshots of the environment at points where the // Merge environments are snapshots of the environment at points where the
// control flow merges. This models a forward data flow propagation of all // control flow merges. This models a forward data flow propagation of all
......
...@@ -489,7 +489,7 @@ Reduction JSInliner::ReduceJSCall(Node* node) { ...@@ -489,7 +489,7 @@ Reduction JSInliner::ReduceJSCall(Node* node) {
BytecodeGraphBuilder graph_builder( BytecodeGraphBuilder graph_builder(
zone(), shared_info, feedback_vector, BailoutId::None(), jsgraph(), zone(), shared_info, feedback_vector, BailoutId::None(), jsgraph(),
call.frequency(), source_positions_, native_context(), inlining_id, call.frequency(), source_positions_, native_context(), inlining_id,
flags, false); flags, false, info_->is_analyze_environment_liveness());
graph_builder.CreateGraph(); graph_builder.CreateGraph();
// Extract the inlinee start/end nodes. // Extract the inlinee start/end nodes.
......
...@@ -1062,7 +1062,8 @@ struct GraphBuilderPhase { ...@@ -1062,7 +1062,8 @@ struct GraphBuilderPhase {
handle(data->info()->closure()->feedback_vector()), handle(data->info()->closure()->feedback_vector()),
data->info()->osr_offset(), data->jsgraph(), CallFrequency(1.0f), data->info()->osr_offset(), data->jsgraph(), CallFrequency(1.0f),
data->source_positions(), data->native_context(), data->source_positions(), data->native_context(),
SourcePosition::kNotInlined, flags); SourcePosition::kNotInlined, flags, true,
data->info()->is_analyze_environment_liveness());
graph_builder.CreateGraph(); graph_builder.CreateGraph();
} }
}; };
......
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