| Index: src/hydrogen-instructions.h
|
| diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h
|
| index 9f52569ccf60fa1a03a7a6aafc178f991a22b6d6..6153a2f4b3cc338b428f8c016ffe7e64efef0615 100644
|
| --- a/src/hydrogen-instructions.h
|
| +++ b/src/hydrogen-instructions.h
|
| @@ -104,6 +104,8 @@ class LChunkBuilder;
|
| V(DebugBreak) \
|
| V(DeclareGlobals) \
|
| V(DeleteProperty) \
|
| + V(DeoptCounter) \
|
| + V(DeoptCounterAdd) \
|
| V(Deoptimize) \
|
| V(Div) \
|
| V(DummyUse) \
|
| @@ -1518,6 +1520,65 @@ class HDeoptimize: public HControlInstruction {
|
| };
|
|
|
|
|
| +// Deoptimization counter is a conditional deoptimization instruction, executing
|
| +// only when HDeoptCounter's internal cell value is <= 0.
|
| +// Value itself can be manipulated by using HDeoptCounterAdd instruction.
|
| +class HDeoptCounter: public HTemplateInstruction<0> {
|
| + public:
|
| + HDeoptCounter(int id, int initial_value, int max_value)
|
| + : id_(id),
|
| + initial_value_(initial_value),
|
| + max_value_(max_value) {
|
| + ASSERT(initial_value_ <= max_value_);
|
| + ASSERT(Smi::IsValid(initial_value_));
|
| + ASSERT(Smi::IsValid(max_value_));
|
| + }
|
| +
|
| + virtual Representation RequiredInputRepresentation(int index) {
|
| + return Representation::None();
|
| + }
|
| +
|
| + virtual void PrintDataTo(StringStream* stream);
|
| +
|
| + inline int id() const { return id_; }
|
| + inline int initial_value() const { return initial_value_; }
|
| + inline int max_value() const { return max_value_; }
|
| +
|
| + DECLARE_CONCRETE_INSTRUCTION(DeoptCounter)
|
| +
|
| + private:
|
| + int id_;
|
| + int initial_value_;
|
| + int max_value_;
|
| +};
|
| +
|
| +
|
| +// Modify HDeoptCounter's cell's value by adding `delta` to it.
|
| +// NOTE: May cause soft deoptimization on negative or zero cell's value.
|
| +class HDeoptCounterAdd: public HTemplateInstruction<0> {
|
| + public:
|
| + explicit HDeoptCounterAdd(HDeoptCounter* counter, int delta)
|
| + : counter_(counter),
|
| + delta_(delta) {
|
| + }
|
| +
|
| + virtual Representation RequiredInputRepresentation(int index) {
|
| + return Representation::None();
|
| + }
|
| +
|
| + virtual void PrintDataTo(StringStream* stream);
|
| +
|
| + inline HDeoptCounter* counter() const { return counter_; }
|
| + inline int delta() { return delta_; }
|
| +
|
| + DECLARE_CONCRETE_INSTRUCTION(DeoptCounterAdd)
|
| +
|
| + private:
|
| + HDeoptCounter* counter_;
|
| + int delta_;
|
| +};
|
| +
|
| +
|
| class HGoto: public HTemplateControlInstruction<1, 0> {
|
| public:
|
| explicit HGoto(HBasicBlock* target) {
|
|
|