Commit 89ad50be authored by Jakob Gruber's avatar Jakob Gruber Committed by Commit Bot

[regexp] Rename interpreter files

bytecodes-irregexp.h -> regexp-bytecodes.h
interpreter-irregexp.{cc,h} -> regexp-interpreter.{cc,h}

Change-Id: I98ca9d5c3264ad0adbd280b93082aa3e01b45b67
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1655294
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Auto-Submit: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: 's avatarPeter Marshall <petermarshall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62113}
parent 4c0bf17e
...@@ -2670,9 +2670,6 @@ v8_source_set("v8_base_without_compiler") { ...@@ -2670,9 +2670,6 @@ v8_source_set("v8_base_without_compiler") {
"src/profiler/tick-sample.h", "src/profiler/tick-sample.h",
"src/profiler/tracing-cpu-profiler.cc", "src/profiler/tracing-cpu-profiler.cc",
"src/profiler/tracing-cpu-profiler.h", "src/profiler/tracing-cpu-profiler.h",
"src/regexp/bytecodes-irregexp.h",
"src/regexp/interpreter-irregexp.cc",
"src/regexp/interpreter-irregexp.h",
"src/regexp/jsregexp-inl.h", "src/regexp/jsregexp-inl.h",
"src/regexp/jsregexp.cc", "src/regexp/jsregexp.cc",
"src/regexp/jsregexp.h", "src/regexp/jsregexp.h",
...@@ -2680,6 +2677,9 @@ v8_source_set("v8_base_without_compiler") { ...@@ -2680,6 +2677,9 @@ v8_source_set("v8_base_without_compiler") {
"src/regexp/property-sequences.h", "src/regexp/property-sequences.h",
"src/regexp/regexp-ast.cc", "src/regexp/regexp-ast.cc",
"src/regexp/regexp-ast.h", "src/regexp/regexp-ast.h",
"src/regexp/regexp-bytecodes.h",
"src/regexp/regexp-interpreter.cc",
"src/regexp/regexp-interpreter.h",
"src/regexp/regexp-macro-assembler-irregexp-inl.h", "src/regexp/regexp-macro-assembler-irregexp-inl.h",
"src/regexp/regexp-macro-assembler-irregexp.cc", "src/regexp/regexp-macro-assembler-irregexp.cc",
"src/regexp/regexp-macro-assembler-irregexp.h", "src/regexp/regexp-macro-assembler-irregexp.h",
......
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
#include "src/heap/factory.h" #include "src/heap/factory.h"
#include "src/heap/heap-inl.h" #include "src/heap/heap-inl.h"
#include "src/objects/elements.h" #include "src/objects/elements.h"
#include "src/regexp/interpreter-irregexp.h"
#include "src/regexp/jsregexp-inl.h" #include "src/regexp/jsregexp-inl.h"
#include "src/regexp/regexp-interpreter.h"
#include "src/regexp/regexp-macro-assembler-irregexp.h" #include "src/regexp/regexp-macro-assembler-irregexp.h"
#include "src/regexp/regexp-macro-assembler-tracer.h" #include "src/regexp/regexp-macro-assembler-tracer.h"
#include "src/regexp/regexp-macro-assembler.h" #include "src/regexp/regexp-macro-assembler.h"
......
...@@ -2,14 +2,12 @@ ...@@ -2,14 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef V8_REGEXP_REGEXP_BYTECODES_H_
#ifndef V8_REGEXP_BYTECODES_IRREGEXP_H_ #define V8_REGEXP_REGEXP_BYTECODES_H_
#define V8_REGEXP_BYTECODES_IRREGEXP_H_
namespace v8 { namespace v8 {
namespace internal { namespace internal {
const int BYTECODE_MASK = 0xff; const int BYTECODE_MASK = 0xff;
// The first argument is packed in with the byte code in one word, but so it // The first argument is packed in with the byte code in one word, but so it
// has 24 bits, but it can be positive and negative so only use 23 bits for // has 24 bits, but it can be positive and negative so only use 23 bits for
...@@ -71,8 +69,7 @@ const int BYTECODE_SHIFT = 8; ...@@ -71,8 +69,7 @@ const int BYTECODE_SHIFT = 8;
V(ADVANCE_CP_AND_GOTO, 50, 8) /* bc8 offset24 addr32 */ \ V(ADVANCE_CP_AND_GOTO, 50, 8) /* bc8 offset24 addr32 */ \
V(SET_CURRENT_POSITION_FROM_END, 51, 4) /* bc8 idx24 */ V(SET_CURRENT_POSITION_FROM_END, 51, 4) /* bc8 idx24 */
#define DECLARE_BYTECODES(name, code, length) \ #define DECLARE_BYTECODES(name, code, length) static const int BC_##name = code;
static const int BC_##name = code;
BYTECODE_ITERATOR(DECLARE_BYTECODES) BYTECODE_ITERATOR(DECLARE_BYTECODES)
#undef DECLARE_BYTECODES #undef DECLARE_BYTECODES
...@@ -84,4 +81,4 @@ BYTECODE_ITERATOR(DECLARE_BYTECODE_LENGTH) ...@@ -84,4 +81,4 @@ BYTECODE_ITERATOR(DECLARE_BYTECODE_LENGTH)
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8
#endif // V8_REGEXP_BYTECODES_IRREGEXP_H_ #endif // V8_REGEXP_REGEXP_BYTECODES_H_
...@@ -4,13 +4,13 @@ ...@@ -4,13 +4,13 @@
// A simple interpreter for the Irregexp byte code. // A simple interpreter for the Irregexp byte code.
#include "src/regexp/interpreter-irregexp.h" #include "src/regexp/regexp-interpreter.h"
#include "src/ast/ast.h" #include "src/ast/ast.h"
#include "src/base/small-vector.h" #include "src/base/small-vector.h"
#include "src/objects/objects-inl.h" #include "src/objects/objects-inl.h"
#include "src/regexp/bytecodes-irregexp.h"
#include "src/regexp/jsregexp.h" #include "src/regexp/jsregexp.h"
#include "src/regexp/regexp-bytecodes.h"
#include "src/regexp/regexp-macro-assembler.h" #include "src/regexp/regexp-macro-assembler.h"
#include "src/strings/unicode.h" #include "src/strings/unicode.h"
#include "src/utils/utils.h" #include "src/utils/utils.h"
...@@ -34,7 +34,6 @@ static bool BackRefMatchesNoCase(Isolate* isolate, int from, int current, ...@@ -34,7 +34,6 @@ static bool BackRefMatchesNoCase(Isolate* isolate, int from, int current,
offset_a, offset_b, length, unicode ? nullptr : isolate) == 1; offset_a, offset_b, length, unicode ? nullptr : isolate) == 1;
} }
static bool BackRefMatchesNoCase(Isolate* isolate, int from, int current, static bool BackRefMatchesNoCase(Isolate* isolate, int from, int current,
int len, Vector<const uint8_t> subject, int len, Vector<const uint8_t> subject,
bool unicode) { bool unicode) {
...@@ -56,28 +55,19 @@ static bool BackRefMatchesNoCase(Isolate* isolate, int from, int current, ...@@ -56,28 +55,19 @@ static bool BackRefMatchesNoCase(Isolate* isolate, int from, int current,
return true; return true;
} }
#ifdef DEBUG #ifdef DEBUG
static void TraceInterpreter(const byte* code_base, static void TraceInterpreter(const byte* code_base, const byte* pc,
const byte* pc, int stack_depth, int current_position,
int stack_depth, uint32_t current_char, int bytecode_length,
int current_position,
uint32_t current_char,
int bytecode_length,
const char* bytecode_name) { const char* bytecode_name) {
if (FLAG_trace_regexp_bytecodes) { if (FLAG_trace_regexp_bytecodes) {
bool printable = (current_char < 127 && current_char >= 32); bool printable = (current_char < 127 && current_char >= 32);
const char* format = const char* format =
printable ? printable
"pc = %02x, sp = %d, curpos = %d, curchar = %08x (%c), bc = %s" : ? "pc = %02x, sp = %d, curpos = %d, curchar = %08x (%c), bc = %s"
"pc = %02x, sp = %d, curpos = %d, curchar = %08x .%c., bc = %s"; : "pc = %02x, sp = %d, curpos = %d, curchar = %08x .%c., bc = %s";
PrintF(format, PrintF(format, pc - code_base, stack_depth, current_position, current_char,
pc - code_base, printable ? current_char : '.', bytecode_name);
stack_depth,
current_position,
current_char,
printable ? current_char : '.',
bytecode_name);
for (int i = 0; i < bytecode_length; i++) { for (int i = 0; i < bytecode_length; i++) {
printf(", %02x", pc[i]); printf(", %02x", pc[i]);
} }
...@@ -99,20 +89,17 @@ static void TraceInterpreter(const byte* code_base, ...@@ -99,20 +89,17 @@ static void TraceInterpreter(const byte* code_base,
TraceInterpreter(code_base, pc, backtrack_stack.sp(), current, \ TraceInterpreter(code_base, pc, backtrack_stack.sp(), current, \
current_char, BC_##name##_LENGTH, #name); current_char, BC_##name##_LENGTH, #name);
#else #else
#define BYTECODE(name) \ #define BYTECODE(name) case BC_##name:
case BC_##name:
#endif #endif
static int32_t Load32Aligned(const byte* pc) { static int32_t Load32Aligned(const byte* pc) {
DCHECK_EQ(0, reinterpret_cast<intptr_t>(pc) & 3); DCHECK_EQ(0, reinterpret_cast<intptr_t>(pc) & 3);
return *reinterpret_cast<const int32_t *>(pc); return *reinterpret_cast<const int32_t*>(pc);
} }
static int32_t Load16Aligned(const byte* pc) { static int32_t Load16Aligned(const byte* pc) {
DCHECK_EQ(0, reinterpret_cast<intptr_t>(pc) & 1); DCHECK_EQ(0, reinterpret_cast<intptr_t>(pc) & 1);
return *reinterpret_cast<const uint16_t *>(pc); return *reinterpret_cast<const uint16_t*>(pc);
} }
// A simple abstraction over the backtracking stack used by the interpreter. // A simple abstraction over the backtracking stack used by the interpreter.
...@@ -292,12 +279,12 @@ IrregexpInterpreter::Result RawMatch(Isolate* isolate, ...@@ -292,12 +279,12 @@ IrregexpInterpreter::Result RawMatch(Isolate* isolate,
break; break;
} }
BYTECODE(POP_BT) { BYTECODE(POP_BT) {
IrregexpInterpreter::Result return_code = HandleInterrupts( IrregexpInterpreter::Result return_code =
isolate, subject_string); HandleInterrupts(isolate, subject_string);
if (return_code != IrregexpInterpreter::SUCCESS) return return_code; if (return_code != IrregexpInterpreter::SUCCESS) return return_code;
UpdateCodeAndSubjectReferences(isolate, code_array, subject_string, UpdateCodeAndSubjectReferences(isolate, code_array, subject_string,
&code_base, &pc, &subject); &code_base, &pc, &subject);
pc = code_base + backtrack_stack.pop(); pc = code_base + backtrack_stack.pop();
break; break;
...@@ -376,10 +363,8 @@ IrregexpInterpreter::Result RawMatch(Isolate* isolate, ...@@ -376,10 +363,8 @@ IrregexpInterpreter::Result RawMatch(Isolate* isolate,
Char next1 = subject[pos + 1]; Char next1 = subject[pos + 1];
Char next2 = subject[pos + 2]; Char next2 = subject[pos + 2];
Char next3 = subject[pos + 3]; Char next3 = subject[pos + 3];
current_char = (subject[pos] | current_char =
(next1 << 8) | (subject[pos] | (next1 << 8) | (next2 << 16) | (next3 << 24));
(next2 << 16) |
(next3 << 24));
pc += BC_LOAD_4_CURRENT_CHARS_LENGTH; pc += BC_LOAD_4_CURRENT_CHARS_LENGTH;
} }
break; break;
...@@ -390,10 +375,8 @@ IrregexpInterpreter::Result RawMatch(Isolate* isolate, ...@@ -390,10 +375,8 @@ IrregexpInterpreter::Result RawMatch(Isolate* isolate,
Char next1 = subject[pos + 1]; Char next1 = subject[pos + 1];
Char next2 = subject[pos + 2]; Char next2 = subject[pos + 2];
Char next3 = subject[pos + 3]; Char next3 = subject[pos + 3];
current_char = (subject[pos] | current_char =
(next1 << 8) | (subject[pos] | (next1 << 8) | (next2 << 16) | (next3 << 24));
(next2 << 16) |
(next3 << 24));
pc += BC_LOAD_4_CURRENT_CHARS_UNCHECKED_LENGTH; pc += BC_LOAD_4_CURRENT_CHARS_UNCHECKED_LENGTH;
break; break;
} }
......
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
// A simple interpreter for the Irregexp byte code. // A simple interpreter for the Irregexp byte code.
#ifndef V8_REGEXP_INTERPRETER_IRREGEXP_H_ #ifndef V8_REGEXP_REGEXP_INTERPRETER_H_
#define V8_REGEXP_INTERPRETER_IRREGEXP_H_ #define V8_REGEXP_REGEXP_INTERPRETER_H_
#include "src/regexp/jsregexp.h" #include "src/regexp/jsregexp.h"
...@@ -28,4 +28,4 @@ class V8_EXPORT_PRIVATE IrregexpInterpreter { ...@@ -28,4 +28,4 @@ class V8_EXPORT_PRIVATE IrregexpInterpreter {
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8
#endif // V8_REGEXP_INTERPRETER_IRREGEXP_H_ #endif // V8_REGEXP_REGEXP_INTERPRETER_H_
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include "src/regexp/regexp-macro-assembler-irregexp.h" #include "src/regexp/regexp-macro-assembler-irregexp.h"
#include "src/ast/ast.h" #include "src/ast/ast.h"
#include "src/regexp/bytecodes-irregexp.h" #include "src/regexp/regexp-bytecodes.h"
namespace v8 { namespace v8 {
namespace internal { namespace internal {
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#include "src/ast/ast.h" #include "src/ast/ast.h"
#include "src/objects/objects-inl.h" #include "src/objects/objects-inl.h"
#include "src/regexp/bytecodes-irregexp.h" #include "src/regexp/regexp-bytecodes.h"
#include "src/regexp/regexp-macro-assembler-irregexp-inl.h" #include "src/regexp/regexp-macro-assembler-irregexp-inl.h"
#include "src/regexp/regexp-macro-assembler.h" #include "src/regexp/regexp-macro-assembler.h"
......
...@@ -36,8 +36,8 @@ ...@@ -36,8 +36,8 @@
#include "src/codegen/macro-assembler.h" #include "src/codegen/macro-assembler.h"
#include "src/init/v8.h" #include "src/init/v8.h"
#include "src/objects/objects-inl.h" #include "src/objects/objects-inl.h"
#include "src/regexp/interpreter-irregexp.h"
#include "src/regexp/jsregexp.h" #include "src/regexp/jsregexp.h"
#include "src/regexp/regexp-interpreter.h"
#include "src/regexp/regexp-macro-assembler-irregexp.h" #include "src/regexp/regexp-macro-assembler-irregexp.h"
#include "src/regexp/regexp-macro-assembler.h" #include "src/regexp/regexp-macro-assembler.h"
#include "src/regexp/regexp-parser.h" #include "src/regexp/regexp-parser.h"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment