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 3 // found in the LICENSE file. 4 5 #ifndef V8_COMPILER_TYPE_HINT_ANALYZER_H_ 6 #define V8_COMPILER_TYPE_HINT_ANALYZER_H_ 7 8 #include "src/compiler/type-hints.h" 9 #include "src/handles.h" 10 #include "src/zone-containers.h" 11 12 namespace v8 { 13 namespace internal { 14 namespace compiler { 15 16 // The result of analyzing type hints. 17 class TypeHintAnalysis final : public ZoneObject { 18 public: 19 typedef ZoneMap<TypeFeedbackId, Handle<Code>> Infos; 20 TypeHintAnalysis(Infos const & infos)21 explicit TypeHintAnalysis(Infos const& infos) : infos_(infos) {} 22 23 bool GetBinaryOperationHints(TypeFeedbackId id, 24 BinaryOperationHints* hints) const; 25 bool GetToBooleanHints(TypeFeedbackId id, ToBooleanHints* hints) const; 26 27 private: 28 Infos const infos_; 29 }; 30 31 32 // The class that performs type hint analysis on the fullcodegen code object. 33 class TypeHintAnalyzer final { 34 public: TypeHintAnalyzer(Zone * zone)35 explicit TypeHintAnalyzer(Zone* zone) : zone_(zone) {} 36 37 TypeHintAnalysis* Analyze(Handle<Code> code); 38 39 private: zone()40 Zone* zone() const { return zone_; } 41 42 Zone* const zone_; 43 44 DISALLOW_COPY_AND_ASSIGN(TypeHintAnalyzer); 45 }; 46 47 } // namespace compiler 48 } // namespace internal 49 } // namespace v8 50 51 #endif // V8_COMPILER_TYPE_HINT_ANALYZER_H_ 52