1// Copyright 2014 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_TYPE_FEEDBACK_VECTOR_H_
6#define V8_TYPE_FEEDBACK_VECTOR_H_
7
8#include "src/checks.h"
9#include "src/elements-kind.h"
10#include "src/heap/heap.h"
11#include "src/isolate.h"
12#include "src/objects.h"
13
14namespace v8 {
15namespace internal {
16
17class TypeFeedbackVector : public FixedArray {
18 public:
19  // Casting.
20  static TypeFeedbackVector* cast(Object* obj) {
21    DCHECK(obj->IsTypeFeedbackVector());
22    return reinterpret_cast<TypeFeedbackVector*>(obj);
23  }
24
25  static Handle<TypeFeedbackVector> Copy(Isolate* isolate,
26                                         Handle<TypeFeedbackVector> vector);
27
28  // The object that indicates an uninitialized cache.
29  static inline Handle<Object> UninitializedSentinel(Isolate* isolate);
30
31  // The object that indicates a megamorphic state.
32  static inline Handle<Object> MegamorphicSentinel(Isolate* isolate);
33
34  // The object that indicates a premonomorphic state.
35  static inline Handle<Object> PremonomorphicSentinel(Isolate* isolate);
36
37  // The object that indicates a generic state.
38  static inline Handle<Object> GenericSentinel(Isolate* isolate);
39
40  // The object that indicates a monomorphic state of Array with
41  // ElementsKind
42  static inline Handle<Object> MonomorphicArraySentinel(
43      Isolate* isolate, ElementsKind elements_kind);
44
45  // A raw version of the uninitialized sentinel that's safe to read during
46  // garbage collection (e.g., for patching the cache).
47  static inline Object* RawUninitializedSentinel(Heap* heap);
48
49 private:
50  DISALLOW_IMPLICIT_CONSTRUCTORS(TypeFeedbackVector);
51};
52}
53}  // namespace v8::internal
54
55#endif  // V8_TRANSITIONS_H_
56