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

Side by Side Diff: src/type-info.cc

Issue 11794045: Use POLYMORPHIC for polymorphic Keyed(Load|Store)IC (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 11 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/type-info.h ('k') | src/x64/stub-cache-x64.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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 code->ic_state() == MONOMORPHIC && 104 code->ic_state() == MONOMORPHIC &&
105 Code::ExtractTypeFromFlags(code->flags()) == Code::NORMAL; 105 Code::ExtractTypeFromFlags(code->flags()) == Code::NORMAL;
106 if (!preliminary_checks) return false; 106 if (!preliminary_checks) return false;
107 Map* map = code->FindFirstMap(); 107 Map* map = code->FindFirstMap();
108 return map != NULL && !CanRetainOtherContext(map, *native_context_); 108 return map != NULL && !CanRetainOtherContext(map, *native_context_);
109 } 109 }
110 return false; 110 return false;
111 } 111 }
112 112
113 113
114 bool TypeFeedbackOracle::LoadIsMegamorphicWithTypeInfo(Property* expr) { 114 bool TypeFeedbackOracle::LoadIsPolymorphic(Property* expr) {
115 Handle<Object> map_or_code = GetInfo(expr->PropertyFeedbackId()); 115 Handle<Object> map_or_code = GetInfo(expr->PropertyFeedbackId());
116 if (map_or_code->IsCode()) { 116 if (map_or_code->IsCode()) {
117 Handle<Code> code = Handle<Code>::cast(map_or_code); 117 Handle<Code> code = Handle<Code>::cast(map_or_code);
118 Builtins* builtins = isolate_->builtins(); 118 return code->is_keyed_load_stub() && code->ic_state() == POLYMORPHIC;
119 return code->is_keyed_load_stub() &&
120 *code != builtins->builtin(Builtins::kKeyedLoadIC_Generic) &&
121 code->ic_state() == MEGAMORPHIC;
122 } 119 }
123 return false; 120 return false;
124 } 121 }
125 122
126 123
127 bool TypeFeedbackOracle::StoreIsMonomorphicNormal(TypeFeedbackId ast_id) { 124 bool TypeFeedbackOracle::StoreIsMonomorphicNormal(TypeFeedbackId ast_id) {
128 Handle<Object> map_or_code = GetInfo(ast_id); 125 Handle<Object> map_or_code = GetInfo(ast_id);
129 if (map_or_code->IsMap()) return true; 126 if (map_or_code->IsMap()) return true;
130 if (map_or_code->IsCode()) { 127 if (map_or_code->IsCode()) {
131 Handle<Code> code = Handle<Code>::cast(map_or_code); 128 Handle<Code> code = Handle<Code>::cast(map_or_code);
132 bool allow_growth = 129 bool allow_growth =
133 Code::GetKeyedAccessGrowMode(code->extra_ic_state()) == 130 Code::GetKeyedAccessGrowMode(code->extra_ic_state()) ==
134 ALLOW_JSARRAY_GROWTH; 131 ALLOW_JSARRAY_GROWTH;
135 bool preliminary_checks = 132 bool preliminary_checks =
136 code->is_keyed_store_stub() && 133 code->is_keyed_store_stub() &&
137 !allow_growth && 134 !allow_growth &&
138 code->ic_state() == MONOMORPHIC && 135 code->ic_state() == MONOMORPHIC &&
139 Code::ExtractTypeFromFlags(code->flags()) == Code::NORMAL; 136 Code::ExtractTypeFromFlags(code->flags()) == Code::NORMAL;
140 if (!preliminary_checks) return false; 137 if (!preliminary_checks) return false;
141 Map* map = code->FindFirstMap(); 138 Map* map = code->FindFirstMap();
142 return map != NULL && !CanRetainOtherContext(map, *native_context_); 139 return map != NULL && !CanRetainOtherContext(map, *native_context_);
143 } 140 }
144 return false; 141 return false;
145 } 142 }
146 143
147 144
148 bool TypeFeedbackOracle::StoreIsMegamorphicWithTypeInfo(TypeFeedbackId ast_id) { 145 bool TypeFeedbackOracle::StoreIsPolymorphic(TypeFeedbackId ast_id) {
149 Handle<Object> map_or_code = GetInfo(ast_id); 146 Handle<Object> map_or_code = GetInfo(ast_id);
150 if (map_or_code->IsCode()) { 147 if (map_or_code->IsCode()) {
151 Handle<Code> code = Handle<Code>::cast(map_or_code); 148 Handle<Code> code = Handle<Code>::cast(map_or_code);
152 Builtins* builtins = isolate_->builtins();
153 bool allow_growth = 149 bool allow_growth =
154 Code::GetKeyedAccessGrowMode(code->extra_ic_state()) == 150 Code::GetKeyedAccessGrowMode(code->extra_ic_state()) ==
155 ALLOW_JSARRAY_GROWTH; 151 ALLOW_JSARRAY_GROWTH;
156 return code->is_keyed_store_stub() && 152 return code->is_keyed_store_stub() && !allow_growth &&
157 !allow_growth && 153 code->ic_state() == POLYMORPHIC;
158 *code != builtins->builtin(Builtins::kKeyedStoreIC_Generic) &&
159 *code != builtins->builtin(Builtins::kKeyedStoreIC_Generic_Strict) &&
160 code->ic_state() == MEGAMORPHIC;
161 } 154 }
162 return false; 155 return false;
163 } 156 }
164 157
165 158
166 bool TypeFeedbackOracle::CallIsMonomorphic(Call* expr) { 159 bool TypeFeedbackOracle::CallIsMonomorphic(Call* expr) {
167 Handle<Object> value = GetInfo(expr->CallFeedbackId()); 160 Handle<Object> value = GetInfo(expr->CallFeedbackId());
168 return value->IsMap() || value->IsSmi() || value->IsJSFunction(); 161 return value->IsMap() || value->IsSmi() || value->IsJSFunction();
169 } 162 }
170 163
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 } 653 }
661 } 654 }
662 } else { 655 } else {
663 SetInfo(ast_id, target); 656 SetInfo(ast_id, target);
664 } 657 }
665 break; 658 break;
666 659
667 case Code::KEYED_LOAD_IC: 660 case Code::KEYED_LOAD_IC:
668 case Code::KEYED_STORE_IC: 661 case Code::KEYED_STORE_IC:
669 if (target->ic_state() == MONOMORPHIC || 662 if (target->ic_state() == MONOMORPHIC ||
670 target->ic_state() == MEGAMORPHIC) { 663 target->ic_state() == POLYMORPHIC) {
671 SetInfo(ast_id, target); 664 SetInfo(ast_id, target);
672 } 665 }
673 break; 666 break;
674 667
675 case Code::UNARY_OP_IC: 668 case Code::UNARY_OP_IC:
676 case Code::BINARY_OP_IC: 669 case Code::BINARY_OP_IC:
677 case Code::COMPARE_IC: 670 case Code::COMPARE_IC:
678 case Code::TO_BOOLEAN_IC: 671 case Code::TO_BOOLEAN_IC:
679 SetInfo(ast_id, target); 672 SetInfo(ast_id, target);
680 break; 673 break;
(...skipping 30 matching lines...) Expand all
711 USE(maybe_result); 704 USE(maybe_result);
712 #ifdef DEBUG 705 #ifdef DEBUG
713 Object* result = NULL; 706 Object* result = NULL;
714 // Dictionary has been allocated with sufficient size for all elements. 707 // Dictionary has been allocated with sufficient size for all elements.
715 ASSERT(maybe_result->ToObject(&result)); 708 ASSERT(maybe_result->ToObject(&result));
716 ASSERT(*dictionary_ == result); 709 ASSERT(*dictionary_ == result);
717 #endif 710 #endif
718 } 711 }
719 712
720 } } // namespace v8::internal 713 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/type-info.h ('k') | src/x64/stub-cache-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698