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

Side by Side Diff: src/compiler/typer.cc

Issue 568743003: Fixpoint typing has to consider all imprecise nodes (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Changed to work on TOT; updated test statuses Created 6 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | test/cctest/cctest.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/compiler/graph-inl.h" 5 #include "src/compiler/graph-inl.h"
6 #include "src/compiler/js-operator.h" 6 #include "src/compiler/js-operator.h"
7 #include "src/compiler/node.h" 7 #include "src/compiler/node.h"
8 #include "src/compiler/node-properties-inl.h" 8 #include "src/compiler/node-properties-inl.h"
9 #include "src/compiler/node-properties.h" 9 #include "src/compiler/node-properties.h"
10 #include "src/compiler/simplified-operator.h" 10 #include "src/compiler/simplified-operator.h"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 private: 112 private:
113 Typer* typer_; 113 Typer* typer_;
114 MaybeHandle<Context> context_; 114 MaybeHandle<Context> context_;
115 }; 115 };
116 116
117 117
118 class Typer::RunVisitor : public Typer::Visitor { 118 class Typer::RunVisitor : public Typer::Visitor {
119 public: 119 public:
120 RunVisitor(Typer* typer, MaybeHandle<Context> context) 120 RunVisitor(Typer* typer, MaybeHandle<Context> context)
121 : Visitor(typer, context), 121 : Visitor(typer, context),
122 phis(NodeSet::key_compare(), NodeSet::allocator_type(typer->zone())) {} 122 redo(NodeSet::key_compare(), NodeSet::allocator_type(typer->zone())) {}
123 123
124 GenericGraphVisit::Control Post(Node* node) { 124 GenericGraphVisit::Control Post(Node* node) {
125 if (OperatorProperties::HasValueOutput(node->op())) { 125 if (OperatorProperties::HasValueOutput(node->op())) {
126 Bounds bounds = TypeNode(node); 126 Bounds bounds = TypeNode(node);
127 NodeProperties::SetBounds(node, bounds); 127 NodeProperties::SetBounds(node, bounds);
128 // Remember phis for least fixpoint iteration. 128 // Remember incompletely typed nodes for least fixpoint iteration.
129 if (node->opcode() == IrOpcode::kPhi) phis.insert(node); 129 int arity = OperatorProperties::GetValueInputCount(node->op());
130 for (int i = 0; i < arity; ++i) {
131 // TODO(rossberg): change once IsTyped is available.
132 // if (!NodeProperties::IsTyped(NodeProperties::GetValueInput(node, i))) {
133 if (OperandType(node, i).upper->Is(Type::None())) {
134 redo.insert(node);
135 break;
136 }
137 }
130 } 138 }
131 return GenericGraphVisit::CONTINUE; 139 return GenericGraphVisit::CONTINUE;
132 } 140 }
133 141
134 NodeSet phis; 142 NodeSet redo;
135 }; 143 };
136 144
137 145
138 class Typer::NarrowVisitor : public Typer::Visitor { 146 class Typer::NarrowVisitor : public Typer::Visitor {
139 public: 147 public:
140 NarrowVisitor(Typer* typer, MaybeHandle<Context> context) 148 NarrowVisitor(Typer* typer, MaybeHandle<Context> context)
141 : Visitor(typer, context) {} 149 : Visitor(typer, context) {}
142 150
143 GenericGraphVisit::Control Pre(Node* node) { 151 GenericGraphVisit::Control Pre(Node* node) {
144 if (OperatorProperties::HasValueOutput(node->op())) { 152 if (OperatorProperties::HasValueOutput(node->op())) {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 GenericGraphVisit::Control Post(Node* node) { 191 GenericGraphVisit::Control Post(Node* node) {
184 return GenericGraphVisit::REENTER; 192 return GenericGraphVisit::REENTER;
185 } 193 }
186 }; 194 };
187 195
188 196
189 void Typer::Run(Graph* graph, MaybeHandle<Context> context) { 197 void Typer::Run(Graph* graph, MaybeHandle<Context> context) {
190 RunVisitor typing(this, context); 198 RunVisitor typing(this, context);
191 graph->VisitNodeInputsFromEnd(&typing); 199 graph->VisitNodeInputsFromEnd(&typing);
192 // Find least fixpoint. 200 // Find least fixpoint.
193 for (NodeSetIter i = typing.phis.begin(); i != typing.phis.end(); ++i) { 201 for (NodeSetIter i = typing.redo.begin(); i != typing.redo.end(); ++i) {
194 Widen(graph, *i, context); 202 Widen(graph, *i, context);
195 } 203 }
196 } 204 }
197 205
198 206
199 void Typer::Narrow(Graph* graph, Node* start, MaybeHandle<Context> context) { 207 void Typer::Narrow(Graph* graph, Node* start, MaybeHandle<Context> context) {
200 NarrowVisitor typing(this, context); 208 NarrowVisitor typing(this, context);
201 graph->VisitNodeUsesFrom(start, &typing); 209 graph->VisitNodeUsesFrom(start, &typing);
202 } 210 }
203 211
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after
876 } 884 }
877 885
878 886
879 void Typer::DecorateGraph(Graph* graph) { 887 void Typer::DecorateGraph(Graph* graph) {
880 graph->AddDecorator(new (zone()) TyperDecorator(this)); 888 graph->AddDecorator(new (zone()) TyperDecorator(this));
881 } 889 }
882 890
883 } 891 }
884 } 892 }
885 } // namespace v8::internal::compiler 893 } // namespace v8::internal::compiler
OLDNEW
« no previous file with comments | « no previous file | test/cctest/cctest.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698