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

Side by Side Diff: src/ast.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/arm/lithium-codegen-arm.cc ('k') | src/ast.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 987 matching lines...) Expand 10 before | Expand all | Expand 10 after
998 ZoneList<Statement*>* statements, 998 ZoneList<Statement*>* statements,
999 int pos); 999 int pos);
1000 1000
1001 bool is_default() const { return label_ == NULL; } 1001 bool is_default() const { return label_ == NULL; }
1002 Expression* label() const { 1002 Expression* label() const {
1003 CHECK(!is_default()); 1003 CHECK(!is_default());
1004 return label_; 1004 return label_;
1005 } 1005 }
1006 Label* body_target() { return &body_target_; } 1006 Label* body_target() { return &body_target_; }
1007 ZoneList<Statement*>* statements() const { return statements_; } 1007 ZoneList<Statement*>* statements() const { return statements_; }
1008 int hit_count() { return hit_count_; }
1008 1009
1009 int position() const { return position_; } 1010 int position() const { return position_; }
1010 void set_position(int pos) { position_ = pos; } 1011 void set_position(int pos) { position_ = pos; }
1011 1012
1012 BailoutId EntryId() const { return entry_id_; } 1013 BailoutId EntryId() const { return entry_id_; }
1013 1014
1014 // Type feedback information. 1015 // Type feedback information.
1015 TypeFeedbackId CompareId() { return compare_id_; } 1016 TypeFeedbackId CompareId() { return compare_id_; }
1017 TypeFeedbackId CounterId() { return counter_id_; }
1016 void RecordTypeFeedback(TypeFeedbackOracle* oracle); 1018 void RecordTypeFeedback(TypeFeedbackOracle* oracle);
1017 bool IsSmiCompare() { return compare_type_ == SMI_ONLY; } 1019 bool IsSmiCompare() { return compare_type_ == SMI_ONLY; }
1018 bool IsNameCompare() { return compare_type_ == NAME_ONLY; } 1020 bool IsNameCompare() { return compare_type_ == NAME_ONLY; }
1019 bool IsStringCompare() { return compare_type_ == STRING_ONLY; } 1021 bool IsStringCompare() { return compare_type_ == STRING_ONLY; }
1020 bool IsObjectCompare() { return compare_type_ == OBJECT_ONLY; } 1022 bool IsObjectCompare() { return compare_type_ == OBJECT_ONLY; }
1021 1023
1022 private: 1024 private:
1023 Expression* label_; 1025 Expression* label_;
1024 Label body_target_; 1026 Label body_target_;
1025 ZoneList<Statement*>* statements_; 1027 ZoneList<Statement*>* statements_;
1026 int position_; 1028 int position_;
1027 enum CompareTypeFeedback { 1029 enum CompareTypeFeedback {
1028 NONE, 1030 NONE,
1029 SMI_ONLY, 1031 SMI_ONLY,
1030 NAME_ONLY, 1032 NAME_ONLY,
1031 STRING_ONLY, 1033 STRING_ONLY,
1032 OBJECT_ONLY 1034 OBJECT_ONLY
1033 }; 1035 };
1034 CompareTypeFeedback compare_type_; 1036 CompareTypeFeedback compare_type_;
1037 int hit_count_;
1035 const TypeFeedbackId compare_id_; 1038 const TypeFeedbackId compare_id_;
1039 const TypeFeedbackId counter_id_;
1036 const BailoutId entry_id_; 1040 const BailoutId entry_id_;
1037 }; 1041 };
1038 1042
1039 1043
1040 class SwitchStatement: public BreakableStatement { 1044 class SwitchStatement: public BreakableStatement {
1041 public: 1045 public:
1042 DECLARE_NODE_TYPE(SwitchStatement) 1046 DECLARE_NODE_TYPE(SwitchStatement)
1043 1047
1044 void Initialize(Expression* tag, ZoneList<CaseClause*>* cases) { 1048 void Initialize(Expression* tag, ZoneList<CaseClause*>* cases) {
1045 tag_ = tag; 1049 tag_ = tag;
(...skipping 2085 matching lines...) Expand 10 before | Expand all | Expand 10 after
3131 private: 3135 private:
3132 Isolate* isolate_; 3136 Isolate* isolate_;
3133 Zone* zone_; 3137 Zone* zone_;
3134 Visitor visitor_; 3138 Visitor visitor_;
3135 }; 3139 };
3136 3140
3137 3141
3138 } } // namespace v8::internal 3142 } } // namespace v8::internal
3139 3143
3140 #endif // V8_AST_H_ 3144 #endif // V8_AST_H_
OLDNEW
« no previous file with comments | « src/arm/lithium-codegen-arm.cc ('k') | src/ast.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698