1// Copyright 2017 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_FIND_AND_REPLACE_PATTERN_H_ 6#define V8_FIND_AND_REPLACE_PATTERN_H_ 7 8#include "src/handles.h" 9 10namespace v8 { 11namespace internal { 12 13class Map; 14class Object; 15 16class FindAndReplacePattern { 17 public: 18 FindAndReplacePattern() : count_(0) {} 19 void Add(Handle<Map> map_to_find, Handle<Object> obj_to_replace) { 20 DCHECK(count_ < kMaxCount); 21 find_[count_] = map_to_find; 22 replace_[count_] = obj_to_replace; 23 ++count_; 24 } 25 26 private: 27 static const int kMaxCount = 4; 28 int count_; 29 Handle<Map> find_[kMaxCount]; 30 Handle<Object> replace_[kMaxCount]; 31 friend class Code; 32}; 33 34} // namespace internal 35} // namespace v8 36 37#endif // V8_FIND_AND_REPLACE_PATTERN_H_ 38