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

Side by Side 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, 6 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 unified diff | Download patch
« no previous file with comments | « src/hydrogen-gvn.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 V(CompareIDAndBranch) \ 97 V(CompareIDAndBranch) \
98 V(CompareGeneric) \ 98 V(CompareGeneric) \
99 V(CompareObjectEqAndBranch) \ 99 V(CompareObjectEqAndBranch) \
100 V(CompareMap) \ 100 V(CompareMap) \
101 V(CompareConstantEqAndBranch) \ 101 V(CompareConstantEqAndBranch) \
102 V(Constant) \ 102 V(Constant) \
103 V(Context) \ 103 V(Context) \
104 V(DebugBreak) \ 104 V(DebugBreak) \
105 V(DeclareGlobals) \ 105 V(DeclareGlobals) \
106 V(DeleteProperty) \ 106 V(DeleteProperty) \
107 V(DeoptCounter) \
108 V(DeoptCounterAdd) \
107 V(Deoptimize) \ 109 V(Deoptimize) \
108 V(Div) \ 110 V(Div) \
109 V(DummyUse) \ 111 V(DummyUse) \
110 V(ElementsKind) \ 112 V(ElementsKind) \
111 V(EnterInlined) \ 113 V(EnterInlined) \
112 V(FixedArrayBaseLength) \ 114 V(FixedArrayBaseLength) \
113 V(ForceRepresentation) \ 115 V(ForceRepresentation) \
114 V(FunctionLiteral) \ 116 V(FunctionLiteral) \
115 V(GetCachedArrayIndex) \ 117 V(GetCachedArrayIndex) \
116 V(GlobalObject) \ 118 V(GlobalObject) \
(...skipping 1394 matching lines...) Expand 10 before | Expand all | Expand 10 after
1511 protected: 1513 protected:
1512 virtual void InternalSetOperandAt(int index, HValue* value) { 1514 virtual void InternalSetOperandAt(int index, HValue* value) {
1513 values_[index] = value; 1515 values_[index] = value;
1514 } 1516 }
1515 1517
1516 private: 1518 private:
1517 ZoneList<HValue*> values_; 1519 ZoneList<HValue*> values_;
1518 }; 1520 };
1519 1521
1520 1522
1523 // Deoptimization counter is a conditional deoptimization instruction, executing
1524 // only when HDeoptCounter's internal cell value is <= 0.
1525 // Value itself can be manipulated by using HDeoptCounterAdd instruction.
1526 class HDeoptCounter: public HTemplateInstruction<0> {
1527 public:
1528 HDeoptCounter(int id, int initial_value, int max_value)
1529 : id_(id),
1530 initial_value_(initial_value),
1531 max_value_(max_value) {
1532 ASSERT(initial_value_ <= max_value_);
1533 ASSERT(Smi::IsValid(initial_value_));
1534 ASSERT(Smi::IsValid(max_value_));
1535 }
1536
1537 virtual Representation RequiredInputRepresentation(int index) {
1538 return Representation::None();
1539 }
1540
1541 virtual void PrintDataTo(StringStream* stream);
1542
1543 inline int id() const { return id_; }
1544 inline int initial_value() const { return initial_value_; }
1545 inline int max_value() const { return max_value_; }
1546
1547 DECLARE_CONCRETE_INSTRUCTION(DeoptCounter)
1548
1549 private:
1550 int id_;
1551 int initial_value_;
1552 int max_value_;
1553 };
1554
1555
1556 // Modify HDeoptCounter's cell's value by adding `delta` to it.
1557 // NOTE: May cause soft deoptimization on negative or zero cell's value.
1558 class HDeoptCounterAdd: public HTemplateInstruction<0> {
1559 public:
1560 explicit HDeoptCounterAdd(HDeoptCounter* counter, int delta)
1561 : counter_(counter),
1562 delta_(delta) {
1563 }
1564
1565 virtual Representation RequiredInputRepresentation(int index) {
1566 return Representation::None();
1567 }
1568
1569 virtual void PrintDataTo(StringStream* stream);
1570
1571 inline HDeoptCounter* counter() const { return counter_; }
1572 inline int delta() { return delta_; }
1573
1574 DECLARE_CONCRETE_INSTRUCTION(DeoptCounterAdd)
1575
1576 private:
1577 HDeoptCounter* counter_;
1578 int delta_;
1579 };
1580
1581
1521 class HGoto: public HTemplateControlInstruction<1, 0> { 1582 class HGoto: public HTemplateControlInstruction<1, 0> {
1522 public: 1583 public:
1523 explicit HGoto(HBasicBlock* target) { 1584 explicit HGoto(HBasicBlock* target) {
1524 SetSuccessorAt(0, target); 1585 SetSuccessorAt(0, target);
1525 } 1586 }
1526 1587
1527 virtual Representation RequiredInputRepresentation(int index) { 1588 virtual Representation RequiredInputRepresentation(int index) {
1528 return Representation::None(); 1589 return Representation::None();
1529 } 1590 }
1530 1591
(...skipping 4969 matching lines...) Expand 10 before | Expand all | Expand 10 after
6500 virtual bool IsDeletable() const { return true; } 6561 virtual bool IsDeletable() const { return true; }
6501 }; 6562 };
6502 6563
6503 6564
6504 #undef DECLARE_INSTRUCTION 6565 #undef DECLARE_INSTRUCTION
6505 #undef DECLARE_CONCRETE_INSTRUCTION 6566 #undef DECLARE_CONCRETE_INSTRUCTION
6506 6567
6507 } } // namespace v8::internal 6568 } } // namespace v8::internal
6508 6569
6509 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 6570 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« 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