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

Unified Diff: src/compiler/load-elimination.cc

Issue 2227493002: [turbofan] Add initial support for growing stores. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add comments. Created 4 years, 4 months 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/load-elimination.h ('k') | src/compiler/opcodes.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/load-elimination.cc
diff --git a/src/compiler/load-elimination.cc b/src/compiler/load-elimination.cc
index 98df1c883b08beb060b311d6006046e568061001..ab7b893e81362da3d30289940e6e64763e435c02 100644
--- a/src/compiler/load-elimination.cc
+++ b/src/compiler/load-elimination.cc
@@ -56,6 +56,8 @@ Reduction LoadElimination::Reduce(Node* node) {
return ReduceCheckMaps(node);
case IrOpcode::kEnsureWritableFastElements:
return ReduceEnsureWritableFastElements(node);
+ case IrOpcode::kMaybeGrowFastElements:
+ return ReduceMaybeGrowFastElements(node);
case IrOpcode::kTransitionElementsKind:
return ReduceTransitionElementsKind(node);
case IrOpcode::kLoadField:
@@ -352,6 +354,32 @@ Reduction LoadElimination::ReduceEnsureWritableFastElements(Node* node) {
return UpdateState(node, state);
}
+Reduction LoadElimination::ReduceMaybeGrowFastElements(Node* node) {
+ GrowFastElementsFlags flags = GrowFastElementsFlagsOf(node->op());
+ Node* const object = NodeProperties::GetValueInput(node, 0);
+ Node* const effect = NodeProperties::GetEffectInput(node);
+ AbstractState const* state = node_states_.Get(effect);
+ if (state == nullptr) return NoChange();
+ if (flags & GrowFastElementsFlag::kDoubleElements) {
+ // We know that the resulting elements have the fixed double array map.
+ Node* fixed_double_array_map = jsgraph()->FixedDoubleArrayMapConstant();
+ state = state->AddField(node, 0, fixed_double_array_map, zone());
+ } else {
+ // We know that the resulting elements have the fixed array map.
+ Node* fixed_array_map = jsgraph()->FixedArrayMapConstant();
+ state = state->AddField(node, 0, fixed_array_map, zone());
+ }
+ if (flags & GrowFastElementsFlag::kArrayObject) {
+ // Kill the previous Array::length on {object}.
+ state = state->KillField(object, 3, zone());
+ }
+ // Kill the previous elements on {object}.
+ state = state->KillField(object, 2, zone());
+ // Add the new elements on {object}.
+ state = state->AddField(object, 2, node, zone());
+ return UpdateState(node, state);
+}
+
Reduction LoadElimination::ReduceTransitionElementsKind(Node* node) {
Node* const object = NodeProperties::GetValueInput(node, 0);
Node* const source_map = NodeProperties::GetValueInput(node, 1);
@@ -580,11 +608,19 @@ LoadElimination::AbstractState const* LoadElimination::ComputeLoopState(
switch (current->opcode()) {
case IrOpcode::kEnsureWritableFastElements: {
Node* const object = NodeProperties::GetValueInput(current, 0);
- Node* const elements = NodeProperties::GetValueInput(current, 1);
- state = state->KillField(elements, 0, zone());
state = state->KillField(object, 2, zone());
break;
}
+ case IrOpcode::kMaybeGrowFastElements: {
+ GrowFastElementsFlags flags =
+ GrowFastElementsFlagsOf(current->op());
+ Node* const object = NodeProperties::GetValueInput(current, 0);
+ state = state->KillField(object, 2, zone());
+ if (flags & GrowFastElementsFlag::kArrayObject) {
+ state = state->KillField(object, 3, zone());
+ }
+ break;
+ }
case IrOpcode::kTransitionElementsKind: {
Node* const object = NodeProperties::GetValueInput(current, 0);
state = state->KillField(object, 0, zone());
« no previous file with comments | « src/compiler/load-elimination.h ('k') | src/compiler/opcodes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698