• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/handles.h"
9 #include "src/type-hints.h"
10 #include "src/zone/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,Zone * zone)21   explicit TypeHintAnalysis(Infos const& infos, Zone* zone)
22       : infos_(infos), zone_(zone) {}
23 
24   bool GetBinaryOperationHint(TypeFeedbackId id,
25                               BinaryOperationHint* hint) const;
26   bool GetCompareOperationHint(TypeFeedbackId id,
27                                CompareOperationHint* hint) const;
28   bool GetToBooleanHints(TypeFeedbackId id, ToBooleanHints* hints) const;
29 
30  private:
zone()31   Zone* zone() const { return zone_; }
32 
33   Infos const infos_;
34   Zone* zone_;
35 };
36 
37 
38 // The class that performs type hint analysis on the fullcodegen code object.
39 class TypeHintAnalyzer final {
40  public:
TypeHintAnalyzer(Zone * zone)41   explicit TypeHintAnalyzer(Zone* zone) : zone_(zone) {}
42 
43   TypeHintAnalysis* Analyze(Handle<Code> code);
44 
45  private:
zone()46   Zone* zone() const { return zone_; }
47 
48   Zone* const zone_;
49 
50   DISALLOW_COPY_AND_ASSIGN(TypeHintAnalyzer);
51 };
52 
53 }  // namespace compiler
54 }  // namespace internal
55 }  // namespace v8
56 
57 #endif  // V8_COMPILER_TYPE_HINT_ANALYZER_H_
58