Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1169 present_flags_.RemoveAll(); | 1169 present_flags_.RemoveAll(); |
| 1170 for (int i = 0; i < array_size_; ++i) { | 1170 for (int i = 0; i < array_size_; ++i) { |
| 1171 HValue* value = array_[i].value; | 1171 HValue* value = array_[i].value; |
| 1172 if (value != NULL) { | 1172 if (value != NULL) { |
| 1173 // Clear list of collisions first, so we know if it becomes empty. | 1173 // Clear list of collisions first, so we know if it becomes empty. |
| 1174 int kept = kNil; // List of kept elements. | 1174 int kept = kNil; // List of kept elements. |
| 1175 int next; | 1175 int next; |
| 1176 for (int current = array_[i].next; current != kNil; current = next) { | 1176 for (int current = array_[i].next; current != kNil; current = next) { |
| 1177 next = lists_[current].next; | 1177 next = lists_[current].next; |
| 1178 HValue* value = lists_[current].value; | 1178 HValue* value = lists_[current].value; |
| 1179 if (value->gvn_flags().ContainsAnyOf(depends_flags)) { | 1179 if (value->gvn_flags().ContainsAnyOf(depends_flags)) { |
|
fschneider
2012/02/16 13:50:51
You'd also need to handle TransitionElementsKind s
| |
| 1180 // Drop it. | 1180 // Drop it. |
| 1181 count_--; | 1181 count_--; |
| 1182 lists_[current].next = free_list_head_; | 1182 lists_[current].next = free_list_head_; |
| 1183 free_list_head_ = current; | 1183 free_list_head_ = current; |
| 1184 } else { | 1184 } else { |
| 1185 // Keep it. | 1185 // Keep it. |
| 1186 lists_[current].next = kept; | 1186 lists_[current].next = kept; |
| 1187 kept = current; | 1187 kept = current; |
| 1188 present_flags_.Add(value->gvn_flags()); | 1188 present_flags_.Add(value->gvn_flags()); |
| 1189 } | 1189 } |
| 1190 } | 1190 } |
| 1191 array_[i].next = kept; | 1191 array_[i].next = kept; |
| 1192 | 1192 |
| 1193 // Now possibly drop directly indexed element. | 1193 // Now possibly drop directly indexed element. |
| 1194 value = array_[i].value; | 1194 value = array_[i].value; |
| 1195 if (value->gvn_flags().ContainsAnyOf(depends_flags)) { // Drop it. | 1195 // Remove a value from the value map is one of its dependencies has been |
| 1196 // changed, unless it's a TransitionElementsKind, in which case it's safe | |
| 1197 // to keep it. TransitionElementsKinds that are dominated by another | |
| 1198 // equivalent transition, even if there is an intervening side-effect. | |
| 1199 // TransitionElementsKind only has a one-time side effect, so all | |
| 1200 // subsequent Transitions are no-ops, even if there are other side effects | |
| 1201 // in between. | |
| 1202 if (value->gvn_flags().ContainsAnyOf(depends_flags) && | |
| 1203 !value->IsTransitionElementsKind()) { // Drop it. | |
| 1196 count_--; | 1204 count_--; |
| 1197 int head = array_[i].next; | 1205 int head = array_[i].next; |
| 1198 if (head == kNil) { | 1206 if (head == kNil) { |
| 1199 array_[i].value = NULL; | 1207 array_[i].value = NULL; |
| 1200 } else { | 1208 } else { |
| 1201 array_[i].value = lists_[head].value; | 1209 array_[i].value = lists_[head].value; |
| 1202 array_[i].next = lists_[head].next; | 1210 array_[i].next = lists_[head].next; |
| 1203 lists_[head].next = free_list_head_; | 1211 lists_[head].next = free_list_head_; |
| 1204 free_list_head_ = head; | 1212 free_list_head_ = head; |
| 1205 } | 1213 } |
| (...skipping 3241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4447 map->FindTransitionedMap(&possible_transitioned_maps); | 4455 map->FindTransitionedMap(&possible_transitioned_maps); |
| 4448 transition_target.Add(transitioned_map); | 4456 transition_target.Add(transitioned_map); |
| 4449 } | 4457 } |
| 4450 | 4458 |
| 4451 int num_untransitionable_maps = 0; | 4459 int num_untransitionable_maps = 0; |
| 4452 Handle<Map> untransitionable_map; | 4460 Handle<Map> untransitionable_map; |
| 4453 for (int i = 0; i < maps->length(); ++i) { | 4461 for (int i = 0; i < maps->length(); ++i) { |
| 4454 Handle<Map> map = maps->at(i); | 4462 Handle<Map> map = maps->at(i); |
| 4455 ASSERT(map->IsMap()); | 4463 ASSERT(map->IsMap()); |
| 4456 if (!transition_target.at(i).is_null()) { | 4464 if (!transition_target.at(i).is_null()) { |
| 4457 object = AddInstruction(new(zone()) HTransitionElementsKind( | 4465 AddInstruction(new(zone()) HTransitionElementsKind( |
| 4458 object, map, transition_target.at(i))); | 4466 object, map, transition_target.at(i))); |
| 4459 } else { | 4467 } else { |
| 4460 type_todo[map->elements_kind()] = true; | 4468 type_todo[map->elements_kind()] = true; |
| 4461 if (map->elements_kind() >= FIRST_EXTERNAL_ARRAY_ELEMENTS_KIND) { | 4469 if (map->elements_kind() >= FIRST_EXTERNAL_ARRAY_ELEMENTS_KIND) { |
| 4462 todo_external_array = true; | 4470 todo_external_array = true; |
| 4463 } | 4471 } |
| 4464 num_untransitionable_maps++; | 4472 num_untransitionable_maps++; |
| 4465 untransitionable_map = map; | 4473 untransitionable_map = map; |
| 4466 } | 4474 } |
| 4467 } | 4475 } |
| (...skipping 3239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7707 } | 7715 } |
| 7708 } | 7716 } |
| 7709 | 7717 |
| 7710 #ifdef DEBUG | 7718 #ifdef DEBUG |
| 7711 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 7719 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
| 7712 if (allocator_ != NULL) allocator_->Verify(); | 7720 if (allocator_ != NULL) allocator_->Verify(); |
| 7713 #endif | 7721 #endif |
| 7714 } | 7722 } |
| 7715 | 7723 |
| 7716 } } // namespace v8::internal | 7724 } } // namespace v8::internal |
| OLD | NEW |