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 MemCopy(array_, other->array_, | 143 OS::MemCopy( |
144 array_size_ * sizeof(HInstructionMapListElement)); | 144 array_, other->array_, array_size_ * sizeof(HInstructionMapListElement)); |
145 MemCopy(lists_, other->lists_, | 145 OS::MemCopy( |
146 lists_size_ * sizeof(HInstructionMapListElement)); | 146 lists_, other->lists_, 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 MemCopy(lists_, old_lists, old_size * sizeof(HInstructionMapListElement)); | 273 OS::MemCopy( |
| 274 lists_, old_lists, old_size * sizeof(HInstructionMapListElement)); |
274 } | 275 } |
275 for (int i = old_size; i < lists_size_; ++i) { | 276 for (int i = old_size; i < lists_size_; ++i) { |
276 lists_[i].next = free_list_head_; | 277 lists_[i].next = free_list_head_; |
277 free_list_head_ = i; | 278 free_list_head_ = i; |
278 } | 279 } |
279 } | 280 } |
280 | 281 |
281 | 282 |
282 void HInstructionMap::Insert(HInstruction* instr, Zone* zone) { | 283 void HInstructionMap::Insert(HInstruction* instr, Zone* zone) { |
283 ASSERT(instr != NULL); | 284 ASSERT(instr != NULL); |
(...skipping 23 matching lines...) Expand all Loading... |
307 HSideEffectMap::HSideEffectMap() : count_(0) { | 308 HSideEffectMap::HSideEffectMap() : count_(0) { |
308 memset(data_, 0, kNumberOfTrackedSideEffects * kPointerSize); | 309 memset(data_, 0, kNumberOfTrackedSideEffects * kPointerSize); |
309 } | 310 } |
310 | 311 |
311 | 312 |
312 HSideEffectMap::HSideEffectMap(HSideEffectMap* other) : count_(other->count_) { | 313 HSideEffectMap::HSideEffectMap(HSideEffectMap* other) : count_(other->count_) { |
313 *this = *other; // Calls operator=. | 314 *this = *other; // Calls operator=. |
314 } | 315 } |
315 | 316 |
316 | 317 |
317 HSideEffectMap& HSideEffectMap::operator=(const HSideEffectMap& other) { | 318 HSideEffectMap& HSideEffectMap::operator= (const HSideEffectMap& other) { |
318 if (this != &other) { | 319 if (this != &other) { |
319 MemCopy(data_, other.data_, kNumberOfTrackedSideEffects * kPointerSize); | 320 OS::MemCopy(data_, other.data_, kNumberOfTrackedSideEffects * kPointerSize); |
320 } | 321 } |
321 return *this; | 322 return *this; |
322 } | 323 } |
323 | 324 |
324 | 325 |
325 void HSideEffectMap::Kill(SideEffects side_effects) { | 326 void HSideEffectMap::Kill(SideEffects side_effects) { |
326 for (int i = 0; i < kNumberOfTrackedSideEffects; i++) { | 327 for (int i = 0; i < kNumberOfTrackedSideEffects; i++) { |
327 if (side_effects.ContainsFlag(GVNFlagFromInt(i))) { | 328 if (side_effects.ContainsFlag(GVNFlagFromInt(i))) { |
328 if (data_[i] != NULL) count_--; | 329 if (data_[i] != NULL) count_--; |
329 data_[i] = NULL; | 330 data_[i] = NULL; |
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
904 dominated); | 905 dominated); |
905 successor_map->Kill(side_effects_on_all_paths); | 906 successor_map->Kill(side_effects_on_all_paths); |
906 successor_dominators->Kill(side_effects_on_all_paths); | 907 successor_dominators->Kill(side_effects_on_all_paths); |
907 } | 908 } |
908 } | 909 } |
909 current = next; | 910 current = next; |
910 } | 911 } |
911 } | 912 } |
912 | 913 |
913 } } // namespace v8::internal | 914 } } // namespace v8::internal |
OLD | NEW |