summaryrefslogtreecommitdiff
path: root/deps/v8/src/find-and-replace-pattern.h
blob: 845ee0f7829e5d5f20f789ab11e48fc7b691c3dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright 2017 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_FIND_AND_REPLACE_PATTERN_H_
#define V8_FIND_AND_REPLACE_PATTERN_H_

#include "src/handles.h"

namespace v8 {
namespace internal {

class Map;
class Object;

class FindAndReplacePattern {
 public:
  FindAndReplacePattern() : count_(0) {}
  void Add(Handle<Map> map_to_find, Handle<Object> obj_to_replace) {
    DCHECK(count_ < kMaxCount);
    find_[count_] = map_to_find;
    replace_[count_] = obj_to_replace;
    ++count_;
  }

 private:
  static const int kMaxCount = 4;
  int count_;
  Handle<Map> find_[kMaxCount];
  Handle<Object> replace_[kMaxCount];
  friend class Code;
};

}  // namespace internal
}  // namespace v8

#endif  // V8_FIND_AND_REPLACE_PATTERN_H_