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

Side by Side Diff: src/compiler/js-typed-lowering.cc

Issue 2079613003: [generators] Implement %GeneratorGetSourcePosition. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: enable test Created 4 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/code-factory.h" 5 #include "src/code-factory.h"
6 #include "src/compilation-dependencies.h" 6 #include "src/compilation-dependencies.h"
7 #include "src/compiler/access-builder.h" 7 #include "src/compiler/access-builder.h"
8 #include "src/compiler/js-graph.h" 8 #include "src/compiler/js-graph.h"
9 #include "src/compiler/js-typed-lowering.h" 9 #include "src/compiler/js-typed-lowering.h"
10 #include "src/compiler/linkage.h" 10 #include "src/compiler/linkage.h"
(...skipping 1709 matching lines...) Expand 10 before | Expand all | Expand 10 after
1720 DCHECK_EQ(IrOpcode::kJSForInStep, node->opcode()); 1720 DCHECK_EQ(IrOpcode::kJSForInStep, node->opcode());
1721 node->ReplaceInput(1, jsgraph()->Int32Constant(1)); 1721 node->ReplaceInput(1, jsgraph()->Int32Constant(1));
1722 NodeProperties::ChangeOp(node, machine()->Int32Add()); 1722 NodeProperties::ChangeOp(node, machine()->Int32Add());
1723 return Changed(node); 1723 return Changed(node);
1724 } 1724 }
1725 1725
1726 Reduction JSTypedLowering::ReduceJSGeneratorStore(Node* node) { 1726 Reduction JSTypedLowering::ReduceJSGeneratorStore(Node* node) {
1727 DCHECK_EQ(IrOpcode::kJSGeneratorStore, node->opcode()); 1727 DCHECK_EQ(IrOpcode::kJSGeneratorStore, node->opcode());
1728 Node* generator = NodeProperties::GetValueInput(node, 0); 1728 Node* generator = NodeProperties::GetValueInput(node, 0);
1729 Node* continuation = NodeProperties::GetValueInput(node, 1); 1729 Node* continuation = NodeProperties::GetValueInput(node, 1);
1730 Node* offset = NodeProperties::GetValueInput(node, 2);
1730 Node* context = NodeProperties::GetContextInput(node); 1731 Node* context = NodeProperties::GetContextInput(node);
1731 Node* effect = NodeProperties::GetEffectInput(node); 1732 Node* effect = NodeProperties::GetEffectInput(node);
1732 Node* control = NodeProperties::GetControlInput(node); 1733 Node* control = NodeProperties::GetControlInput(node);
1733 int register_count = OpParameter<int>(node); 1734 int register_count = OpParameter<int>(node);
1734 1735
1735 FieldAccess array_field = AccessBuilder::ForJSGeneratorObjectOperandStack(); 1736 FieldAccess array_field = AccessBuilder::ForJSGeneratorObjectOperandStack();
1736 FieldAccess context_field = AccessBuilder::ForJSGeneratorObjectContext(); 1737 FieldAccess context_field = AccessBuilder::ForJSGeneratorObjectContext();
1737 FieldAccess continuation_field = 1738 FieldAccess continuation_field =
1738 AccessBuilder::ForJSGeneratorObjectContinuation(); 1739 AccessBuilder::ForJSGeneratorObjectContinuation();
1740 FieldAccess input_field = AccessBuilder::ForJSGeneratorObjectInput();
Jarin 2016/06/20 07:56:49 Please, add some explanation why it is ok to hijac
rmcilroy 2016/06/20 11:11:26 +1
1739 1741
1740 Node* array = effect = graph()->NewNode(simplified()->LoadField(array_field), 1742 Node* array = effect = graph()->NewNode(simplified()->LoadField(array_field),
1741 generator, effect, control); 1743 generator, effect, control);
1742 1744
1743 for (int i = 0; i < register_count; ++i) { 1745 for (int i = 0; i < register_count; ++i) {
1744 Node* value = NodeProperties::GetValueInput(node, 2 + i); 1746 Node* value = NodeProperties::GetValueInput(node, 3 + i);
1745 effect = graph()->NewNode( 1747 effect = graph()->NewNode(
1746 simplified()->StoreField(AccessBuilder::ForFixedArraySlot(i)), array, 1748 simplified()->StoreField(AccessBuilder::ForFixedArraySlot(i)), array,
1747 value, effect, control); 1749 value, effect, control);
1748 } 1750 }
1749 1751
1750 effect = graph()->NewNode(simplified()->StoreField(context_field), generator, 1752 effect = graph()->NewNode(simplified()->StoreField(context_field), generator,
1751 context, effect, control); 1753 context, effect, control);
1752 effect = graph()->NewNode(simplified()->StoreField(continuation_field), 1754 effect = graph()->NewNode(simplified()->StoreField(continuation_field),
1753 generator, continuation, effect, control); 1755 generator, continuation, effect, control);
1756 effect = graph()->NewNode(simplified()->StoreField(input_field), generator,
1757 offset, effect, control);
1754 1758
1755 ReplaceWithValue(node, effect, effect, control); 1759 ReplaceWithValue(node, effect, effect, control);
1756 return Changed(effect); 1760 return Changed(effect);
1757 } 1761 }
1758 1762
1759 Reduction JSTypedLowering::ReduceJSGeneratorRestoreContinuation(Node* node) { 1763 Reduction JSTypedLowering::ReduceJSGeneratorRestoreContinuation(Node* node) {
1760 DCHECK_EQ(IrOpcode::kJSGeneratorRestoreContinuation, node->opcode()); 1764 DCHECK_EQ(IrOpcode::kJSGeneratorRestoreContinuation, node->opcode());
1761 Node* generator = NodeProperties::GetValueInput(node, 0); 1765 Node* generator = NodeProperties::GetValueInput(node, 0);
1762 Node* effect = NodeProperties::GetEffectInput(node); 1766 Node* effect = NodeProperties::GetEffectInput(node);
1763 Node* control = NodeProperties::GetControlInput(node); 1767 Node* control = NodeProperties::GetControlInput(node);
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
1991 } 1995 }
1992 1996
1993 1997
1994 CompilationDependencies* JSTypedLowering::dependencies() const { 1998 CompilationDependencies* JSTypedLowering::dependencies() const {
1995 return dependencies_; 1999 return dependencies_;
1996 } 2000 }
1997 2001
1998 } // namespace compiler 2002 } // namespace compiler
1999 } // namespace internal 2003 } // namespace internal
2000 } // namespace v8 2004 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698