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: Renaming and changing refs to pointers 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
« no previous file with comments | « src/compiler/ast-graph-builder.cc ('k') | src/compiler/common-operator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/bytecode-graph-builder.cc
diff --git a/src/compiler/bytecode-graph-builder.cc b/src/compiler/bytecode-graph-builder.cc
index 12a5d29d21770df1c39b691df66c3654c3f27946..f4f73f0755d17befbd94d48fc47d9ad7ac3ba02d 100644
--- a/src/compiler/bytecode-graph-builder.cc
+++ b/src/compiler/bytecode-graph-builder.cc
@@ -82,8 +82,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;
@@ -108,10 +108,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_;
};
@@ -132,8 +128,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]
@@ -158,8 +153,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(
@@ -175,9 +168,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_;
}
@@ -398,15 +389,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, SparseInputMask::Dense());
(*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(
@@ -415,31 +406,17 @@ 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->RegisterIsLive(i)
- ? values()->at(register_base() + i)
- : optimized_out;
- }
-
- Node* accumulator_value = liveness->AccumulatorIsLive()
- ? values()->at(accumulator_base())
- : optimized_out;
-
- UpdateStateValuesWithCache(&registers_state_values_,
- state_value_working_area_.data(),
- register_count());
-
- 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);
- }
+ // TODO(leszeks): We should pass a view of the liveness bitvector here, with
+ // offset and count, rather than passing the entire bitvector and assuming
+ // that register liveness starts at offset 0.
+ UpdateStateValuesWithCache(&registers_state_values_,
+ &values()->at(register_base()), register_count(),
+ liveness ? &liveness->bit_vector() : nullptr);
+
+ Node* accumulator_value = liveness == nullptr || liveness->AccumulatorIsLive()
+ ? 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());
« no previous file with comments | « src/compiler/ast-graph-builder.cc ('k') | src/compiler/common-operator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698