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..c82e05fcac07aba3c4387f77cfce3ec0fac87a33 100644 |
--- a/src/interpreter/bytecode-array-builder.h |
+++ b/src/interpreter/bytecode-array-builder.h |
@@ -6,6 +6,7 @@ |
#define V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ |
#include "src/ast/ast.h" |
+#include "src/interpreter/bytecode-array-writer.h" |
#include "src/interpreter/bytecode-register-allocator.h" |
#include "src/interpreter/bytecodes.h" |
#include "src/interpreter/constant-array-builder.h" |
@@ -21,6 +22,8 @@ class Isolate; |
namespace interpreter { |
class BytecodeLabel; |
+class BytecodeNode; |
+class BytecodePipelineStage; |
class Register; |
class BytecodeArrayBuilder final : public ZoneObject { |
@@ -262,26 +265,16 @@ class BytecodeArrayBuilder final : public ZoneObject { |
void SetExpressionAsStatementPosition(Expression* expr); |
// Accessors |
- Zone* zone() const { return zone_; } |
TemporaryRegisterAllocator* temporary_register_allocator() { |
return &temporary_allocator_; |
} |
const TemporaryRegisterAllocator* temporary_register_allocator() const { |
return &temporary_allocator_; |
} |
+ Zone* zone() const { return zone_; } |
void EnsureReturn(); |
- static OperandScale OperandSizesToScale( |
- OperandSize size0, OperandSize size1 = OperandSize::kByte, |
- OperandSize size2 = OperandSize::kByte, |
- OperandSize size3 = OperandSize::kByte); |
- |
- static OperandSize SizeForRegisterOperand(Register reg); |
- static OperandSize SizeForSignedOperand(int value); |
- static OperandSize SizeForUnsignedOperand(int value); |
- static OperandSize SizeForUnsignedOperand(size_t value); |
- |
static uint32_t RegisterOperand(Register reg); |
static Register RegisterFromOperand(uint32_t operand); |
static uint32_t SignedOperand(int value, OperandSize size); |
@@ -289,7 +282,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); |
@@ -305,11 +297,7 @@ class BytecodeArrayBuilder final : public ZoneObject { |
static Bytecode BytecodeForCall(TailCallMode tail_call_mode); |
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 +311,13 @@ 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(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,9 +325,8 @@ 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); |
+ // Attach latest source position to |node|. |
+ void AttachSourceInfo(BytecodeNode* node); |
// Set position for return. |
void SetReturnPosition(); |
@@ -348,9 +334,11 @@ class BytecodeArrayBuilder final : public ZoneObject { |
// 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_; } |
+ BytecodeArrayWriter* bytecode_array_writer() { |
+ return &bytecode_array_writer_; |
+ } |
+ BytecodePipelineStage* pipeline() { return pipeline_; } |
ConstantArrayBuilder* constant_array_builder() { |
return &constant_array_builder_; |
} |
@@ -366,13 +354,10 @@ class BytecodeArrayBuilder final : public ZoneObject { |
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 +365,9 @@ class BytecodeArrayBuilder final : public ZoneObject { |
int context_register_count_; |
int return_position_; |
TemporaryRegisterAllocator temporary_allocator_; |
+ BytecodeArrayWriter bytecode_array_writer_; |
+ BytecodePipelineStage* pipeline_; |
+ BytecodeSourceInfo latest_source_info_; |
DISALLOW_COPY_AND_ASSIGN(BytecodeArrayBuilder); |
}; |