}
+void PositionInstr::Compile(MacroAssembler* masm) {
+ if (FLAG_debug_info && pos_ != RelocInfo::kNoPosition) {
+ __ RecordStatementPosition(pos_);
+ __ RecordPosition(pos_);
+ }
+}
+
+
void BinaryOpInstr::Compile(MacroAssembler* masm) {
// The right-hand value should not be on the stack---if it is a
// compiler-generated temporary it is in the accumulator.
Instruction* instr = block->instructions()->last();
instr->set_location(CfgGlobals::current()->effect_location());
}
+ cfg_->Append(new PositionInstr(stmt->statement_pos()));
cfg_->Concatenate(builder.cfg());
}
BAILOUT("unsupported expression in return statement");
}
+ cfg_->Append(new PositionInstr(stmt->statement_pos()));
cfg_->Concatenate(builder.cfg());
cfg_->AppendReturnInstruction(builder.value());
}
class Instruction : public ZoneObject {
public:
// Every instruction has a location where its result is stored (which may
- // be Effect).
+ // be Effect, the default).
+ Instruction() : loc_(CfgGlobals::current()->effect_location()) {}
+
explicit Instruction(Location* loc) : loc_(loc) {}
virtual ~Instruction() {}
};
+// A phantom instruction that indicates the start of a statement. It
+// causes the statement position to be recorded in the relocation
+// information but generates no code.
+class PositionInstr : public Instruction {
+ public:
+ explicit PositionInstr(int pos) : pos_(pos) {}
+
+ // Support for fast-compilation mode.
+ void Compile(MacroAssembler* masm);
+
+ // This should not be called. The last instruction of the previous
+ // statement should not have a temporary as its location.
+ void FastAllocate(TempLocation* temp) { UNREACHABLE(); }
+
+#ifdef DEBUG
+ // Printing support. Print nothing.
+ void Print() {}
+#endif
+
+ private:
+ int pos_;
+};
+
+
// Perform a (non-short-circuited) binary operation on a pair of values,
// leaving the result in a location.
class BinaryOpInstr : public Instruction {
class ReturnInstr : public Instruction {
public:
// Location is always Effect.
- explicit ReturnInstr(Value* value)
- : Instruction(CfgGlobals::current()->effect_location()),
- value_(value) {
- }
+ explicit ReturnInstr(Value* value) : value_(value) {}
virtual ~ReturnInstr() {}
}
+void PositionInstr::Compile(MacroAssembler* masm) {
+ if (FLAG_debug_info && pos_ != RelocInfo::kNoPosition) {
+ __ RecordStatementPosition(pos_);
+ __ RecordPosition(pos_);
+ }
+}
+
+
void BinaryOpInstr::Compile(MacroAssembler* masm) {
// The right-hand value should not be on the stack---if it is a
// compiler-generated temporary it is in the accumulator.
}
+void PositionInstr::Compile(MacroAssembler* masm) {
+ if (FLAG_debug_info && pos_ != RelocInfo::kNoPosition) {
+ __ RecordStatementPosition(pos_);
+ __ RecordPosition(pos_);
+ }
+}
+
+
void BinaryOpInstr::Compile(MacroAssembler* masm) {
// The right-hand value should not be on the stack---if it is a
// compiler-generated temporary it is in the accumulator.