| 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/type-hint-analyzer.h" | 5 #include "src/compiler/type-hint-analyzer.h" |
| 6 | 6 |
| 7 #include "src/assembler.h" | 7 #include "src/assembler.h" |
| 8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
| 9 #include "src/compiler/type-hints.h" | 9 #include "src/compiler/type-hints.h" |
| 10 #include "src/ic/ic-state.h" | 10 #include "src/ic/ic-state.h" |
| 11 | 11 |
| 12 namespace v8 { | 12 namespace v8 { |
| 13 namespace internal { | 13 namespace internal { |
| 14 namespace compiler { | 14 namespace compiler { |
| 15 | 15 |
| 16 namespace { | 16 namespace { |
| 17 | 17 |
| 18 // TODO(bmeurer): This detour via types is ugly. | 18 // TODO(bmeurer): This detour via types is ugly. |
| 19 BinaryOperationHints::Hint ToBinaryOperationHint(Type* type) { | 19 BinaryOperationHints::Hint ToBinaryOperationHint(Type* type) { |
| 20 if (type->Is(Type::None())) return BinaryOperationHints::kNone; | 20 if (type->Is(Type::None())) return BinaryOperationHints::kNone; |
| 21 if (type->Is(Type::SignedSmall())) return BinaryOperationHints::kSignedSmall; | 21 if (type->Is(Type::SignedSmall())) return BinaryOperationHints::kSignedSmall; |
| 22 if (type->Is(Type::Signed32())) return BinaryOperationHints::kSigned32; | 22 if (type->Is(Type::Signed32())) return BinaryOperationHints::kSigned32; |
| 23 if (type->Is(Type::Number())) return BinaryOperationHints::kNumberOrUndefined; | 23 if (type->Is(Type::Number())) return BinaryOperationHints::kNumberOrOddball; |
| 24 if (type->Is(Type::String())) return BinaryOperationHints::kString; | 24 if (type->Is(Type::String())) return BinaryOperationHints::kString; |
| 25 return BinaryOperationHints::kAny; | 25 return BinaryOperationHints::kAny; |
| 26 } | 26 } |
| 27 | 27 |
| 28 CompareOperationHints::Hint ToCompareOperationHint( | 28 CompareOperationHints::Hint ToCompareOperationHint( |
| 29 CompareICState::State state) { | 29 CompareICState::State state) { |
| 30 switch (state) { | 30 switch (state) { |
| 31 case CompareICState::UNINITIALIZED: | 31 case CompareICState::UNINITIALIZED: |
| 32 return CompareOperationHints::kNone; | 32 return CompareOperationHints::kNone; |
| 33 case CompareICState::BOOLEAN: | 33 case CompareICState::BOOLEAN: |
| 34 return CompareOperationHints::kBoolean; | 34 return CompareOperationHints::kBoolean; |
| 35 case CompareICState::SMI: | 35 case CompareICState::SMI: |
| 36 return CompareOperationHints::kSignedSmall; | 36 return CompareOperationHints::kSignedSmall; |
| 37 case CompareICState::NUMBER: | 37 case CompareICState::NUMBER: |
| 38 return CompareOperationHints::kNumber; | 38 return CompareOperationHints::kNumberOrOddball; |
| 39 case CompareICState::STRING: | 39 case CompareICState::STRING: |
| 40 return CompareOperationHints::kString; | 40 return CompareOperationHints::kString; |
| 41 case CompareICState::INTERNALIZED_STRING: | 41 case CompareICState::INTERNALIZED_STRING: |
| 42 return CompareOperationHints::kInternalizedString; | 42 return CompareOperationHints::kInternalizedString; |
| 43 case CompareICState::UNIQUE_NAME: | 43 case CompareICState::UNIQUE_NAME: |
| 44 return CompareOperationHints::kUniqueName; | 44 return CompareOperationHints::kUniqueName; |
| 45 case CompareICState::RECEIVER: | 45 case CompareICState::RECEIVER: |
| 46 case CompareICState::KNOWN_RECEIVER: | 46 case CompareICState::KNOWN_RECEIVER: |
| 47 return CompareOperationHints::kReceiver; | 47 return CompareOperationHints::kReceiver; |
| 48 case CompareICState::GENERIC: | 48 case CompareICState::GENERIC: |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 // Ignore the remaining code objects. | 132 // Ignore the remaining code objects. |
| 133 break; | 133 break; |
| 134 } | 134 } |
| 135 } | 135 } |
| 136 return new (zone()) TypeHintAnalysis(infos, zone()); | 136 return new (zone()) TypeHintAnalysis(infos, zone()); |
| 137 } | 137 } |
| 138 | 138 |
| 139 } // namespace compiler | 139 } // namespace compiler |
| 140 } // namespace internal | 140 } // namespace internal |
| 141 } // namespace v8 | 141 } // namespace v8 |
| OLD | NEW |