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

Unified Diff: src/compiler/js-typed-lowering.cc

Issue 1997373002: [turbofan] Simplify typed lowering of generator-related operators. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 7 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/js-typed-lowering.cc
diff --git a/src/compiler/js-typed-lowering.cc b/src/compiler/js-typed-lowering.cc
index 3c7ecf85bc88e7e8a1550f594e5f44b3611226b3..a4aaa9f0fe0d7a9a76308be1fe7462737502fb93 100644
--- a/src/compiler/js-typed-lowering.cc
+++ b/src/compiler/js-typed-lowering.cc
@@ -1633,6 +1633,7 @@ Reduction JSTypedLowering::ReduceJSForInStep(Node* node) {
Reduction JSTypedLowering::ReduceJSGeneratorStore(Node* node) {
DCHECK_EQ(IrOpcode::kJSGeneratorStore, node->opcode());
Node* generator = NodeProperties::GetValueInput(node, 0);
+ Node* continuation = NodeProperties::GetValueInput(node, 1);
Node* context = NodeProperties::GetContextInput(node);
Node* effect = NodeProperties::GetEffectInput(node);
Node* control = NodeProperties::GetControlInput(node);
@@ -1643,8 +1644,8 @@ Reduction JSTypedLowering::ReduceJSGeneratorStore(Node* node) {
FieldAccess continuation_field =
AccessBuilder::ForJSGeneratorObjectContinuation();
- Node* array = graph()->NewNode(simplified()->LoadField(array_field),
- generator, effect, control);
+ Node* array = effect = graph()->NewNode(simplified()->LoadField(array_field),
+ generator, effect, control);
for (int i = 0; i < register_count; ++i) {
Node* value = NodeProperties::GetValueInput(node, 2 + i);
@@ -1655,20 +1656,11 @@ Reduction JSTypedLowering::ReduceJSGeneratorStore(Node* node) {
effect = graph()->NewNode(simplified()->StoreField(context_field), generator,
context, effect, control);
+ effect = graph()->NewNode(simplified()->StoreField(continuation_field),
+ generator, continuation, effect, control);
- // Change the JSGeneratorStore node to a StoreField node.
- DCHECK_EQ(0, OperatorProperties::GetFrameStateInputCount(node->op()));
- DCHECK_EQ(1, OperatorProperties::GetContextInputCount(node->op()));
- node->RemoveInput(NodeProperties::FirstContextIndex(node));
- for (int i = 0; i < register_count; ++i) {
- node->RemoveInput(NodeProperties::FirstValueIndex(node) + 2);
- }
- NodeProperties::RemoveType(node);
- NodeProperties::ChangeOp(node, simplified()->StoreField(continuation_field));
-
- NodeProperties::ReplaceEffectInput(node, effect);
-
- return Changed(node);
+ ReplaceWithValue(node, effect, effect, control);
+ return Changed(effect);
}
Reduction JSTypedLowering::ReduceJSGeneratorRestoreContinuation(Node* node) {
@@ -1680,23 +1672,14 @@ Reduction JSTypedLowering::ReduceJSGeneratorRestoreContinuation(Node* node) {
FieldAccess continuation_field =
AccessBuilder::ForJSGeneratorObjectContinuation();
- Node* continuation = graph()->NewNode(
+ Node* continuation = effect = graph()->NewNode(
simplified()->LoadField(continuation_field), generator, effect, control);
+ Node* executing = jsgraph()->Constant(JSGeneratorObject::kGeneratorExecuting);
+ effect = graph()->NewNode(simplified()->StoreField(continuation_field),
+ generator, executing, effect, control);
- // Change the JSGeneratorRestoreContinuation node to a StoreField node.
- DCHECK_EQ(0, OperatorProperties::GetFrameStateInputCount(node->op()));
- DCHECK_EQ(1, OperatorProperties::GetContextInputCount(node->op()));
- node->RemoveInput(NodeProperties::FirstContextIndex(node));
- node->InsertInput(
- graph()->zone(), 1,
- jsgraph()->Constant(JSGeneratorObject::kGeneratorExecuting));
- NodeProperties::RemoveType(node);
- NodeProperties::ChangeOp(node, simplified()->StoreField(continuation_field));
-
- NodeProperties::ReplaceEffectInput(node, continuation);
- ReplaceWithValue(node, continuation, node, control);
-
- return Changed(node);
+ ReplaceWithValue(node, continuation, effect, control);
+ return Changed(continuation);
}
Reduction JSTypedLowering::ReduceJSGeneratorRestoreRegister(Node* node) {
@@ -1709,24 +1692,16 @@ Reduction JSTypedLowering::ReduceJSGeneratorRestoreRegister(Node* node) {
FieldAccess array_field = AccessBuilder::ForJSGeneratorObjectOperandStack();
FieldAccess element_field = AccessBuilder::ForFixedArraySlot(index);
- Node* array = graph()->NewNode(simplified()->LoadField(array_field),
- generator, effect, control);
- Node* element = graph()->NewNode(simplified()->LoadField(element_field),
- array, array, control);
-
- // Change the JSGeneratorRestoreRegister node to a StoreField node.
- DCHECK_EQ(0, OperatorProperties::GetFrameStateInputCount(node->op()));
- DCHECK_EQ(1, OperatorProperties::GetContextInputCount(node->op()));
- node->RemoveInput(NodeProperties::FirstContextIndex(node));
- node->ReplaceInput(0, array);
- node->InsertInput(graph()->zone(), 1, jsgraph()->StaleRegisterConstant());
- NodeProperties::RemoveType(node);
- NodeProperties::ChangeOp(node, simplified()->StoreField(element_field));
+ Node* array = effect = graph()->NewNode(simplified()->LoadField(array_field),
+ generator, effect, control);
+ Node* element = effect = graph()->NewNode(
+ simplified()->LoadField(element_field), array, effect, control);
+ Node* stale = jsgraph()->StaleRegisterConstant();
+ effect = graph()->NewNode(simplified()->StoreField(element_field), array,
+ stale, effect, control);
- NodeProperties::ReplaceEffectInput(node, element);
- ReplaceWithValue(node, element, node, control);
-
- return Changed(node);
+ ReplaceWithValue(node, element, effect, control);
+ return Changed(element);
}
Reduction JSTypedLowering::ReduceSelect(Node* node) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698