[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}
This commit is contained in:
leszeks 2016-11-15 06:22:49 -08:00 committed by Commit bot
parent f71260b298
commit 4a660091ee
4 changed files with 13 additions and 22 deletions

View File

@ -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, Node* AstGraphBuilder::Environment::Checkpoint(BailoutId ast_id,
OutputFrameStateCombine combine, OutputFrameStateCombine combine,
bool owner_has_exception) { bool owner_has_exception) {
@ -856,7 +849,7 @@ Node* AstGraphBuilder::Environment::Checkpoint(BailoutId ast_id,
} }
UpdateStateValues(&parameters_node_, 0, parameters_count()); 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(), UpdateStateValues(&stack_node_, parameters_count() + locals_count(),
stack_height()); stack_height());

View File

@ -602,7 +602,6 @@ class AstGraphBuilder::Environment : public ZoneObject {
LivenessAnalyzerBlock* liveness_block); LivenessAnalyzerBlock* liveness_block);
Environment* CopyAndShareLiveness(); Environment* CopyAndShareLiveness();
void UpdateStateValues(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);
Zone* zone() const { return builder_->local_zone(); } Zone* zone() const { return builder_->local_zone(); }
Graph* graph() const { return builder_->graph(); } Graph* graph() const { return builder_->graph(); }
AstGraphBuilder* builder() const { return builder_; } AstGraphBuilder* builder() const { return builder_; }

View File

@ -82,7 +82,6 @@ class BytecodeGraphBuilder::Environment : public ZoneObject {
bool StateValuesRequireUpdate(Node** state_values, int offset, int count); bool StateValuesRequireUpdate(Node** state_values, int offset, int count);
void UpdateStateValues(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; 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( Node* BytecodeGraphBuilder::Environment::Checkpoint(
BailoutId bailout_id, OutputFrameStateCombine combine, BailoutId bailout_id, OutputFrameStateCombine combine,
bool owner_has_exception) { bool owner_has_exception) {
UpdateStateValues(&parameters_state_values_, 0, parameter_count()); UpdateStateValues(&parameters_state_values_, 0, parameter_count());
UpdateStateValuesWithCache(&registers_state_values_, register_base(), UpdateStateValues(&registers_state_values_, register_base(),
register_count()); register_count());
UpdateStateValues(&accumulator_state_values_, accumulator_base(), 1); UpdateStateValues(&accumulator_state_values_, accumulator_base(), 1);
const Operator* op = common()->FrameState( const Operator* op = common()->FrameState(

View File

@ -160,13 +160,20 @@ void NonLiveFrameStateSlotReplacer::ClearNonLiveFrameStateSlots(
Node* NonLiveFrameStateSlotReplacer::ClearNonLiveStateValues( Node* NonLiveFrameStateSlotReplacer::ClearNonLiveStateValues(
Node* values, BitVector* liveness) { Node* values, BitVector* liveness) {
DCHECK(inputs_buffer_.empty()); 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, // Index of the next variable is its furure index in the inputs buffer,
// i.e., the buffer's size. // i.e., the buffer's size.
int var = static_cast<int>(inputs_buffer_.size());
bool live = liveness->Contains(var) || permanently_live_.Contains(var); 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( Node* result = state_values_cache()->GetNodeForValues(
inputs_buffer_.empty() ? nullptr : &(inputs_buffer_.front()), inputs_buffer_.empty() ? nullptr : &(inputs_buffer_.front()),
inputs_buffer_.size()); inputs_buffer_.size());