OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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/operation-typer.h" | 5 #include "src/compiler/operation-typer.h" |
6 | 6 |
7 #include "src/compiler/common-operator.h" | 7 #include "src/compiler/common-operator.h" |
8 #include "src/compiler/type-cache.h" | 8 #include "src/compiler/type-cache.h" |
9 #include "src/compiler/types.h" | 9 #include "src/compiler/types.h" |
10 #include "src/factory.h" | 10 #include "src/factory.h" |
11 #include "src/isolate.h" | 11 #include "src/isolate.h" |
12 | 12 |
13 #include "src/objects-inl.h" | 13 #include "src/objects-inl.h" |
14 | 14 |
15 namespace v8 { | 15 namespace v8 { |
16 namespace internal { | 16 namespace internal { |
17 namespace compiler { | 17 namespace compiler { |
18 | 18 |
19 OperationTyper::OperationTyper(Isolate* isolate, Zone* zone) | 19 OperationTyper::OperationTyper(Isolate* isolate, Zone* zone) |
20 : zone_(zone), cache_(TypeCache::Get()) { | 20 : zone_(zone), cache_(TypeCache::Get()) { |
21 Factory* factory = isolate->factory(); | 21 Factory* factory = isolate->factory(); |
22 infinity_ = Type::Constant(factory->infinity_value(), zone); | 22 infinity_ = Type::NewConstant(factory->infinity_value(), zone); |
23 minus_infinity_ = Type::Constant(factory->minus_infinity_value(), zone); | 23 minus_infinity_ = Type::NewConstant(factory->minus_infinity_value(), zone); |
24 Type* truncating_to_zero = Type::MinusZeroOrNaN(); | 24 Type* truncating_to_zero = Type::MinusZeroOrNaN(); |
25 DCHECK(!truncating_to_zero->Maybe(Type::Integral32())); | 25 DCHECK(!truncating_to_zero->Maybe(Type::Integral32())); |
26 | 26 |
27 singleton_false_ = Type::Constant(factory->false_value(), zone); | 27 singleton_false_ = Type::HeapConstant(factory->false_value(), zone); |
28 singleton_true_ = Type::Constant(factory->true_value(), zone); | 28 singleton_true_ = Type::HeapConstant(factory->true_value(), zone); |
29 singleton_the_hole_ = Type::Constant(factory->the_hole_value(), zone); | 29 singleton_the_hole_ = Type::HeapConstant(factory->the_hole_value(), zone); |
30 signed32ish_ = Type::Union(Type::Signed32(), truncating_to_zero, zone); | 30 signed32ish_ = Type::Union(Type::Signed32(), truncating_to_zero, zone); |
31 unsigned32ish_ = Type::Union(Type::Unsigned32(), truncating_to_zero, zone); | 31 unsigned32ish_ = Type::Union(Type::Unsigned32(), truncating_to_zero, zone); |
32 } | 32 } |
33 | 33 |
34 Type* OperationTyper::Merge(Type* left, Type* right) { | 34 Type* OperationTyper::Merge(Type* left, Type* right) { |
35 return Type::Union(left, right, zone()); | 35 return Type::Union(left, right, zone()); |
36 } | 36 } |
37 | 37 |
38 Type* OperationTyper::WeakenRange(Type* previous_range, Type* current_range) { | 38 Type* OperationTyper::WeakenRange(Type* previous_range, Type* current_range) { |
39 static const double kWeakenMinLimits[] = {0.0, | 39 static const double kWeakenMinLimits[] = {0.0, |
(...skipping 925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
965 return singleton_true(); | 965 return singleton_true(); |
966 } | 966 } |
967 | 967 |
968 Type* OperationTyper::TypeTypeGuard(const Operator* sigma_op, Type* input) { | 968 Type* OperationTyper::TypeTypeGuard(const Operator* sigma_op, Type* input) { |
969 return Type::Intersect(input, TypeGuardTypeOf(sigma_op), zone()); | 969 return Type::Intersect(input, TypeGuardTypeOf(sigma_op), zone()); |
970 } | 970 } |
971 | 971 |
972 } // namespace compiler | 972 } // namespace compiler |
973 } // namespace internal | 973 } // namespace internal |
974 } // namespace v8 | 974 } // namespace v8 |
OLD | NEW |