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

Side by Side Diff: src/ast.cc

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/ast.h ('k') | src/hydrogen.h » ('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 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 compare_type_ = SMI_ONLY; 509 compare_type_ = SMI_ONLY;
510 } else if (info.IsInternalizedString()) { 510 } else if (info.IsInternalizedString()) {
511 compare_type_ = NAME_ONLY; 511 compare_type_ = NAME_ONLY;
512 } else if (info.IsNonInternalizedString()) { 512 } else if (info.IsNonInternalizedString()) {
513 compare_type_ = STRING_ONLY; 513 compare_type_ = STRING_ONLY;
514 } else if (info.IsNonPrimitive()) { 514 } else if (info.IsNonPrimitive()) {
515 compare_type_ = OBJECT_ONLY; 515 compare_type_ = OBJECT_ONLY;
516 } else { 516 } else {
517 ASSERT(compare_type_ == NONE); 517 ASSERT(compare_type_ == NONE);
518 } 518 }
519
520 hit_count_ = oracle->SwitchHitCount(this);
519 } 521 }
520 522
521 523
522 bool Call::ComputeTarget(Handle<Map> type, Handle<String> name) { 524 bool Call::ComputeTarget(Handle<Map> type, Handle<String> name) {
523 // If there is an interceptor, we can't compute the target for a direct call. 525 // If there is an interceptor, we can't compute the target for a direct call.
524 if (type->has_named_interceptor()) return false; 526 if (type->has_named_interceptor()) return false;
525 527
526 if (check_type_ == RECEIVER_MAP_CHECK) { 528 if (check_type_ == RECEIVER_MAP_CHECK) {
527 // For primitive checks the holder is set up to point to the corresponding 529 // For primitive checks the holder is set up to point to the corresponding
528 // prototype object, i.e. one step of the algorithm below has been already 530 // prototype object, i.e. one step of the algorithm below has been already
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
1067 1069
1068 1070
1069 CaseClause::CaseClause(Isolate* isolate, 1071 CaseClause::CaseClause(Isolate* isolate,
1070 Expression* label, 1072 Expression* label,
1071 ZoneList<Statement*>* statements, 1073 ZoneList<Statement*>* statements,
1072 int pos) 1074 int pos)
1073 : label_(label), 1075 : label_(label),
1074 statements_(statements), 1076 statements_(statements),
1075 position_(pos), 1077 position_(pos),
1076 compare_type_(NONE), 1078 compare_type_(NONE),
1079 hit_count_(0),
1077 compare_id_(AstNode::GetNextId(isolate)), 1080 compare_id_(AstNode::GetNextId(isolate)),
1081 counter_id_(AstNode::GetNextId(isolate)),
1078 entry_id_(AstNode::GetNextId(isolate)) { 1082 entry_id_(AstNode::GetNextId(isolate)) {
1079 } 1083 }
1080 1084
1081 1085
1082 #define REGULAR_NODE(NodeType) \ 1086 #define REGULAR_NODE(NodeType) \
1083 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \ 1087 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \
1084 increase_node_count(); \ 1088 increase_node_count(); \
1085 } 1089 }
1086 #define DONT_OPTIMIZE_NODE(NodeType) \ 1090 #define DONT_OPTIMIZE_NODE(NodeType) \
1087 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \ 1091 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
1192 OS::SNPrintF(buffer, "%d", Smi::cast(*handle_)->value()); 1196 OS::SNPrintF(buffer, "%d", Smi::cast(*handle_)->value());
1193 str = arr; 1197 str = arr;
1194 } else { 1198 } else {
1195 str = DoubleToCString(handle_->Number(), buffer); 1199 str = DoubleToCString(handle_->Number(), buffer);
1196 } 1200 }
1197 return FACTORY->NewStringFromAscii(CStrVector(str)); 1201 return FACTORY->NewStringFromAscii(CStrVector(str));
1198 } 1202 }
1199 1203
1200 1204
1201 } } // namespace v8::internal 1205 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ast.h ('k') | src/hydrogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698