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/compiler/typer.h" | 5 #include "src/compiler/typer.h" |
6 | 6 |
7 #include "src/base/flags.h" | 7 #include "src/base/flags.h" |
8 #include "src/base/lazy-instance.h" | 8 #include "src/base/lazy-instance.h" |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
| 10 #include "src/compiler/common-operator.h" |
10 #include "src/compiler/graph-reducer.h" | 11 #include "src/compiler/graph-reducer.h" |
11 #include "src/compiler/js-operator.h" | 12 #include "src/compiler/js-operator.h" |
12 #include "src/compiler/node.h" | 13 #include "src/compiler/node.h" |
13 #include "src/compiler/node-properties.h" | 14 #include "src/compiler/node-properties.h" |
14 #include "src/compiler/simplified-operator.h" | 15 #include "src/compiler/simplified-operator.h" |
15 | 16 |
16 namespace v8 { | 17 namespace v8 { |
17 namespace internal { | 18 namespace internal { |
18 namespace compiler { | 19 namespace compiler { |
19 | 20 |
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
564 | 565 |
565 Bounds Typer::Visitor::TypeIfException(Node* node) { | 566 Bounds Typer::Visitor::TypeIfException(Node* node) { |
566 return Bounds::Unbounded(zone()); | 567 return Bounds::Unbounded(zone()); |
567 } | 568 } |
568 | 569 |
569 | 570 |
570 // Common operators. | 571 // Common operators. |
571 | 572 |
572 | 573 |
573 Bounds Typer::Visitor::TypeParameter(Node* node) { | 574 Bounds Typer::Visitor::TypeParameter(Node* node) { |
574 int param = OpParameter<int>(node); | 575 if (Type::FunctionType* function_type = typer_->function_type()) { |
575 Type::FunctionType* function_type = typer_->function_type(); | 576 int const index = ParameterIndexOf(node->op()); |
576 if (function_type != nullptr && param >= 0 && | 577 if (index >= 0 && index < function_type->Arity()) { |
577 param < static_cast<int>(function_type->Arity())) { | 578 return Bounds(Type::None(), function_type->Parameter(index)); |
578 return Bounds(Type::None(), function_type->Parameter(param)); | 579 } |
579 } | 580 } |
580 return Bounds::Unbounded(zone()); | 581 return Bounds::Unbounded(zone()); |
581 } | 582 } |
582 | 583 |
583 | 584 |
584 Bounds Typer::Visitor::TypeOsrValue(Node* node) { | 585 Bounds Typer::Visitor::TypeOsrValue(Node* node) { |
585 return Bounds::Unbounded(zone()); | 586 return Bounds::Unbounded(zone()); |
586 } | 587 } |
587 | 588 |
588 | 589 |
(...skipping 1781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2370 TYPED_ARRAYS(TYPED_ARRAY_CASE) | 2371 TYPED_ARRAYS(TYPED_ARRAY_CASE) |
2371 #undef TYPED_ARRAY_CASE | 2372 #undef TYPED_ARRAY_CASE |
2372 } | 2373 } |
2373 } | 2374 } |
2374 return Type::Constant(value, zone()); | 2375 return Type::Constant(value, zone()); |
2375 } | 2376 } |
2376 | 2377 |
2377 } // namespace compiler | 2378 } // namespace compiler |
2378 } // namespace internal | 2379 } // namespace internal |
2379 } // namespace v8 | 2380 } // namespace v8 |
OLD | NEW |