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