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

Unified Diff: src/hydrogen-instructions.h

Issue 8373029: [hydrogen] optimize switch with string clauses (Closed) Base URL: gh:v8/v8@master
Patch Set: use type feedback to bailout switches with known beforehand string(non-symbol) comparison Created 9 years, 1 month 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
Index: src/hydrogen-instructions.h
diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h
index 101d62a85a14125243b7b9559aa45970dcba0d08..343b0fe5bed39884a5e25d1e3fc8c587f31a08a2 100644
--- a/src/hydrogen-instructions.h
+++ b/src/hydrogen-instructions.h
@@ -118,8 +118,10 @@ class LChunkBuilder;
V(IsConstructCallAndBranch) \
V(IsNilAndBranch) \
V(IsObjectAndBranch) \
+ V(IsStringAndBranch) \
V(IsSmiAndBranch) \
V(IsUndetectableAndBranch) \
+ V(CompareGenericAndBranch) \
V(JSArrayLength) \
V(LeaveInlined) \
V(LoadContextSlot) \
@@ -2715,6 +2717,18 @@ class HIsObjectAndBranch: public HUnaryControlInstruction {
DECLARE_CONCRETE_INSTRUCTION(IsObjectAndBranch)
};
+class HIsStringAndBranch: public HUnaryControlInstruction {
+ public:
+ explicit HIsStringAndBranch(HValue* value)
+ : HUnaryControlInstruction(value, NULL, NULL) { }
+
+ virtual Representation RequiredInputRepresentation(int index) {
+ return Representation::Tagged();
+ }
+
+ DECLARE_CONCRETE_INSTRUCTION(IsStringAndBranch)
+};
+
class HIsSmiAndBranch: public HUnaryControlInstruction {
public:
@@ -2745,6 +2759,42 @@ class HIsUndetectableAndBranch: public HUnaryControlInstruction {
};
+class HCompareGenericAndBranch: public HTemplateControlInstruction<2, 3> {
fschneider 2011/11/07 08:27:18 This should rather be HStringCompareAndBranch. It
+ public:
+ HCompareGenericAndBranch(HValue* context,
+ HValue* left,
+ HValue* right,
+ Token::Value token)
+ : token_(token) {
+ ASSERT(Token::IsCompareOp(token));
+ SetOperandAt(0, context);
+ SetOperandAt(1, left);
+ SetOperandAt(2, right);
+ set_representation(Representation::Tagged());
+ }
+
+ HValue* context() { return OperandAt(0); }
+ HValue* left() { return OperandAt(1); }
+ HValue* right() { return OperandAt(2); }
+ Token::Value token() const { return token_; }
+
+ virtual void PrintDataTo(StringStream* stream);
+
+ virtual Representation RequiredInputRepresentation(int index) {
+ return Representation::Tagged();
+ }
+
+ Representation GetInputRepresentation() const {
+ return Representation::Tagged();
+ }
+
+ DECLARE_CONCRETE_INSTRUCTION(CompareGenericAndBranch)
+
+ private:
+ Token::Value token_;
+};
+
+
class HIsConstructCallAndBranch: public HTemplateControlInstruction<2, 0> {
public:
virtual Representation RequiredInputRepresentation(int index) {

Powered by Google App Engine
This is Rietveld 408576698