Commit 56c7d4b4 authored by mstarzinger's avatar mstarzinger Committed by Commit bot

[compiler] Remove CompilationInfo::opt_count field.

This field duplicates information from the SharedFunctionInfo. Now that
backends are guaranteed to have a SharedFunctionInfo around, we drop it.

R=verwaest@chromium.org

Review URL: https://codereview.chromium.org/1860123003

Cr-Commit-Position: refs/heads/master@{#35312}
parent b6d44663
......@@ -168,7 +168,6 @@ CompilationInfo::CompilationInfo(ParseInfo* parse_info, const char* debug_name,
prologue_offset_(Code::kPrologueOffsetNotSet),
track_positions_(FLAG_hydrogen_track_positions ||
isolate->cpu_profiler()->is_profiling()),
opt_count_(has_shared_info() ? shared_info()->opt_count() : 0),
parameter_count_(0),
optimization_id_(-1),
osr_expr_stack_height_(0),
......@@ -378,7 +377,7 @@ OptimizedCompileJob::Status OptimizedCompileJob::CreateGraph() {
// Limit the number of times we try to optimize functions.
const int kMaxOptCount =
FLAG_deopt_every_n_times == 0 ? FLAG_max_opt_count : 1000;
if (info()->opt_count() > kMaxOptCount) {
if (info()->shared_info()->opt_count() > kMaxOptCount) {
return AbortOptimization(kOptimizedTooManyTimes);
}
......
......@@ -197,7 +197,6 @@ class CompilationInfo {
Handle<Code> code() const { return code_; }
Code::Flags code_flags() const { return code_flags_; }
BailoutId osr_ast_id() const { return osr_ast_id_; }
int opt_count() const { return opt_count_; }
int num_parameters() const;
int num_parameters_including_this() const;
bool is_this_defined() const;
......@@ -557,10 +556,6 @@ class CompilationInfo {
InlinedFunctionList inlined_functions_;
// A copy of shared_info()->opt_count() to avoid handle deref
// during graph optimization.
int opt_count_;
// Number of parameters used for compilation of stubs that require arguments.
int parameter_count_;
......
......@@ -637,17 +637,12 @@ void HGlobalValueNumberingPhase::ProcessLoopBlock(
}
bool HGlobalValueNumberingPhase::AllowCodeMotion() {
return info()->IsStub() || info()->opt_count() + 1 < FLAG_max_opt_count;
}
bool HGlobalValueNumberingPhase::ShouldMove(HInstruction* instr,
HBasicBlock* loop_header) {
// If we've disabled code motion or we're in a block that unconditionally
// deoptimizes, don't move any instructions.
return AllowCodeMotion() && !instr->block()->IsDeoptimizing() &&
instr->block()->IsReachable();
return graph()->allow_code_motion() && !instr->block()->IsDeoptimizing() &&
instr->block()->IsReachable();
}
......
......@@ -126,7 +126,6 @@ class HGlobalValueNumberingPhase final : public HPhase {
void ProcessLoopBlock(HBasicBlock* block,
HBasicBlock* before_loop,
SideEffects loop_kills);
bool AllowCodeMotion();
bool ShouldMove(HInstruction* instr, HBasicBlock* loop_header);
TrackedEffects Print(SideEffects side_effects) {
return TrackedEffects(&side_effects_tracker_, side_effects);
......
......@@ -3599,7 +3599,6 @@ std::ostream& operator<<(std::ostream& os, const HBasicBlock& b) {
return os << "B" << b.block_id();
}
HGraph::HGraph(CompilationInfo* info, CallInterfaceDescriptor descriptor)
: isolate_(info->isolate()),
next_block_id_(0),
......@@ -3612,6 +3611,7 @@ HGraph::HGraph(CompilationInfo* info, CallInterfaceDescriptor descriptor)
info_(info),
descriptor_(descriptor),
zone_(info->zone()),
allow_code_motion_(false),
use_optimistic_licm_(false),
depends_on_empty_array_proto_elements_(false),
type_change_checksum_(0),
......@@ -4445,6 +4445,11 @@ bool HOptimizedGraphBuilder::BuildGraph() {
!type_info->matches_inlined_type_change_checksum(composite_checksum));
type_info->set_inlined_type_change_checksum(composite_checksum);
// Set this predicate early to avoid handle deref during graph optimization.
graph()->set_allow_code_motion(
current_info()->IsStub() ||
current_info()->shared_info()->opt_count() + 1 < FLAG_max_opt_count);
// Perform any necessary OSR-specific cleanups or changes to the graph.
osr()->FinishGraph();
......
......@@ -392,13 +392,11 @@ class HGraph final : public ZoneObject {
}
int maximum_environment_size() { return maximum_environment_size_; }
bool use_optimistic_licm() {
return use_optimistic_licm_;
}
bool allow_code_motion() const { return allow_code_motion_; }
void set_allow_code_motion(bool value) { allow_code_motion_ = value; }
void set_use_optimistic_licm(bool value) {
use_optimistic_licm_ = value;
}
bool use_optimistic_licm() const { return use_optimistic_licm_; }
void set_use_optimistic_licm(bool value) { use_optimistic_licm_ = value; }
void MarkDependsOnEmptyArrayProtoElements() {
// Add map dependency if not already added.
......@@ -480,6 +478,7 @@ class HGraph final : public ZoneObject {
CallInterfaceDescriptor descriptor_;
Zone* zone_;
bool allow_code_motion_;
bool use_optimistic_licm_;
bool depends_on_empty_array_proto_elements_;
int type_change_checksum_;
......
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