OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "hydrogen.h" | 5 #include "hydrogen.h" |
6 #include "hydrogen-gvn.h" | 6 #include "hydrogen-gvn.h" |
7 #include "v8.h" | 7 #include "v8.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 | 133 |
134 HInstructionMap::HInstructionMap(Zone* zone, const HInstructionMap* other) | 134 HInstructionMap::HInstructionMap(Zone* zone, const HInstructionMap* other) |
135 : array_size_(other->array_size_), | 135 : array_size_(other->array_size_), |
136 lists_size_(other->lists_size_), | 136 lists_size_(other->lists_size_), |
137 count_(other->count_), | 137 count_(other->count_), |
138 present_depends_on_(other->present_depends_on_), | 138 present_depends_on_(other->present_depends_on_), |
139 array_(zone->NewArray<HInstructionMapListElement>(other->array_size_)), | 139 array_(zone->NewArray<HInstructionMapListElement>(other->array_size_)), |
140 lists_(zone->NewArray<HInstructionMapListElement>(other->lists_size_)), | 140 lists_(zone->NewArray<HInstructionMapListElement>(other->lists_size_)), |
141 free_list_head_(other->free_list_head_), | 141 free_list_head_(other->free_list_head_), |
142 side_effects_tracker_(other->side_effects_tracker_) { | 142 side_effects_tracker_(other->side_effects_tracker_) { |
143 OS::MemCopy( | 143 MemCopy(array_, other->array_, |
144 array_, other->array_, array_size_ * sizeof(HInstructionMapListElement)); | 144 array_size_ * sizeof(HInstructionMapListElement)); |
145 OS::MemCopy( | 145 MemCopy(lists_, other->lists_, |
146 lists_, other->lists_, lists_size_ * sizeof(HInstructionMapListElement)); | 146 lists_size_ * sizeof(HInstructionMapListElement)); |
147 } | 147 } |
148 | 148 |
149 | 149 |
150 void HInstructionMap::Kill(SideEffects changes) { | 150 void HInstructionMap::Kill(SideEffects changes) { |
151 if (!present_depends_on_.ContainsAnyOf(changes)) return; | 151 if (!present_depends_on_.ContainsAnyOf(changes)) return; |
152 present_depends_on_.RemoveAll(); | 152 present_depends_on_.RemoveAll(); |
153 for (int i = 0; i < array_size_; ++i) { | 153 for (int i = 0; i < array_size_; ++i) { |
154 HInstruction* instr = array_[i].instr; | 154 HInstruction* instr = array_[i].instr; |
155 if (instr != NULL) { | 155 if (instr != NULL) { |
156 // Clear list of collisions first, so we know if it becomes empty. | 156 // Clear list of collisions first, so we know if it becomes empty. |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 zone->NewArray<HInstructionMapListElement>(new_size); | 263 zone->NewArray<HInstructionMapListElement>(new_size); |
264 memset(new_lists, 0, sizeof(HInstructionMapListElement) * new_size); | 264 memset(new_lists, 0, sizeof(HInstructionMapListElement) * new_size); |
265 | 265 |
266 HInstructionMapListElement* old_lists = lists_; | 266 HInstructionMapListElement* old_lists = lists_; |
267 int old_size = lists_size_; | 267 int old_size = lists_size_; |
268 | 268 |
269 lists_size_ = new_size; | 269 lists_size_ = new_size; |
270 lists_ = new_lists; | 270 lists_ = new_lists; |
271 | 271 |
272 if (old_lists != NULL) { | 272 if (old_lists != NULL) { |
273 OS::MemCopy( | 273 MemCopy(lists_, old_lists, old_size * sizeof(HInstructionMapListElement)); |
274 lists_, old_lists, old_size * sizeof(HInstructionMapListElement)); | |
275 } | 274 } |
276 for (int i = old_size; i < lists_size_; ++i) { | 275 for (int i = old_size; i < lists_size_; ++i) { |
277 lists_[i].next = free_list_head_; | 276 lists_[i].next = free_list_head_; |
278 free_list_head_ = i; | 277 free_list_head_ = i; |
279 } | 278 } |
280 } | 279 } |
281 | 280 |
282 | 281 |
283 void HInstructionMap::Insert(HInstruction* instr, Zone* zone) { | 282 void HInstructionMap::Insert(HInstruction* instr, Zone* zone) { |
284 ASSERT(instr != NULL); | 283 ASSERT(instr != NULL); |
(...skipping 23 matching lines...) Expand all Loading... |
308 HSideEffectMap::HSideEffectMap() : count_(0) { | 307 HSideEffectMap::HSideEffectMap() : count_(0) { |
309 memset(data_, 0, kNumberOfTrackedSideEffects * kPointerSize); | 308 memset(data_, 0, kNumberOfTrackedSideEffects * kPointerSize); |
310 } | 309 } |
311 | 310 |
312 | 311 |
313 HSideEffectMap::HSideEffectMap(HSideEffectMap* other) : count_(other->count_) { | 312 HSideEffectMap::HSideEffectMap(HSideEffectMap* other) : count_(other->count_) { |
314 *this = *other; // Calls operator=. | 313 *this = *other; // Calls operator=. |
315 } | 314 } |
316 | 315 |
317 | 316 |
318 HSideEffectMap& HSideEffectMap::operator= (const HSideEffectMap& other) { | 317 HSideEffectMap& HSideEffectMap::operator=(const HSideEffectMap& other) { |
319 if (this != &other) { | 318 if (this != &other) { |
320 OS::MemCopy(data_, other.data_, kNumberOfTrackedSideEffects * kPointerSize); | 319 MemCopy(data_, other.data_, kNumberOfTrackedSideEffects * kPointerSize); |
321 } | 320 } |
322 return *this; | 321 return *this; |
323 } | 322 } |
324 | 323 |
325 | 324 |
326 void HSideEffectMap::Kill(SideEffects side_effects) { | 325 void HSideEffectMap::Kill(SideEffects side_effects) { |
327 for (int i = 0; i < kNumberOfTrackedSideEffects; i++) { | 326 for (int i = 0; i < kNumberOfTrackedSideEffects; i++) { |
328 if (side_effects.ContainsFlag(GVNFlagFromInt(i))) { | 327 if (side_effects.ContainsFlag(GVNFlagFromInt(i))) { |
329 if (data_[i] != NULL) count_--; | 328 if (data_[i] != NULL) count_--; |
330 data_[i] = NULL; | 329 data_[i] = NULL; |
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
905 dominated); | 904 dominated); |
906 successor_map->Kill(side_effects_on_all_paths); | 905 successor_map->Kill(side_effects_on_all_paths); |
907 successor_dominators->Kill(side_effects_on_all_paths); | 906 successor_dominators->Kill(side_effects_on_all_paths); |
908 } | 907 } |
909 } | 908 } |
910 current = next; | 909 current = next; |
911 } | 910 } |
912 } | 911 } |
913 | 912 |
914 } } // namespace v8::internal | 913 } } // namespace v8::internal |
OLD | NEW |