Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(375)

Unified Diff: src/hydrogen-instructions.h

Issue 16128004: Reorder switch clauses using newly-introduced execution counters in (Closed) Base URL: gh:v8/v8.git@master
Patch Set: tweak heuristic Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/hydrogen-gvn.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « src/hydrogen-gvn.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698