OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/representation-change.h" | 5 #include "src/compiler/representation-change.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 Truncation::TruncationKind Truncation::Generalize(TruncationKind rep1, | 57 Truncation::TruncationKind Truncation::Generalize(TruncationKind rep1, |
58 TruncationKind rep2) { | 58 TruncationKind rep2) { |
59 if (LessGeneral(rep1, rep2)) return rep2; | 59 if (LessGeneral(rep1, rep2)) return rep2; |
60 if (LessGeneral(rep2, rep1)) return rep1; | 60 if (LessGeneral(rep2, rep1)) return rep1; |
61 // Handle the generalization of float64-representable values. | 61 // Handle the generalization of float64-representable values. |
62 if (LessGeneral(rep1, TruncationKind::kFloat64) && | 62 if (LessGeneral(rep1, TruncationKind::kFloat64) && |
63 LessGeneral(rep2, TruncationKind::kFloat64)) { | 63 LessGeneral(rep2, TruncationKind::kFloat64)) { |
64 return TruncationKind::kFloat64; | 64 return TruncationKind::kFloat64; |
65 } | 65 } |
66 // All other combinations are illegal. | 66 // All other combinations are illegal. |
67 FATAL("Tried to combine incompatible representations"); | 67 FATAL("Tried to combine incompatible truncations"); |
68 return TruncationKind::kNone; | 68 return TruncationKind::kNone; |
69 } | 69 } |
70 | 70 |
71 | 71 |
72 // static | 72 // static |
73 bool Truncation::LessGeneral(TruncationKind rep1, TruncationKind rep2) { | 73 bool Truncation::LessGeneral(TruncationKind rep1, TruncationKind rep2) { |
74 switch (rep1) { | 74 switch (rep1) { |
75 case TruncationKind::kNone: | 75 case TruncationKind::kNone: |
76 return true; | 76 return true; |
77 case TruncationKind::kBool: | 77 case TruncationKind::kBool: |
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 | 528 |
529 | 529 |
530 Node* RepresentationChanger::InsertChangeTaggedToFloat64(Node* node) { | 530 Node* RepresentationChanger::InsertChangeTaggedToFloat64(Node* node) { |
531 return jsgraph()->graph()->NewNode(simplified()->ChangeTaggedToFloat64(), | 531 return jsgraph()->graph()->NewNode(simplified()->ChangeTaggedToFloat64(), |
532 node); | 532 node); |
533 } | 533 } |
534 | 534 |
535 } // namespace compiler | 535 } // namespace compiler |
536 } // namespace internal | 536 } // namespace internal |
537 } // namespace v8 | 537 } // namespace v8 |
OLD | NEW |