| 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 4083 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4094 AddInstruction(HCheckInstanceType::NewIsSpecObject(object)); | 4094 AddInstruction(HCheckInstanceType::NewIsSpecObject(object)); |
| 4095 SmallMapList* maps = prop->GetReceiverTypes(); | 4095 SmallMapList* maps = prop->GetReceiverTypes(); |
| 4096 bool todo_external_array = false; | 4096 bool todo_external_array = false; |
| 4097 | 4097 |
| 4098 static const int kNumElementTypes = kElementsKindCount; | 4098 static const int kNumElementTypes = kElementsKindCount; |
| 4099 bool type_todo[kNumElementTypes]; | 4099 bool type_todo[kNumElementTypes]; |
| 4100 for (int i = 0; i < kNumElementTypes; ++i) { | 4100 for (int i = 0; i < kNumElementTypes; ++i) { |
| 4101 type_todo[i] = false; | 4101 type_todo[i] = false; |
| 4102 } | 4102 } |
| 4103 | 4103 |
| 4104 for (int i = 0; i < maps->length(); ++i) { | 4104 // Elements_kind transition support. |
| 4105 ASSERT(maps->at(i)->IsMap()); | 4105 MapList transition_target(maps->length()); |
| 4106 type_todo[maps->at(i)->elements_kind()] = true; | 4106 if (is_store) { |
| 4107 if (maps->at(i)->elements_kind() | 4107 // Collect possible transition targets. |
| 4108 >= FIRST_EXTERNAL_ARRAY_ELEMENTS_KIND) { | 4108 MapList possible_transitioned_maps(maps->length()); |
| 4109 todo_external_array = true; | 4109 for (int i = 0; i < maps->length(); ++i) { |
| 4110 Handle<Map> map = maps->at(i); |
| 4111 ElementsKind elements_kind = map->elements_kind(); |
| 4112 if (elements_kind == FAST_DOUBLE_ELEMENTS || |
| 4113 elements_kind == FAST_ELEMENTS) { |
| 4114 possible_transitioned_maps.Add(*map); |
| 4115 } |
| 4116 } |
| 4117 // Get transition target for each map (NULL == no transition). |
| 4118 for (int i = 0; i < maps->length(); ++i) { |
| 4119 Handle<Map> map = maps->at(i); |
| 4120 Map* transitioned_map = |
| 4121 map->FindTransitionedMap(&possible_transitioned_maps); |
| 4122 transition_target.Add(transitioned_map); |
| 4110 } | 4123 } |
| 4111 } | 4124 } |
| 4112 | 4125 |
| 4126 for (int i = 0; i < maps->length(); ++i) { |
| 4127 Handle<Map> map = maps->at(i); |
| 4128 ASSERT(map->IsMap()); |
| 4129 ASSERT(!is_store || (transition_target.length() == maps->length())); |
| 4130 if (is_store && transition_target.at(i) != NULL) { |
| 4131 object = AddInstruction(new(zone()) HTransitionElementsKind( |
| 4132 object, map, Handle<Map>(transition_target.at(i)))); |
| 4133 } else { |
| 4134 type_todo[map->elements_kind()] = true; |
| 4135 if (map->elements_kind() >= FIRST_EXTERNAL_ARRAY_ELEMENTS_KIND) { |
| 4136 todo_external_array = true; |
| 4137 } |
| 4138 } |
| 4139 } |
| 4140 |
| 4113 HBasicBlock* join = graph()->CreateBasicBlock(); | 4141 HBasicBlock* join = graph()->CreateBasicBlock(); |
| 4114 | 4142 |
| 4115 HInstruction* elements_kind_instr = | 4143 HInstruction* elements_kind_instr = |
| 4116 AddInstruction(new(zone()) HElementsKind(object)); | 4144 AddInstruction(new(zone()) HElementsKind(object)); |
| 4117 HCompareConstantEqAndBranch* elements_kind_branch = NULL; | 4145 HCompareConstantEqAndBranch* elements_kind_branch = NULL; |
| 4118 HInstruction* elements = AddInstruction(new(zone()) HLoadElements(object)); | 4146 HInstruction* elements = AddInstruction(new(zone()) HLoadElements(object)); |
| 4119 HLoadExternalArrayPointer* external_elements = NULL; | 4147 HLoadExternalArrayPointer* external_elements = NULL; |
| 4120 HInstruction* checked_key = NULL; | 4148 HInstruction* checked_key = NULL; |
| 4121 | 4149 |
| 4122 // Generated code assumes that FAST_SMI_ONLY_ELEMENTS, FAST_ELEMENTS, | 4150 // Generated code assumes that FAST_SMI_ONLY_ELEMENTS, FAST_ELEMENTS, |
| (...skipping 2816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6939 } | 6967 } |
| 6940 } | 6968 } |
| 6941 | 6969 |
| 6942 #ifdef DEBUG | 6970 #ifdef DEBUG |
| 6943 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 6971 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
| 6944 if (allocator_ != NULL) allocator_->Verify(); | 6972 if (allocator_ != NULL) allocator_->Verify(); |
| 6945 #endif | 6973 #endif |
| 6946 } | 6974 } |
| 6947 | 6975 |
| 6948 } } // namespace v8::internal | 6976 } } // namespace v8::internal |
| OLD | NEW |