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/graph-reducer.h" | 10 #include "src/compiler/graph-reducer.h" |
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
575 Type::FunctionType* function_type = typer_->function_type(); | 575 Type::FunctionType* function_type = typer_->function_type(); |
576 if (function_type != nullptr && param >= 0 && | 576 if (function_type != nullptr && param >= 0 && |
577 param < static_cast<int>(function_type->Arity())) { | 577 param < static_cast<int>(function_type->Arity())) { |
578 return Bounds(Type::None(), function_type->Parameter(param)); | 578 return Bounds(Type::None(), function_type->Parameter(param)); |
579 } | 579 } |
580 return Bounds::Unbounded(zone()); | 580 return Bounds::Unbounded(zone()); |
581 } | 581 } |
582 | 582 |
583 | 583 |
584 Bounds Typer::Visitor::TypeOsrValue(Node* node) { | 584 Bounds Typer::Visitor::TypeOsrValue(Node* node) { |
585 if (node->InputAt(0)->opcode() == IrOpcode::kOsrLoopEntry) { | |
586 // Before deconstruction, OSR values have type {None} to avoid polluting | |
587 // the types of phis and other nodes in the graph. | |
588 return Bounds(Type::None(), Type::None()); | |
589 } | |
590 if (NodeProperties::IsTyped(node)) { | |
591 // After deconstruction, OSR values may have had a type explicitly set. | |
592 return NodeProperties::GetBounds(node); | |
593 } | |
594 // Otherwise, be conservative. | |
595 return Bounds::Unbounded(zone()); | 585 return Bounds::Unbounded(zone()); |
596 } | 586 } |
597 | 587 |
598 | 588 |
599 Bounds Typer::Visitor::TypeInt32Constant(Node* node) { | 589 Bounds Typer::Visitor::TypeInt32Constant(Node* node) { |
600 double number = OpParameter<int32_t>(node); | 590 double number = OpParameter<int32_t>(node); |
601 return Bounds(Type::Intersect( | 591 return Bounds(Type::Intersect( |
602 Type::Range(number, number, zone()), Type::UntaggedSigned32(), zone())); | 592 Type::Range(number, number, zone()), Type::UntaggedSigned32(), zone())); |
603 } | 593 } |
604 | 594 |
(...skipping 1775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2380 TYPED_ARRAYS(TYPED_ARRAY_CASE) | 2370 TYPED_ARRAYS(TYPED_ARRAY_CASE) |
2381 #undef TYPED_ARRAY_CASE | 2371 #undef TYPED_ARRAY_CASE |
2382 } | 2372 } |
2383 } | 2373 } |
2384 return Type::Constant(value, zone()); | 2374 return Type::Constant(value, zone()); |
2385 } | 2375 } |
2386 | 2376 |
2387 } // namespace compiler | 2377 } // namespace compiler |
2388 } // namespace internal | 2378 } // namespace internal |
2389 } // namespace v8 | 2379 } // namespace v8 |
OLD | NEW |