5 #ifndef V8_INTERPRETER_BYTECODE_ARRAY_WRITER_H_ 6 #define V8_INTERPRETER_BYTECODE_ARRAY_WRITER_H_ 8 #include "src/base/compiler-specific.h" 9 #include "src/globals.h" 10 #include "src/interpreter/bytecodes.h" 11 #include "src/source-position-table.h" 17 class SourcePositionTableBuilder;
19 namespace interpreter {
23 class BytecodeJumpTable;
24 class ConstantArrayBuilder;
26 namespace bytecode_array_writer_unittest {
27 class BytecodeArrayWriterUnittest;
36 SourcePositionTableBuilder::RecordingMode source_position_mode);
48 bool RemainderOfBlockIsDead()
const {
return exit_seen_in_block_; }
54 static const size_t kMaxSizeOfPackedBytecode =
55 2 *
sizeof(Bytecode) +
56 Bytecodes::kMaxOperands * static_cast<size_t>(OperandSize::kLast);
61 const uint32_t k8BitJumpPlaceholder = 0x7f;
62 const uint32_t k16BitJumpPlaceholder =
63 k8BitJumpPlaceholder | (k8BitJumpPlaceholder << 8);
64 const uint32_t k32BitJumpPlaceholder =
65 k16BitJumpPlaceholder | (k16BitJumpPlaceholder << 16);
67 void PatchJump(
size_t jump_target,
size_t jump_location);
68 void PatchJumpWith8BitOperand(
size_t jump_location,
int delta);
69 void PatchJumpWith16BitOperand(
size_t jump_location,
int delta);
70 void PatchJumpWith32BitOperand(
size_t jump_location,
int delta);
75 void UpdateSourcePositionTable(
const BytecodeNode*
const node);
77 void UpdateExitSeenInBlock(Bytecode bytecode);
79 void MaybeElideLastBytecode(Bytecode next_bytecode,
bool has_source_info);
80 void InvalidateLastBytecode();
84 return &source_position_table_builder_;
87 return constant_array_builder_;
95 Bytecode last_bytecode_;
96 size_t last_bytecode_offset_;
97 bool last_bytecode_had_source_info_;
98 bool elide_noneffectful_bytecodes_;
100 bool exit_seen_in_block_;
102 friend class bytecode_array_writer_unittest::BytecodeArrayWriterUnittest;
110 #endif // V8_INTERPRETER_BYTECODE_ARRAY_WRITER_H_