| 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 ToHint(Type* type) { | 19 BinaryOperationHints::Hint ToHint(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::kNumber; | 23 if (type->Is(Type::Number())) return BinaryOperationHints::kNumberOrUndefined; |
| 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 } // namespace | 28 } // namespace |
| 29 | 29 |
| 30 | 30 |
| 31 bool TypeHintAnalysis::GetBinaryOperationHints( | 31 bool TypeHintAnalysis::GetBinaryOperationHints( |
| 32 TypeFeedbackId id, BinaryOperationHints* hints) const { | 32 TypeFeedbackId id, BinaryOperationHints* hints) const { |
| 33 auto i = infos_.find(id); | 33 auto i = infos_.find(id); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 // Ignore the remaining code objects. | 89 // Ignore the remaining code objects. |
| 90 break; | 90 break; |
| 91 } | 91 } |
| 92 } | 92 } |
| 93 return new (zone()) TypeHintAnalysis(infos); | 93 return new (zone()) TypeHintAnalysis(infos); |
| 94 } | 94 } |
| 95 | 95 |
| 96 } // namespace compiler | 96 } // namespace compiler |
| 97 } // namespace internal | 97 } // namespace internal |
| 98 } // namespace v8 | 98 } // namespace v8 |
| OLD | NEW |