12namespace interpreter {
26 if (bytecode == Bytecode::kStar0) {
27 DCHECK_EQ(operand_scale, OperandScale::kSingle);
31 out <<
" \\\n V(" << name <<
"Handler, interpreter::OperandScale::k"
32 << operand_scale <<
", interpreter::Bytecode::k"
34 offset_table[table_index] = *
count;
42 std::ofstream out(header_filename);
44 out <<
"// Automatically generated from interpreter/bytecodes.h\n"
45 <<
"// The following list macro is used to populate the builtins list\n"
46 <<
"// with the bytecode handlers\n\n"
47 <<
"#include <stdint.h>\n\n"
48 <<
"#ifndef V8_BUILTINS_GENERATED_BYTECODES_BUILTINS_LIST\n"
49 <<
"#define V8_BUILTINS_GENERATED_BYTECODES_BUILTINS_LIST\n\n"
51 <<
"namespace internal {\n\n"
52 <<
"#define BUILTIN_LIST_BYTECODE_HANDLERS(V)";
54 constexpr int kTableSize =
56 int offset_table[kTableSize];
60#define ADD_BYTECODES(Name, ...) \
61 WriteBytecode(out, Bytecode::k##Name, operand_scale, &count, offset_table, \
65 int single_count =
count;
66 operand_scale = OperandScale::kDouble;
68 int wide_count =
count - single_count;
69 operand_scale = OperandScale::kQuadruple;
72 int extra_wide_count =
count - wide_count - single_count;
76 CHECK_EQ(wide_count, extra_wide_count);
77 out <<
"\n\nconstexpr int kNumberOfBytecodeHandlers = " << single_count
79 <<
"constexpr int kNumberOfWideBytecodeHandlers = " << wide_count
81 <<
"constexpr uint8_t kIllegalBytecodeHandlerEncoding = "
83 <<
"// Mapping from Bytecode to a dense form with all the illegal\n"
84 <<
"// wide Bytecodes removed. Used to index into the builtins table.\n"
85 <<
"constexpr uint8_t kWideBytecodeToBuiltinsMapping["
100 <<
"} // namespace internal\n"
101 <<
"} // namespace v8\n"
102 <<
"#endif // V8_BUILTINS_GENERATED_BYTECODES_BUILTINS_LIST\n";
109int main(
int argc,
const char* argv[]) {
111 std::cerr <<
"Usage: " << argv[0] <<
" <output filename>\n";
#define BYTECODE_LIST(V, V_TSA)
static const int kOperandScaleCount
static const int kBytecodeCount
static const char * ToString(Bytecode bytecode)
static bool BytecodeHasHandler(Bytecode bytecode, OperandScale operand_scale)
static const int kShortStarCount
#define ADD_BYTECODES(Name,...)
int main(int argc, const char *argv[])
void WriteBytecode(std::ofstream &out, Bytecode bytecode, OperandScale operand_scale, int *count, int offset_table[], int table_index)
void WriteHeader(const char *header_filename)
const int kIllegalBytecodeHandler
const int kIllegalBytecodeHandlerEncoding
#define CHECK_GT(lhs, rhs)
#define DCHECK_NOT_NULL(val)
#define CHECK_EQ(lhs, rhs)
#define DCHECK_EQ(v1, v2)