11cb0ef41Sopenharmony_ci// Copyright 2019 the V8 project authors. All rights reserved.
21cb0ef41Sopenharmony_ci// Use of this source code is governed by a BSD-style license that can be
31cb0ef41Sopenharmony_ci// found in the LICENSE file.
41cb0ef41Sopenharmony_ci
51cb0ef41Sopenharmony_ci#ifndef V8_REGEXP_REGEXP_BYTECODE_PEEPHOLE_H_
61cb0ef41Sopenharmony_ci#define V8_REGEXP_REGEXP_BYTECODE_PEEPHOLE_H_
71cb0ef41Sopenharmony_ci
81cb0ef41Sopenharmony_ci#include "src/common/globals.h"
91cb0ef41Sopenharmony_ci#include "src/zone/zone-containers.h"
101cb0ef41Sopenharmony_ci
111cb0ef41Sopenharmony_cinamespace v8 {
121cb0ef41Sopenharmony_cinamespace internal {
131cb0ef41Sopenharmony_ci
141cb0ef41Sopenharmony_ciclass ByteArray;
151cb0ef41Sopenharmony_ci
161cb0ef41Sopenharmony_ci// Peephole optimization for regexp interpreter bytecode.
171cb0ef41Sopenharmony_ci// Pre-defined bytecode sequences occuring in the bytecode generated by the
181cb0ef41Sopenharmony_ci// RegExpBytecodeGenerator can be optimized into a single bytecode.
191cb0ef41Sopenharmony_ciclass RegExpBytecodePeepholeOptimization : public AllStatic {
201cb0ef41Sopenharmony_ci public:
211cb0ef41Sopenharmony_ci  // Performs peephole optimization on the given bytecode and returns the
221cb0ef41Sopenharmony_ci  // optimized bytecode.
231cb0ef41Sopenharmony_ci  static Handle<ByteArray> OptimizeBytecode(
241cb0ef41Sopenharmony_ci      Isolate* isolate, Zone* zone, Handle<String> source, const byte* bytecode,
251cb0ef41Sopenharmony_ci      int length, const ZoneUnorderedMap<int, int>& jump_edges);
261cb0ef41Sopenharmony_ci};
271cb0ef41Sopenharmony_ci
281cb0ef41Sopenharmony_ci}  // namespace internal
291cb0ef41Sopenharmony_ci}  // namespace v8
301cb0ef41Sopenharmony_ci
311cb0ef41Sopenharmony_ci#endif  // V8_REGEXP_REGEXP_BYTECODE_PEEPHOLE_H_
32