Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(86)

Unified Diff: src/compiler/bytecode-graph-builder.cc

Issue 2509623002: [turbofan] Sparse representation for state values (Closed)
Patch Set: Add missing operator declarations Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/compiler/bytecode-graph-builder.cc
diff --git a/src/compiler/bytecode-graph-builder.cc b/src/compiler/bytecode-graph-builder.cc
index 8a33edd8b8db4a0ff59b7dadaed53846d6c220fb..f536683e0f5c6e21fa9885f3e1b70c951bbe37d6 100644
--- a/src/compiler/bytecode-graph-builder.cc
+++ b/src/compiler/bytecode-graph-builder.cc
@@ -80,8 +80,8 @@ class BytecodeGraphBuilder::Environment : public ZoneObject {
bool StateValuesRequireUpdate(Node** state_values, Node** values, int count);
void UpdateStateValues(Node** state_values, Node** values, int count);
- void UpdateStateValuesWithCache(Node** state_values, Node** values,
- int count);
+ void UpdateStateValuesWithCache(Node** state_values, Node** values, int count,
+ const BitVector* liveness);
int RegisterToValuesIndex(interpreter::Register the_register) const;
@@ -106,10 +106,6 @@ class BytecodeGraphBuilder::Environment : public ZoneObject {
Node* accumulator_state_values_;
int register_base_;
int accumulator_base_;
-
- // A working area for writing maybe-dead values to when updating the state
- // values for registers.
- NodeVector state_value_working_area_;
};
@@ -130,8 +126,7 @@ BytecodeGraphBuilder::Environment::Environment(BytecodeGraphBuilder* builder,
values_(builder->local_zone()),
parameters_state_values_(nullptr),
registers_state_values_(nullptr),
- accumulator_state_values_(nullptr),
- state_value_working_area_(builder->local_zone()) {
+ accumulator_state_values_(nullptr) {
// The layout of values_ is:
//
// [receiver] [parameters] [registers] [accumulator]
@@ -156,8 +151,6 @@ BytecodeGraphBuilder::Environment::Environment(BytecodeGraphBuilder* builder,
// Accumulator
accumulator_base_ = static_cast<int>(values()->size());
values()->push_back(undefined_constant);
-
- state_value_working_area_.resize(register_count_);
}
BytecodeGraphBuilder::Environment::Environment(
@@ -173,9 +166,7 @@ BytecodeGraphBuilder::Environment::Environment(
registers_state_values_(nullptr),
accumulator_state_values_(nullptr),
register_base_(other->register_base_),
- accumulator_base_(other->accumulator_base_),
- // Environments can share their working area.
- state_value_working_area_(other->state_value_working_area_) {
+ accumulator_base_(other->accumulator_base_) {
values_ = other->values_;
}
@@ -396,15 +387,15 @@ void BytecodeGraphBuilder::Environment::UpdateStateValues(Node** state_values,
Node** values,
int count) {
if (StateValuesRequireUpdate(state_values, values, count)) {
- const Operator* op = common()->StateValues(count);
+ const Operator* op = common()->StateValues(count, 0u);
(*state_values) = graph()->NewNode(op, count, values);
}
}
void BytecodeGraphBuilder::Environment::UpdateStateValuesWithCache(
- Node** state_values, Node** values, int count) {
+ Node** state_values, Node** values, int count, const BitVector* liveness) {
*state_values = builder_->state_values_cache_.GetNodeForValues(
- values, static_cast<size_t>(count));
+ values, static_cast<size_t>(count), liveness);
}
Node* BytecodeGraphBuilder::Environment::Checkpoint(
@@ -413,31 +404,15 @@ Node* BytecodeGraphBuilder::Environment::Checkpoint(
UpdateStateValues(&parameters_state_values_, &values()->at(0),
parameter_count());
- if (liveness) {
- Node* optimized_out = builder()->jsgraph()->OptimizedOutConstant();
-
- for (int i = 0; i < register_count(); ++i) {
- state_value_working_area_[i] = liveness->Contains(i)
- ? values()->at(register_base() + i)
- : optimized_out;
- }
-
- Node* accumulator_value = liveness->Contains(register_count())
- ? values()->at(accumulator_base())
- : optimized_out;
-
- UpdateStateValuesWithCache(&registers_state_values_,
- state_value_working_area_.data(),
- register_count());
+ UpdateStateValuesWithCache(&registers_state_values_,
+ &values()->at(register_base()), register_count(),
+ liveness);
- UpdateStateValues(&accumulator_state_values_, &accumulator_value, 1);
- } else {
- UpdateStateValuesWithCache(&registers_state_values_,
- &values()->at(register_base()),
- register_count());
- UpdateStateValues(&accumulator_state_values_,
- &values()->at(accumulator_base()), 1);
- }
+ Node* accumulator_value =
+ liveness == nullptr || liveness->Contains(register_count())
+ ? values()->at(accumulator_base())
+ : builder()->jsgraph()->OptimizedOutConstant();
+ UpdateStateValues(&accumulator_state_values_, &accumulator_value, 1);
const Operator* op = common()->FrameState(
bailout_id, combine, builder()->frame_state_function_info());

Powered by Google App Engine
This is Rietveld 408576698