type-hint-analyzer.h 1.29 KB
Newer Older
1 2 3 4 5 6 7
// Copyright 2015 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef V8_COMPILER_TYPE_HINT_ANALYZER_H_
#define V8_COMPILER_TYPE_HINT_ANALYZER_H_

8
#include "src/compiler/type-hints.h"
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
#include "src/handles.h"
#include "src/zone-containers.h"

namespace v8 {
namespace internal {
namespace compiler {

// The result of analyzing type hints.
class TypeHintAnalysis final : public ZoneObject {
 public:
  typedef ZoneMap<TypeFeedbackId, Handle<Code>> Infos;

  explicit TypeHintAnalysis(Infos const& infos) : infos_(infos) {}

  bool GetBinaryOperationHints(TypeFeedbackId id,
                               BinaryOperationHints* hints) const;
25
  bool GetToBooleanHints(TypeFeedbackId id, ToBooleanHints* hints) const;
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51

 private:
  Infos const infos_;
};


// The class that performs type hint analysis on the fullcodegen code object.
class TypeHintAnalyzer final {
 public:
  explicit TypeHintAnalyzer(Zone* zone) : zone_(zone) {}

  TypeHintAnalysis* Analyze(Handle<Code> code);

 private:
  Zone* zone() const { return zone_; }

  Zone* const zone_;

  DISALLOW_COPY_AND_ASSIGN(TypeHintAnalyzer);
};

}  // namespace compiler
}  // namespace internal
}  // namespace v8

#endif  // V8_COMPILER_TYPE_HINT_ANALYZER_H_