| // 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. |
| #include "src/regexp/regexp-bytecodes.h" |
| #include "src/utils/utils.h" |
| void RegExpBytecodeDisassembleSingle(const byte* code_base, const byte* pc) { |
| PrintF("%s", RegExpBytecodeName(*pc)); |
| // Args and the bytecode as hex. |
| for (int i = 0; i < RegExpBytecodeLength(*pc); i++) { |
| for (int i = 1; i < RegExpBytecodeLength(*pc); i++) { |
| PrintF("%c", std::isprint(b) ? b : '.'); |
| void RegExpBytecodeDisassemble(const byte* code_base, int length, |
| PrintF("[generated bytecode for regexp pattern: '%s']\n", pattern); |
| while (offset < length) { |
| const byte* const pc = code_base + offset; |
| PrintF("%p %4" V8PRIxPTRDIFF " ", pc, offset); |
| RegExpBytecodeDisassembleSingle(code_base, pc); |
| offset += RegExpBytecodeLength(*pc); |