Commit 4a660091 authored by leszeks's avatar leszeks Committed by Commit bot

[turbofan] Do not use the state value cache when building the tree

Since the liveness analysis's non-live value clearing rebuilds the state
value trees, we don't need to be smart when creating state values in the
initial graph building. This simplifies both the building and the
iteration over the state values by the liveness analyzer.

Review-Url: https://codereview.chromium.org/2495413003
Cr-Commit-Position: refs/heads/master@{#40996}
parent f71260b2
......@@ -841,13 +841,6 @@ void AstGraphBuilder::Environment::UpdateStateValues(Node** state_values,
}
void AstGraphBuilder::Environment::UpdateStateValuesWithCache(
Node** state_values, int offset, int count) {
Node** env_values = (count == 0) ? nullptr : &values()->at(offset);
*state_values = builder_->state_values_cache_.GetNodeForValues(
env_values, static_cast<size_t>(count));
}
Node* AstGraphBuilder::Environment::Checkpoint(BailoutId ast_id,
OutputFrameStateCombine combine,
bool owner_has_exception) {
......@@ -856,7 +849,7 @@ Node* AstGraphBuilder::Environment::Checkpoint(BailoutId ast_id,
}
UpdateStateValues(&parameters_node_, 0, parameters_count());
UpdateStateValuesWithCache(&locals_node_, parameters_count(), locals_count());
UpdateStateValues(&locals_node_, parameters_count(), locals_count());
UpdateStateValues(&stack_node_, parameters_count() + locals_count(),
stack_height());
......
......@@ -602,7 +602,6 @@ class AstGraphBuilder::Environment : public ZoneObject {
LivenessAnalyzerBlock* liveness_block);
Environment* CopyAndShareLiveness();
void UpdateStateValues(Node** state_values, int offset, int count);
void UpdateStateValuesWithCache(Node** state_values, int offset, int count);
Zone* zone() const { return builder_->local_zone(); }
Graph* graph() const { return builder_->graph(); }
AstGraphBuilder* builder() const { return builder_; }
......
......@@ -82,7 +82,6 @@ class BytecodeGraphBuilder::Environment : public ZoneObject {
bool StateValuesRequireUpdate(Node** state_values, int offset, int count);
void UpdateStateValues(Node** state_values, int offset, int count);
void UpdateStateValuesWithCache(Node** state_values, int offset, int count);
int RegisterToValuesIndex(interpreter::Register the_register) const;
......@@ -453,19 +452,12 @@ void BytecodeGraphBuilder::Environment::UpdateStateValues(Node** state_values,
}
}
void BytecodeGraphBuilder::Environment::UpdateStateValuesWithCache(
Node** state_values, int offset, int count) {
Node** env_values = (count == 0) ? nullptr : &values()->at(offset);
*state_values = builder_->state_values_cache_.GetNodeForValues(
env_values, static_cast<size_t>(count));
}
Node* BytecodeGraphBuilder::Environment::Checkpoint(
BailoutId bailout_id, OutputFrameStateCombine combine,
bool owner_has_exception) {
UpdateStateValues(&parameters_state_values_, 0, parameter_count());
UpdateStateValuesWithCache(&registers_state_values_, register_base(),
register_count());
UpdateStateValues(&registers_state_values_, register_base(),
register_count());
UpdateStateValues(&accumulator_state_values_, accumulator_base(), 1);
const Operator* op = common()->FrameState(
......
......@@ -160,13 +160,20 @@ void NonLiveFrameStateSlotReplacer::ClearNonLiveFrameStateSlots(
Node* NonLiveFrameStateSlotReplacer::ClearNonLiveStateValues(
Node* values, BitVector* liveness) {
DCHECK(inputs_buffer_.empty());
for (StateValuesAccess::TypedNode node : StateValuesAccess(values)) {
int var = 0;
for (Node* value_node : values->inputs()) {
// Make sure this isn't a state value tree
DCHECK(value_node->opcode() != IrOpcode::kStateValues);
// Index of the next variable is its furure index in the inputs buffer,
// i.e., the buffer's size.
int var = static_cast<int>(inputs_buffer_.size());
bool live = liveness->Contains(var) || permanently_live_.Contains(var);
inputs_buffer_.push_back(live ? node.node : replacement_node_);
inputs_buffer_.push_back(live ? value_node : replacement_node_);
var++;
}
Node* result = state_values_cache()->GetNodeForValues(
inputs_buffer_.empty() ? nullptr : &(inputs_buffer_.front()),
inputs_buffer_.size());
......
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