Index: src/interpreter/bytecode-array-builder.h |
diff --git a/src/interpreter/bytecode-array-builder.h b/src/interpreter/bytecode-array-builder.h |
index 12cb6a5bcee5dcba3620a0a2129b527afddc7185..93fd6c47e83e8c1404604966508f884ca06f5cf5 100644 |
--- a/src/interpreter/bytecode-array-builder.h |
+++ b/src/interpreter/bytecode-array-builder.h |
@@ -26,6 +26,7 @@ namespace interpreter { |
class BytecodeLabel; |
class BytecodeNode; |
class BytecodePipelineStage; |
+class BytecodeRegisterOptimizer; |
class Register; |
class V8_EXPORT_PRIVATE BytecodeArrayBuilder final |
@@ -320,6 +321,12 @@ class V8_EXPORT_PRIVATE BytecodeArrayBuilder final |
bool RequiresImplicitReturn() const { return !return_seen_in_block_; } |
+ // Returns the raw operand value for the given register or register list. |
+ uint32_t GetInputRegisterOperand(Register reg); |
+ uint32_t GetOutputRegisterOperand(Register reg); |
+ uint32_t GetInputRegisterListOperand(RegisterList reg_list); |
+ uint32_t GetOutputRegisterListOperand(RegisterList reg_list); |
+ |
// Accessors |
BytecodeRegisterAllocator* register_allocator() { |
return ®ister_allocator_; |
@@ -331,41 +338,22 @@ class V8_EXPORT_PRIVATE BytecodeArrayBuilder final |
private: |
friend class BytecodeRegisterAllocator; |
+ template <OperandType... operand_types> |
+ friend class BytecodeNodeBuilder; |
- INLINE(void Output(Bytecode bytecode, uint32_t operand0, uint32_t operand1, |
- uint32_t operand2, uint32_t operand3)); |
- INLINE(void Output(Bytecode bytecode, uint32_t operand0, uint32_t operand1, |
- uint32_t operand2)); |
- INLINE(void Output(Bytecode bytecode, uint32_t operand0, uint32_t operand1)); |
- INLINE(void Output(Bytecode bytecode, uint32_t operand0)); |
- INLINE(void Output(Bytecode bytecode)); |
+ // Returns the current source position for the given |bytecode|. |
+ INLINE(BytecodeSourceInfo CurrentSourcePosition(Bytecode bytecode)); |
- INLINE(void OutputJump(Bytecode bytecode, BytecodeLabel* label)); |
- INLINE(void OutputJump(Bytecode bytecode, uint32_t operand0, |
- BytecodeLabel* label)); |
+#define DECLARE_BYTECODE_OUTPUT(Name, ...) \ |
+ template <typename... Operands> \ |
+ INLINE(void Output##Name(Operands... operands)); \ |
+ template <typename... Operands> \ |
+ INLINE(void Output##Name(BytecodeLabel* label, Operands... operands)); |
+ BYTECODE_LIST(DECLARE_BYTECODE_OUTPUT) |
+#undef DECLARE_OPERAND_TYPE_INFO |
bool RegisterIsValid(Register reg) const; |
- bool OperandsAreValid(Bytecode bytecode, int operand_count, |
- uint32_t operand0 = 0, uint32_t operand1 = 0, |
- uint32_t operand2 = 0, uint32_t operand3 = 0) const; |
- |
- static uint32_t RegisterOperand(Register reg) { |
- return static_cast<uint32_t>(reg.ToOperand()); |
- } |
- |
- static uint32_t SignedOperand(int value) { |
- return static_cast<uint32_t>(value); |
- } |
- |
- static uint32_t UnsignedOperand(int value) { |
- DCHECK_GE(value, 0); |
- return static_cast<uint32_t>(value); |
- } |
- |
- static uint32_t UnsignedOperand(size_t value) { |
- DCHECK_LE(value, kMaxUInt32); |
- return static_cast<uint32_t>(value); |
- } |
+ bool RegisterListIsValid(RegisterList reg_list) const; |
// Set position for return. |
void SetReturnPosition(); |
@@ -378,6 +366,8 @@ class V8_EXPORT_PRIVATE BytecodeArrayBuilder final |
// during bytecode generation. |
BytecodeArrayBuilder& Illegal(); |
+ void PrepareToOutputBytecode(Bytecode bytecode); |
+ |
void LeaveBasicBlock() { return_seen_in_block_ = false; } |
BytecodeArrayWriter* bytecode_array_writer() { |
@@ -406,6 +396,7 @@ class V8_EXPORT_PRIVATE BytecodeArrayBuilder final |
BytecodeRegisterAllocator register_allocator_; |
BytecodeArrayWriter bytecode_array_writer_; |
BytecodePipelineStage* pipeline_; |
+ BytecodeRegisterOptimizer* register_optimizer_; |
BytecodeSourceInfo latest_source_info_; |
static int const kNoFeedbackSlot = 0; |