OLD | NEW |
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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 | 150 |
151 Type* cache_[kNumLazyCachedTypes]; | 151 Type* cache_[kNumLazyCachedTypes]; |
152 Isolate* isolate_; | 152 Isolate* isolate_; |
153 Zone* zone_; | 153 Zone* zone_; |
154 }; | 154 }; |
155 | 155 |
156 | 156 |
157 class Typer::Decorator final : public GraphDecorator { | 157 class Typer::Decorator final : public GraphDecorator { |
158 public: | 158 public: |
159 explicit Decorator(Typer* typer) : typer_(typer) {} | 159 explicit Decorator(Typer* typer) : typer_(typer) {} |
160 void Decorate(Node* node, bool incomplete) final; | 160 void Decorate(Node* node) final; |
161 | 161 |
162 private: | 162 private: |
163 Typer* typer_; | 163 Typer* typer_; |
164 }; | 164 }; |
165 | 165 |
166 | 166 |
167 Typer::Typer(Isolate* isolate, Graph* graph, MaybeHandle<Context> context) | 167 Typer::Typer(Isolate* isolate, Graph* graph, MaybeHandle<Context> context) |
168 : isolate_(isolate), | 168 : isolate_(isolate), |
169 graph_(graph), | 169 graph_(graph), |
170 context_(context), | 170 context_(context), |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 } | 451 } |
452 } | 452 } |
453 | 453 |
454 Visitor visitor(this); | 454 Visitor visitor(this); |
455 GraphReducer graph_reducer(zone(), graph()); | 455 GraphReducer graph_reducer(zone(), graph()); |
456 graph_reducer.AddReducer(&visitor); | 456 graph_reducer.AddReducer(&visitor); |
457 graph_reducer.ReduceGraph(); | 457 graph_reducer.ReduceGraph(); |
458 } | 458 } |
459 | 459 |
460 | 460 |
461 void Typer::Decorator::Decorate(Node* node, bool incomplete) { | 461 void Typer::Decorator::Decorate(Node* node) { |
462 if (incomplete) return; | |
463 if (node->op()->ValueOutputCount() > 0) { | 462 if (node->op()->ValueOutputCount() > 0) { |
464 // Only eagerly type-decorate nodes with known input types. | 463 // Only eagerly type-decorate nodes with known input types. |
465 // Other cases will generally require a proper fixpoint iteration with Run. | 464 // Other cases will generally require a proper fixpoint iteration with Run. |
466 bool is_typed = NodeProperties::IsTyped(node); | 465 bool is_typed = NodeProperties::IsTyped(node); |
467 if (is_typed || NodeProperties::AllValueInputsAreTyped(node)) { | 466 if (is_typed || NodeProperties::AllValueInputsAreTyped(node)) { |
468 Visitor typing(typer_); | 467 Visitor typing(typer_); |
469 Bounds bounds = typing.TypeNode(node); | 468 Bounds bounds = typing.TypeNode(node); |
470 if (is_typed) { | 469 if (is_typed) { |
471 bounds = | 470 bounds = |
472 Bounds::Both(bounds, NodeProperties::GetBounds(node), typer_->zone()); | 471 Bounds::Both(bounds, NodeProperties::GetBounds(node), typer_->zone()); |
(...skipping 1963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2436 TYPED_ARRAYS(TYPED_ARRAY_CASE) | 2435 TYPED_ARRAYS(TYPED_ARRAY_CASE) |
2437 #undef TYPED_ARRAY_CASE | 2436 #undef TYPED_ARRAY_CASE |
2438 } | 2437 } |
2439 } | 2438 } |
2440 return Type::Constant(value, zone()); | 2439 return Type::Constant(value, zone()); |
2441 } | 2440 } |
2442 | 2441 |
2443 } // namespace compiler | 2442 } // namespace compiler |
2444 } // namespace internal | 2443 } // namespace internal |
2445 } // namespace v8 | 2444 } // namespace v8 |
OLD | NEW |