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

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

Issue 1192553002: [turbofan] Fix life time and use of the Typer. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address Michis comments. Created 5 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
« no previous file with comments | « src/compiler/typer.h ('k') | no next file » | 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/base/flags.h" 5 #include "src/base/flags.h"
6 #include "src/bootstrapper.h" 6 #include "src/bootstrapper.h"
7 #include "src/compiler/graph-reducer.h" 7 #include "src/compiler/graph-reducer.h"
8 #include "src/compiler/js-operator.h" 8 #include "src/compiler/js-operator.h"
9 #include "src/compiler/node.h" 9 #include "src/compiler/node.h"
10 #include "src/compiler/node-properties.h" 10 #include "src/compiler/node-properties.h"
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 return NoChange(); 422 return NoChange();
423 } else { 423 } else {
424 // No previous type, simply update the bounds. 424 // No previous type, simply update the bounds.
425 NodeProperties::SetBounds(node, current); 425 NodeProperties::SetBounds(node, current);
426 return Changed(node); 426 return Changed(node);
427 } 427 }
428 } 428 }
429 }; 429 };
430 430
431 431
432 void Typer::Run() { 432 void Typer::Run() { Run(NodeVector(zone())); }
433 {
434 // TODO(titzer): this is a hack. Reset types for interior nodes first.
435 NodeDeque deque(zone());
436 NodeMarker<bool> marked(graph(), 2);
437 deque.push_front(graph()->end());
438 marked.Set(graph()->end(), true);
439 while (!deque.empty()) {
440 Node* node = deque.front();
441 deque.pop_front();
442 // TODO(titzer): there shouldn't be a need to retype constants.
443 if (node->op()->ValueOutputCount() > 0)
444 NodeProperties::RemoveBounds(node);
445 for (Node* input : node->inputs()) {
446 if (!marked.Get(input)) {
447 marked.Set(input, true);
448 deque.push_back(input);
449 }
450 }
451 }
452 }
453 433
434
435 void Typer::Run(const NodeVector& roots) {
454 Visitor visitor(this); 436 Visitor visitor(this);
455 GraphReducer graph_reducer(zone(), graph()); 437 GraphReducer graph_reducer(zone(), graph());
456 graph_reducer.AddReducer(&visitor); 438 graph_reducer.AddReducer(&visitor);
439 for (Node* const root : roots) graph_reducer.ReduceNode(root);
457 graph_reducer.ReduceGraph(); 440 graph_reducer.ReduceGraph();
458 } 441 }
459 442
460 443
461 void Typer::Decorator::Decorate(Node* node, bool incomplete) { 444 void Typer::Decorator::Decorate(Node* node, bool incomplete) {
462 if (incomplete) return; 445 if (incomplete) return;
463 if (node->op()->ValueOutputCount() > 0) { 446 if (node->op()->ValueOutputCount() > 0) {
464 // Only eagerly type-decorate nodes with known input types. 447 // Only eagerly type-decorate nodes with known input types.
465 // Other cases will generally require a proper fixpoint iteration with Run. 448 // Other cases will generally require a proper fixpoint iteration with Run.
466 bool is_typed = NodeProperties::IsTyped(node); 449 bool is_typed = NodeProperties::IsTyped(node);
(...skipping 1969 matching lines...) Expand 10 before | Expand all | Expand 10 after
2436 TYPED_ARRAYS(TYPED_ARRAY_CASE) 2419 TYPED_ARRAYS(TYPED_ARRAY_CASE)
2437 #undef TYPED_ARRAY_CASE 2420 #undef TYPED_ARRAY_CASE
2438 } 2421 }
2439 } 2422 }
2440 return Type::Constant(value, zone()); 2423 return Type::Constant(value, zone());
2441 } 2424 }
2442 2425
2443 } // namespace compiler 2426 } // namespace compiler
2444 } // namespace internal 2427 } // namespace internal
2445 } // namespace v8 2428 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/typer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698