OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 4078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4089 bool todo_external_array = false; | 4089 bool todo_external_array = false; |
4090 | 4090 |
4091 static const int kNumElementTypes = kElementsKindCount; | 4091 static const int kNumElementTypes = kElementsKindCount; |
4092 bool type_todo[kNumElementTypes]; | 4092 bool type_todo[kNumElementTypes]; |
4093 for (int i = 0; i < kNumElementTypes; ++i) { | 4093 for (int i = 0; i < kNumElementTypes; ++i) { |
4094 type_todo[i] = false; | 4094 type_todo[i] = false; |
4095 } | 4095 } |
4096 | 4096 |
4097 // Elements_kind transition support. | 4097 // Elements_kind transition support. |
4098 MapList transition_target(maps->length()); | 4098 MapList transition_target(maps->length()); |
4099 if (is_store) { | 4099 // Collect possible transition targets. |
4100 // Collect possible transition targets. | 4100 MapList possible_transitioned_maps(maps->length()); |
4101 MapList possible_transitioned_maps(maps->length()); | 4101 for (int i = 0; i < maps->length(); ++i) { |
4102 for (int i = 0; i < maps->length(); ++i) { | 4102 Handle<Map> map = maps->at(i); |
4103 Handle<Map> map = maps->at(i); | 4103 ElementsKind elements_kind = map->elements_kind(); |
4104 ElementsKind elements_kind = map->elements_kind(); | 4104 if (elements_kind == FAST_DOUBLE_ELEMENTS || |
4105 if (elements_kind == FAST_DOUBLE_ELEMENTS || | 4105 elements_kind == FAST_ELEMENTS) { |
4106 elements_kind == FAST_ELEMENTS) { | 4106 possible_transitioned_maps.Add(*map); |
4107 possible_transitioned_maps.Add(*map); | |
4108 } | |
4109 } | 4107 } |
4110 // Get transition target for each map (NULL == no transition). | 4108 } |
4111 for (int i = 0; i < maps->length(); ++i) { | 4109 // Get transition target for each map (NULL == no transition). |
4112 Handle<Map> map = maps->at(i); | 4110 for (int i = 0; i < maps->length(); ++i) { |
4113 Map* transitioned_map = | 4111 Handle<Map> map = maps->at(i); |
4114 map->FindTransitionedMap(&possible_transitioned_maps); | 4112 Map* transitioned_map = |
4115 transition_target.Add(transitioned_map); | 4113 map->FindTransitionedMap(&possible_transitioned_maps); |
4116 } | 4114 transition_target.Add(transitioned_map); |
4117 } | 4115 } |
4118 | 4116 |
4119 int num_untransitionable_maps = 0; | 4117 int num_untransitionable_maps = 0; |
4120 Handle<Map> untransitionable_map; | 4118 Handle<Map> untransitionable_map; |
4121 for (int i = 0; i < maps->length(); ++i) { | 4119 for (int i = 0; i < maps->length(); ++i) { |
4122 Handle<Map> map = maps->at(i); | 4120 Handle<Map> map = maps->at(i); |
4123 ASSERT(map->IsMap()); | 4121 ASSERT(map->IsMap()); |
4124 ASSERT(!is_store || (transition_target.length() == maps->length())); | 4122 if (transition_target.at(i) != NULL) { |
4125 if (is_store && transition_target.at(i) != NULL) { | |
4126 object = AddInstruction(new(zone()) HTransitionElementsKind( | 4123 object = AddInstruction(new(zone()) HTransitionElementsKind( |
4127 object, map, Handle<Map>(transition_target.at(i)))); | 4124 object, map, Handle<Map>(transition_target.at(i)))); |
4128 } else { | 4125 } else { |
4129 type_todo[map->elements_kind()] = true; | 4126 type_todo[map->elements_kind()] = true; |
4130 if (map->elements_kind() >= FIRST_EXTERNAL_ARRAY_ELEMENTS_KIND) { | 4127 if (map->elements_kind() >= FIRST_EXTERNAL_ARRAY_ELEMENTS_KIND) { |
4131 todo_external_array = true; | 4128 todo_external_array = true; |
4132 } | 4129 } |
4133 num_untransitionable_maps++; | 4130 num_untransitionable_maps++; |
4134 untransitionable_map = map; | 4131 untransitionable_map = map; |
4135 } | 4132 } |
(...skipping 2880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7016 } | 7013 } |
7017 } | 7014 } |
7018 | 7015 |
7019 #ifdef DEBUG | 7016 #ifdef DEBUG |
7020 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 7017 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
7021 if (allocator_ != NULL) allocator_->Verify(); | 7018 if (allocator_ != NULL) allocator_->Verify(); |
7022 #endif | 7019 #endif |
7023 } | 7020 } |
7024 | 7021 |
7025 } } // namespace v8::internal | 7022 } } // namespace v8::internal |
OLD | NEW |