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

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

Issue 686213002: Inline trivial OperatorProperties methods. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 1 month 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 | « src/compiler/simplified-lowering.cc ('k') | src/compiler/verifier.cc » ('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/bootstrapper.h" 5 #include "src/bootstrapper.h"
6 #include "src/compiler/graph-inl.h" 6 #include "src/compiler/graph-inl.h"
7 #include "src/compiler/js-operator.h" 7 #include "src/compiler/js-operator.h"
8 #include "src/compiler/node.h" 8 #include "src/compiler/node.h"
9 #include "src/compiler/node-properties-inl.h" 9 #include "src/compiler/node-properties-inl.h"
10 #include "src/compiler/node-properties.h" 10 #include "src/compiler/node-properties.h"
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 }; 245 };
246 246
247 247
248 class Typer::RunVisitor : public Typer::Visitor { 248 class Typer::RunVisitor : public Typer::Visitor {
249 public: 249 public:
250 explicit RunVisitor(Typer* typer) 250 explicit RunVisitor(Typer* typer)
251 : Visitor(typer), 251 : Visitor(typer),
252 redo(NodeSet::key_compare(), NodeSet::allocator_type(typer->zone())) {} 252 redo(NodeSet::key_compare(), NodeSet::allocator_type(typer->zone())) {}
253 253
254 GenericGraphVisit::Control Post(Node* node) { 254 GenericGraphVisit::Control Post(Node* node) {
255 if (OperatorProperties::HasValueOutput(node->op()) && 255 if (node->op()->ValueOutputCount() > 0 && !NodeProperties::IsTyped(node)) {
256 !NodeProperties::IsTyped(node)) {
257 Bounds bounds = TypeNode(node); 256 Bounds bounds = TypeNode(node);
258 NodeProperties::SetBounds(node, bounds); 257 NodeProperties::SetBounds(node, bounds);
259 // Remember incompletely typed nodes for least fixpoint iteration. 258 // Remember incompletely typed nodes for least fixpoint iteration.
260 if (!NodeProperties::AllValueInputsAreTyped(node)) redo.insert(node); 259 if (!NodeProperties::AllValueInputsAreTyped(node)) redo.insert(node);
261 } 260 }
262 return GenericGraphVisit::CONTINUE; 261 return GenericGraphVisit::CONTINUE;
263 } 262 }
264 263
265 NodeSet redo; 264 NodeSet redo;
266 }; 265 };
267 266
268 267
269 class Typer::NarrowVisitor : public Typer::Visitor { 268 class Typer::NarrowVisitor : public Typer::Visitor {
270 public: 269 public:
271 explicit NarrowVisitor(Typer* typer) : Visitor(typer) {} 270 explicit NarrowVisitor(Typer* typer) : Visitor(typer) {}
272 271
273 GenericGraphVisit::Control Pre(Node* node) { 272 GenericGraphVisit::Control Pre(Node* node) {
274 if (OperatorProperties::HasValueOutput(node->op())) { 273 if (node->op()->ValueOutputCount() > 0) {
275 Bounds previous = NodeProperties::GetBounds(node); 274 Bounds previous = NodeProperties::GetBounds(node);
276 Bounds current = TypeNode(node); 275 Bounds current = TypeNode(node);
277 NodeProperties::SetBounds(node, Bounds::Both(current, previous, zone())); 276 NodeProperties::SetBounds(node, Bounds::Both(current, previous, zone()));
278 DCHECK(current.Narrows(previous)); 277 DCHECK(current.Narrows(previous));
279 // Stop when nothing changed (but allow re-entry in case it does later). 278 // Stop when nothing changed (but allow re-entry in case it does later).
280 return previous.Narrows(current) ? GenericGraphVisit::DEFER 279 return previous.Narrows(current) ? GenericGraphVisit::DEFER
281 : GenericGraphVisit::REENTER; 280 : GenericGraphVisit::REENTER;
282 } else { 281 } else {
283 return GenericGraphVisit::SKIP; 282 return GenericGraphVisit::SKIP;
284 } 283 }
285 } 284 }
286 285
287 GenericGraphVisit::Control Post(Node* node) { 286 GenericGraphVisit::Control Post(Node* node) {
288 return GenericGraphVisit::REENTER; 287 return GenericGraphVisit::REENTER;
289 } 288 }
290 }; 289 };
291 290
292 291
293 class Typer::WidenVisitor : public Typer::Visitor { 292 class Typer::WidenVisitor : public Typer::Visitor {
294 public: 293 public:
295 explicit WidenVisitor(Typer* typer) : Visitor(typer) {} 294 explicit WidenVisitor(Typer* typer) : Visitor(typer) {}
296 295
297 GenericGraphVisit::Control Pre(Node* node) { 296 GenericGraphVisit::Control Pre(Node* node) {
298 if (OperatorProperties::HasValueOutput(node->op())) { 297 if (node->op()->ValueOutputCount() > 0) {
299 Bounds previous = BoundsOrNone(node); 298 Bounds previous = BoundsOrNone(node);
300 Bounds current = TypeNode(node); 299 Bounds current = TypeNode(node);
301 300
302 // Speed up termination in the presence of range types: 301 // Speed up termination in the presence of range types:
303 current.upper = Weaken(current.upper, previous.upper); 302 current.upper = Weaken(current.upper, previous.upper);
304 current.lower = Weaken(current.lower, previous.lower); 303 current.lower = Weaken(current.lower, previous.lower);
305 304
306 DCHECK(previous.lower->Is(current.lower)); 305 DCHECK(previous.lower->Is(current.lower));
307 DCHECK(previous.upper->Is(current.upper)); 306 DCHECK(previous.upper->Is(current.upper));
308 307
(...skipping 24 matching lines...) Expand all
333 } 332 }
334 333
335 334
336 void Typer::Narrow(Node* start) { 335 void Typer::Narrow(Node* start) {
337 NarrowVisitor typing(this); 336 NarrowVisitor typing(this);
338 graph_->VisitNodeUsesFrom(start, &typing); 337 graph_->VisitNodeUsesFrom(start, &typing);
339 } 338 }
340 339
341 340
342 void Typer::Decorator::Decorate(Node* node) { 341 void Typer::Decorator::Decorate(Node* node) {
343 if (OperatorProperties::HasValueOutput(node->op())) { 342 if (node->op()->ValueOutputCount() > 0) {
344 // Only eagerly type-decorate nodes with known input types. 343 // Only eagerly type-decorate nodes with known input types.
345 // Other cases will generally require a proper fixpoint iteration with Run. 344 // Other cases will generally require a proper fixpoint iteration with Run.
346 bool is_typed = NodeProperties::IsTyped(node); 345 bool is_typed = NodeProperties::IsTyped(node);
347 if (is_typed || NodeProperties::AllValueInputsAreTyped(node)) { 346 if (is_typed || NodeProperties::AllValueInputsAreTyped(node)) {
348 Visitor typing(typer_); 347 Visitor typing(typer_);
349 Bounds bounds = typing.TypeNode(node); 348 Bounds bounds = typing.TypeNode(node);
350 if (is_typed) { 349 if (is_typed) {
351 bounds = 350 bounds =
352 Bounds::Both(bounds, NodeProperties::GetBounds(node), typer_->zone()); 351 Bounds::Both(bounds, NodeProperties::GetBounds(node), typer_->zone());
353 } 352 }
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 return Bounds(Type::None(zone()), Type::Internal(zone())); 533 return Bounds(Type::None(zone()), Type::Internal(zone()));
535 } 534 }
536 535
537 536
538 Bounds Typer::Visitor::TypeSelect(Node* node) { 537 Bounds Typer::Visitor::TypeSelect(Node* node) {
539 return Bounds::Either(Operand(node, 1), Operand(node, 2), zone()); 538 return Bounds::Either(Operand(node, 1), Operand(node, 2), zone());
540 } 539 }
541 540
542 541
543 Bounds Typer::Visitor::TypePhi(Node* node) { 542 Bounds Typer::Visitor::TypePhi(Node* node) {
544 int arity = OperatorProperties::GetValueInputCount(node->op()); 543 int arity = node->op()->ValueInputCount();
545 Bounds bounds = Operand(node, 0); 544 Bounds bounds = Operand(node, 0);
546 for (int i = 1; i < arity; ++i) { 545 for (int i = 1; i < arity; ++i) {
547 bounds = Bounds::Either(bounds, Operand(node, i), zone()); 546 bounds = Bounds::Either(bounds, Operand(node, i), zone());
548 } 547 }
549 return bounds; 548 return bounds;
550 } 549 }
551 550
552 551
553 Bounds Typer::Visitor::TypeEffectPhi(Node* node) { 552 Bounds Typer::Visitor::TypeEffectPhi(Node* node) {
554 UNREACHABLE(); 553 UNREACHABLE();
(...skipping 1325 matching lines...) Expand 10 before | Expand all | Expand 10 after
1880 return typer_->float64_array_fun_; 1879 return typer_->float64_array_fun_;
1881 } 1880 }
1882 } 1881 }
1883 } 1882 }
1884 return Type::Constant(value, zone()); 1883 return Type::Constant(value, zone());
1885 } 1884 }
1886 1885
1887 } 1886 }
1888 } 1887 }
1889 } // namespace v8::internal::compiler 1888 } // namespace v8::internal::compiler
OLDNEW
« no previous file with comments | « src/compiler/simplified-lowering.cc ('k') | src/compiler/verifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698