Index: src/interpreter/bytecode-array-builder.h |
diff --git a/src/interpreter/bytecode-array-builder.h b/src/interpreter/bytecode-array-builder.h |
index 13a9cc2c0b75634a6328e593f346730bfd39d650..21590baeea932ea2d813715fd76155104f8b83a3 100644 |
--- a/src/interpreter/bytecode-array-builder.h |
+++ b/src/interpreter/bytecode-array-builder.h |
@@ -7,6 +7,7 @@ |
#include "src/ast/ast.h" |
#include "src/interpreter/bytecode-register-allocator.h" |
+#include "src/interpreter/bytecode-writer.h" |
#include "src/interpreter/bytecodes.h" |
#include "src/interpreter/constant-array-builder.h" |
#include "src/interpreter/handler-table-builder.h" |
@@ -270,17 +271,10 @@ class BytecodeArrayBuilder final : public ZoneObject { |
return &temporary_allocator_; |
} |
- void EnsureReturn(); |
- |
- static OperandScale OperandSizesToScale( |
- OperandSize size0, OperandSize size1 = OperandSize::kByte, |
- OperandSize size2 = OperandSize::kByte, |
- OperandSize size3 = OperandSize::kByte); |
+ BytecodeWriter* writer() { return writer_; } |
+ void set_writer(BytecodeWriter* writer) { writer_ = writer; } |
- static OperandSize SizeForRegisterOperand(Register reg); |
- static OperandSize SizeForSignedOperand(int value); |
- static OperandSize SizeForUnsignedOperand(int value); |
- static OperandSize SizeForUnsignedOperand(size_t value); |
+ void EnsureReturn(); |
static uint32_t RegisterOperand(Register reg); |
static Register RegisterFromOperand(uint32_t operand); |
@@ -289,7 +283,6 @@ class BytecodeArrayBuilder final : public ZoneObject { |
static uint32_t UnsignedOperand(size_t value); |
private: |
- class PreviousBytecodeHelper; |
friend class BytecodeRegisterAllocator; |
static Bytecode BytecodeForBinaryOperation(Token::Value op); |
@@ -307,9 +300,6 @@ class BytecodeArrayBuilder final : public ZoneObject { |
static Bytecode GetJumpWithConstantOperand(Bytecode jump_smi8_operand); |
static Bytecode GetJumpWithToBoolean(Bytecode jump_smi8_operand); |
- template <size_t N> |
- INLINE(void Output(Bytecode bytecode, uint32_t (&operands)[N], |
- OperandScale operand_scale = OperandScale::kSingle)); |
void Output(Bytecode bytecode); |
void OutputScaled(Bytecode bytecode, OperandScale operand_scale, |
uint32_t operand0, uint32_t operand1, uint32_t operand2, |
@@ -323,14 +313,14 @@ class BytecodeArrayBuilder final : public ZoneObject { |
BytecodeArrayBuilder& OutputJump(Bytecode jump_bytecode, |
BytecodeLabel* label); |
- void PatchJump(const ZoneVector<uint8_t>::iterator& jump_target, |
- const ZoneVector<uint8_t>::iterator& jump_location); |
- void PatchIndirectJumpWith8BitOperand( |
- const ZoneVector<uint8_t>::iterator& jump_location, int delta); |
- void PatchIndirectJumpWith16BitOperand( |
- const ZoneVector<uint8_t>::iterator& jump_location, int delta); |
- void PatchIndirectJumpWith32BitOperand( |
- const ZoneVector<uint8_t>::iterator& jump_location, int delta); |
+ void PatchJump(ZoneVector<uint8_t>* bytecodes, size_t jump_target, |
+ size_t jump_location); |
+ void PatchJumpWith8BitOperand(ZoneVector<uint8_t>* bytecodes, |
+ size_t jump_location, int delta); |
+ void PatchJumpWith16BitOperand(ZoneVector<uint8_t>* bytecodes, |
+ size_t jump_location, int delta); |
+ void PatchJumpWith32BitOperand(ZoneVector<uint8_t>* bytecodes, |
+ size_t jump_location, int delta); |
void LeaveBasicBlock(); |
@@ -338,18 +328,12 @@ class BytecodeArrayBuilder final : public ZoneObject { |
int operand_index, uint32_t operand_value) const; |
bool RegisterIsValid(Register reg, OperandSize reg_size) const; |
- bool LastBytecodeInSameBlock() const; |
- bool NeedToBooleanCast(); |
- bool IsRegisterInAccumulator(Register reg); |
- |
// Set position for return. |
void SetReturnPosition(); |
// Gets a constant pool entry for the |object|. |
size_t GetConstantPoolEntry(Handle<Object> object); |
- ZoneVector<uint8_t>* bytecodes() { return &bytecodes_; } |
- const ZoneVector<uint8_t>* bytecodes() const { return &bytecodes_; } |
Isolate* isolate() const { return isolate_; } |
ConstantArrayBuilder* constant_array_builder() { |
return &constant_array_builder_; |
@@ -363,16 +347,20 @@ class BytecodeArrayBuilder final : public ZoneObject { |
SourcePositionTableBuilder* source_position_table_builder() { |
return &source_position_table_builder_; |
} |
+ BytecodeNodeAllocator* bytecode_node_allocator() { |
+ return &bytecode_node_allocator_; |
+ } |
+ BytecodeNode* current_node() { return current_node_; } |
+ FinalStageBytecodeWriter* final_stage_writer() { |
+ return &final_stage_writer_; |
+ } |
Isolate* isolate_; |
Zone* zone_; |
- ZoneVector<uint8_t> bytecodes_; |
bool bytecode_generated_; |
ConstantArrayBuilder constant_array_builder_; |
HandlerTableBuilder handler_table_builder_; |
SourcePositionTableBuilder source_position_table_builder_; |
- size_t last_block_end_; |
- size_t last_bytecode_start_; |
bool exit_seen_in_block_; |
int unbound_jumps_; |
int parameter_count_; |
@@ -380,6 +368,10 @@ class BytecodeArrayBuilder final : public ZoneObject { |
int context_register_count_; |
int return_position_; |
TemporaryRegisterAllocator temporary_allocator_; |
+ BytecodeNodeAllocator bytecode_node_allocator_; |
+ FinalStageBytecodeWriter final_stage_writer_; |
+ BytecodeWriter* writer_; |
+ BytecodeNode* current_node_; |
DISALLOW_COPY_AND_ASSIGN(BytecodeArrayBuilder); |
}; |