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

Side by Side Diff: src/ast.cc

Issue 16361015: Migrate Compare ICs to new type rep (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Comments 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 | Annotate | Revision Log
« no previous file with comments | « src/ast.h ('k') | src/code-stubs.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 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 } else if (oracle->StoreIsPolymorphic(id)) { 496 } else if (oracle->StoreIsPolymorphic(id)) {
497 receiver_types_.Reserve(kMaxKeyedPolymorphism, zone); 497 receiver_types_.Reserve(kMaxKeyedPolymorphism, zone);
498 oracle->CollectKeyedReceiverTypes(id, &receiver_types_); 498 oracle->CollectKeyedReceiverTypes(id, &receiver_types_);
499 } 499 }
500 store_mode_ = oracle->GetStoreMode(id); 500 store_mode_ = oracle->GetStoreMode(id);
501 type_ = oracle->IncrementType(this); 501 type_ = oracle->IncrementType(this);
502 } 502 }
503 503
504 504
505 void CaseClause::RecordTypeFeedback(TypeFeedbackOracle* oracle) { 505 void CaseClause::RecordTypeFeedback(TypeFeedbackOracle* oracle) {
506 TypeInfo info = oracle->SwitchType(this); 506 compare_type_ = oracle->ClauseType(CompareId());
507 if (info.IsUninitialized()) info = TypeInfo::Unknown();
508 if (info.IsSmi()) {
509 compare_type_ = SMI_ONLY;
510 } else if (info.IsInternalizedString()) {
511 compare_type_ = NAME_ONLY;
512 } else if (info.IsNonInternalizedString()) {
513 compare_type_ = STRING_ONLY;
514 } else if (info.IsNonPrimitive()) {
515 compare_type_ = OBJECT_ONLY;
516 } else {
517 ASSERT(compare_type_ == NONE);
518 }
519 } 507 }
520 508
521 509
522 bool Call::ComputeTarget(Handle<Map> type, Handle<String> name) { 510 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. 511 // If there is an interceptor, we can't compute the target for a direct call.
524 if (type->has_named_interceptor()) return false; 512 if (type->has_named_interceptor()) return false;
525 513
526 if (check_type_ == RECEIVER_MAP_CHECK) { 514 if (check_type_ == RECEIVER_MAP_CHECK) {
527 // For primitive checks the holder is set up to point to the corresponding 515 // 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 516 // prototype object, i.e. one step of the algorithm below has been already
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 type_ = oracle->UnaryType(this); 666 type_ = oracle->UnaryType(this);
679 } 667 }
680 668
681 669
682 void BinaryOperation::RecordTypeFeedback(TypeFeedbackOracle* oracle) { 670 void BinaryOperation::RecordTypeFeedback(TypeFeedbackOracle* oracle) {
683 oracle->BinaryType(this, &left_type_, &right_type_, &result_type_, 671 oracle->BinaryType(this, &left_type_, &right_type_, &result_type_,
684 &has_fixed_right_arg_, &fixed_right_arg_value_); 672 &has_fixed_right_arg_, &fixed_right_arg_value_);
685 } 673 }
686 674
687 675
676 // TODO(rossberg): this function (and all other RecordTypeFeedback functions)
677 // should disappear once we use the common type field in the AST consistently.
688 void CompareOperation::RecordTypeFeedback(TypeFeedbackOracle* oracle) { 678 void CompareOperation::RecordTypeFeedback(TypeFeedbackOracle* oracle) {
689 oracle->CompareType(this, &left_type_, &right_type_, &overall_type_); 679 oracle->CompareTypes(CompareOperationFeedbackId(),
690 if (!overall_type_.IsUninitialized() && overall_type_.IsNonPrimitive() && 680 &left_type_, &right_type_, &overall_type_, &compare_nil_type_);
691 (op_ == Token::EQ || op_ == Token::EQ_STRICT)) {
692 map_ = oracle->GetCompareMap(this);
693 } else {
694 // May be a compare to nil.
695 map_ = oracle->CompareNilMonomorphicReceiverType(this);
696 if (op_ != Token::EQ_STRICT)
697 compare_nil_types_ = oracle->CompareNilTypes(this);
698 }
699 } 681 }
700 682
701 683
702 // ---------------------------------------------------------------------------- 684 // ----------------------------------------------------------------------------
703 // Implementation of AstVisitor 685 // Implementation of AstVisitor
704 686
705 void AstVisitor::VisitDeclarations(ZoneList<Declaration*>* declarations) { 687 void AstVisitor::VisitDeclarations(ZoneList<Declaration*>* declarations) {
706 for (int i = 0; i < declarations->length(); i++) { 688 for (int i = 0; i < declarations->length(); i++) {
707 Visit(declarations->at(i)); 689 Visit(declarations->at(i));
708 } 690 }
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
1065 } 1047 }
1066 1048
1067 1049
1068 CaseClause::CaseClause(Isolate* isolate, 1050 CaseClause::CaseClause(Isolate* isolate,
1069 Expression* label, 1051 Expression* label,
1070 ZoneList<Statement*>* statements, 1052 ZoneList<Statement*>* statements,
1071 int pos) 1053 int pos)
1072 : label_(label), 1054 : label_(label),
1073 statements_(statements), 1055 statements_(statements),
1074 position_(pos), 1056 position_(pos),
1075 compare_type_(NONE), 1057 compare_type_(Type::None(), isolate),
1076 compare_id_(AstNode::GetNextId(isolate)), 1058 compare_id_(AstNode::GetNextId(isolate)),
1077 entry_id_(AstNode::GetNextId(isolate)) { 1059 entry_id_(AstNode::GetNextId(isolate)) {
1078 } 1060 }
1079 1061
1080 1062
1081 #define REGULAR_NODE(NodeType) \ 1063 #define REGULAR_NODE(NodeType) \
1082 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \ 1064 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \
1083 increase_node_count(); \ 1065 increase_node_count(); \
1084 } 1066 }
1085 #define DONT_OPTIMIZE_NODE(NodeType) \ 1067 #define DONT_OPTIMIZE_NODE(NodeType) \
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
1193 OS::SNPrintF(buffer, "%d", Smi::cast(*handle_)->value()); 1175 OS::SNPrintF(buffer, "%d", Smi::cast(*handle_)->value());
1194 str = arr; 1176 str = arr;
1195 } else { 1177 } else {
1196 str = DoubleToCString(handle_->Number(), buffer); 1178 str = DoubleToCString(handle_->Number(), buffer);
1197 } 1179 }
1198 return factory->NewStringFromAscii(CStrVector(str)); 1180 return factory->NewStringFromAscii(CStrVector(str));
1199 } 1181 }
1200 1182
1201 1183
1202 } } // namespace v8::internal 1184 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ast.h ('k') | src/code-stubs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698