blob: bfb62327d58b94bed181fac48eebd4158d4cc8d0 [file] [log] [blame]
Ben Murdoch4a90d5f2016-03-22 12:00:34 +00001// 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
12namespace v8 {
13namespace internal {
14namespace compiler {
15
16// The result of analyzing type hints.
17class TypeHintAnalysis final : public ZoneObject {
18 public:
19 typedef ZoneMap<TypeFeedbackId, Handle<Code>> Infos;
20
Ben Murdoch61f157c2016-09-16 13:49:30 +010021 explicit TypeHintAnalysis(Infos const& infos, Zone* zone)
22 : infos_(infos), zone_(zone) {}
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000023
24 bool GetBinaryOperationHints(TypeFeedbackId id,
25 BinaryOperationHints* hints) const;
Ben Murdoch61f157c2016-09-16 13:49:30 +010026 bool GetCompareOperationHints(TypeFeedbackId id,
27 CompareOperationHints* hints) const;
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000028 bool GetToBooleanHints(TypeFeedbackId id, ToBooleanHints* hints) const;
29
30 private:
Ben Murdoch61f157c2016-09-16 13:49:30 +010031 Zone* zone() const { return zone_; }
32
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000033 Infos const infos_;
Ben Murdoch61f157c2016-09-16 13:49:30 +010034 Zone* zone_;
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000035};
36
37
38// The class that performs type hint analysis on the fullcodegen code object.
39class TypeHintAnalyzer final {
40 public:
41 explicit TypeHintAnalyzer(Zone* zone) : zone_(zone) {}
42
43 TypeHintAnalysis* Analyze(Handle<Code> code);
44
45 private:
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_