Index: src/interpreter/bytecode-array-builder.h |
diff --git a/src/interpreter/bytecode-array-builder.h b/src/interpreter/bytecode-array-builder.h |
index a9fa7a7bb5c2bd82f32cb775d8117f2f82ba4bc0..03da67b7236fb898930a9de1e31cf0d0ba9bc56c 100644 |
--- a/src/interpreter/bytecode-array-builder.h |
+++ b/src/interpreter/bytecode-array-builder.h |
@@ -24,6 +24,7 @@ namespace interpreter { |
class BytecodeLabel; |
class BytecodeNode; |
class BytecodePipelineStage; |
+class BytecodeRegisterOptimizer; |
class Register; |
class BytecodeArrayBuilder final : public ZoneObject { |
@@ -317,6 +318,15 @@ class BytecodeArrayBuilder final : public ZoneObject { |
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); |
+ |
+ // Used internally to prepare for emitting a given bytecode. |
Leszek Swirski
2016/10/06 10:35:17
If this is used internally, should it be private?
rmcilroy
2016/10/06 17:14:43
Done.
|
+ void PrepareToOutputBytecode(Bytecode bytecode); |
+ |
// Accessors |
BytecodeRegisterAllocator* register_allocator() { |
return ®ister_allocator_; |
@@ -329,40 +339,19 @@ class BytecodeArrayBuilder final : public ZoneObject { |
private: |
friend class BytecodeRegisterAllocator; |
- 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(); |
@@ -403,6 +392,7 @@ class BytecodeArrayBuilder final : public ZoneObject { |
BytecodeRegisterAllocator register_allocator_; |
BytecodeArrayWriter bytecode_array_writer_; |
BytecodePipelineStage* pipeline_; |
+ BytecodeRegisterOptimizer* register_optimizer_; |
BytecodeSourceInfo latest_source_info_; |
static int const kNoFeedbackSlot = 0; |