1// Copyright 2019 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_REGEXP_REGEXP_BYTECODE_PEEPHOLE_H_ 6#define V8_REGEXP_REGEXP_BYTECODE_PEEPHOLE_H_ 7 8#include "src/common/globals.h" 9#include "src/zone/zone-containers.h" 10 11namespace v8 { 12namespace internal { 13 14class ByteArray; 15 16// Peephole optimization for regexp interpreter bytecode. 17// Pre-defined bytecode sequences occuring in the bytecode generated by the 18// RegExpBytecodeGenerator can be optimized into a single bytecode. 19class RegExpBytecodePeepholeOptimization : public AllStatic { 20 public: 21 // Performs peephole optimization on the given bytecode and returns the 22 // optimized bytecode. 23 static Handle<ByteArray> OptimizeBytecode( 24 Isolate* isolate, Zone* zone, Handle<String> source, const byte* bytecode, 25 int length, const ZoneUnorderedMap<int, int>& jump_edges); 26}; 27 28} // namespace internal 29} // namespace v8 30 31#endif // V8_REGEXP_REGEXP_BYTECODE_PEEPHOLE_H_ 32