Index: src/compiler/instruction.h |
diff --git a/src/compiler/instruction.h b/src/compiler/instruction.h |
index 48dbdf20e70fdd6bf9f8b83991edf6417ef8ca1c..9e2004fa88bc5cad6aad1013773092b2f02d565e 100644 |
--- a/src/compiler/instruction.h |
+++ b/src/compiler/instruction.h |
@@ -25,7 +25,8 @@ |
// A couple of reserved opcodes are used for internal use. |
const InstructionCode kGapInstruction = -1; |
-const InstructionCode kSourcePositionInstruction = -2; |
+const InstructionCode kBlockStartInstruction = -2; |
+const InstructionCode kSourcePositionInstruction = -3; |
#define INSTRUCTION_OPERAND_LIST(V) \ |
V(Constant, CONSTANT, 0) \ |
@@ -491,7 +492,10 @@ |
bool NeedsPointerMap() const { return IsCall(); } |
bool HasPointerMap() const { return pointer_map_ != NULL; } |
- bool IsGapMoves() const { return opcode() == kGapInstruction; } |
+ bool IsGapMoves() const { |
+ return opcode() == kGapInstruction || opcode() == kBlockStartInstruction; |
+ } |
+ bool IsBlockStart() const { return opcode() == kBlockStartInstruction; } |
bool IsSourcePosition() const { |
return opcode() == kSourcePositionInstruction; |
} |
@@ -637,6 +641,30 @@ |
}; |
+// This special kind of gap move instruction represents the beginning of a |
+// block of code. |
+class BlockStartInstruction FINAL : public GapInstruction { |
+ public: |
+ static BlockStartInstruction* New(Zone* zone) { |
+ void* buffer = zone->New(sizeof(BlockStartInstruction)); |
+ return new (buffer) BlockStartInstruction(); |
+ } |
+ |
+ static BlockStartInstruction* cast(Instruction* instr) { |
+ DCHECK(instr->IsBlockStart()); |
+ return static_cast<BlockStartInstruction*>(instr); |
+ } |
+ |
+ static const BlockStartInstruction* cast(const Instruction* instr) { |
+ DCHECK(instr->IsBlockStart()); |
+ return static_cast<const BlockStartInstruction*>(instr); |
+ } |
+ |
+ private: |
+ BlockStartInstruction() : GapInstruction(kBlockStartInstruction) {} |
+}; |
+ |
+ |
class SourcePositionInstruction FINAL : public Instruction { |
public: |
static SourcePositionInstruction* New(Zone* zone, SourcePosition position) { |
@@ -952,7 +980,7 @@ |
void AddGapMove(int index, InstructionOperand* from, InstructionOperand* to); |
- GapInstruction* GetBlockStart(BasicBlock::RpoNumber rpo) const; |
+ BlockStartInstruction* GetBlockStart(BasicBlock::RpoNumber rpo) const; |
typedef InstructionDeque::const_iterator const_iterator; |
const_iterator begin() const { return instructions_.begin(); } |