Index: src/compiler/type-hint-analyzer.cc |
diff --git a/src/compiler/type-hint-analyzer.cc b/src/compiler/type-hint-analyzer.cc |
index e3cafb4112deb29f7d0fd586c4c164ab9e76a41a..2c30e84fd2c1744dc88275cc41ab206e59fcbb8c 100644 |
--- a/src/compiler/type-hint-analyzer.cc |
+++ b/src/compiler/type-hint-analyzer.cc |
@@ -136,6 +136,23 @@ TypeHintAnalysis* TypeHintAnalyzer::Analyze(Handle<Code> code) { |
return new (zone()) TypeHintAnalysis(infos, zone()); |
} |
+// Helper function to transform the feedback to BinaryOperationHints |
+// The encoded type is in the lower three bits as follows: |
+// 1XX - Any Type |
+// 01X - Number Type |
+// 001 - Smi Type |
+BinaryOperationHints::Hint BinaryOperationHintFromFeedback(int type_feedback) { |
+ BinaryOperationHints::Hint hint = BinaryOperationHints::kAny; |
+ if (BinaryOpTypeFeedback::AnyType::decode(type_feedback)) { |
+ hint = BinaryOperationHints::kAny; |
+ } else if (BinaryOpTypeFeedback::NumberType::decode(type_feedback)) { |
+ hint = BinaryOperationHints::kNumberOrOddball; |
+ } else if (BinaryOpTypeFeedback::SmiType::decode(type_feedback)) { |
+ hint = BinaryOperationHints::kSigned32; |
+ } |
+ return hint; |
+} |
+ |
} // namespace compiler |
} // namespace internal |
} // namespace v8 |