summaryrefslogtreecommitdiff
path: root/deps/v8/src/regexp/regexp-bytecode-peephole.h
blob: f116e1ac4184f6c2a8cf8502cad8042a8a7e9942 (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
// Copyright 2019 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_REGEXP_REGEXP_BYTECODE_PEEPHOLE_H_
#define V8_REGEXP_REGEXP_BYTECODE_PEEPHOLE_H_

#include "src/common/globals.h"
#include "src/zone/zone-containers.h"

namespace v8 {
namespace internal {

class ByteArray;

// Peephole optimization for regexp interpreter bytecode.
// Pre-defined bytecode sequences occuring in the bytecode generated by the
// RegExpBytecodeGenerator can be optimized into a single bytecode.
class RegExpBytecodePeepholeOptimization : public AllStatic {
 public:
  // Performs peephole optimization on the given bytecode and returns the
  // optimized bytecode.
  static Handle<ByteArray> OptimizeBytecode(
      Isolate* isolate, Zone* zone, Handle<String> source, const byte* bytecode,
      int length, const ZoneUnorderedMap<int, int>& jump_edges);
};

}  // namespace internal
}  // namespace v8

#endif  // V8_REGEXP_REGEXP_BYTECODE_PEEPHOLE_H_