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 2464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2475 | 2475 |
2476 | 2476 |
2477 HValueMap::HValueMap(Zone* zone, const HValueMap* other) | 2477 HValueMap::HValueMap(Zone* zone, const HValueMap* other) |
2478 : array_size_(other->array_size_), | 2478 : array_size_(other->array_size_), |
2479 lists_size_(other->lists_size_), | 2479 lists_size_(other->lists_size_), |
2480 count_(other->count_), | 2480 count_(other->count_), |
2481 present_flags_(other->present_flags_), | 2481 present_flags_(other->present_flags_), |
2482 array_(zone->NewArray<HValueMapListElement>(other->array_size_)), | 2482 array_(zone->NewArray<HValueMapListElement>(other->array_size_)), |
2483 lists_(zone->NewArray<HValueMapListElement>(other->lists_size_)), | 2483 lists_(zone->NewArray<HValueMapListElement>(other->lists_size_)), |
2484 free_list_head_(other->free_list_head_) { | 2484 free_list_head_(other->free_list_head_) { |
2485 memcpy(array_, other->array_, array_size_ * sizeof(HValueMapListElement)); | 2485 OS::MemCopy( |
2486 memcpy(lists_, other->lists_, lists_size_ * sizeof(HValueMapListElement)); | 2486 array_, other->array_, array_size_ * sizeof(HValueMapListElement)); |
| 2487 OS::MemCopy( |
| 2488 lists_, other->lists_, lists_size_ * sizeof(HValueMapListElement)); |
2487 } | 2489 } |
2488 | 2490 |
2489 | 2491 |
2490 void HValueMap::Kill(GVNFlagSet flags) { | 2492 void HValueMap::Kill(GVNFlagSet flags) { |
2491 GVNFlagSet depends_flags = HValue::ConvertChangesToDependsFlags(flags); | 2493 GVNFlagSet depends_flags = HValue::ConvertChangesToDependsFlags(flags); |
2492 if (!present_flags_.ContainsAnyOf(depends_flags)) return; | 2494 if (!present_flags_.ContainsAnyOf(depends_flags)) return; |
2493 present_flags_.RemoveAll(); | 2495 present_flags_.RemoveAll(); |
2494 for (int i = 0; i < array_size_; ++i) { | 2496 for (int i = 0; i < array_size_; ++i) { |
2495 HValue* value = array_[i].value; | 2497 HValue* value = array_[i].value; |
2496 if (value != NULL) { | 2498 if (value != NULL) { |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2602 zone->NewArray<HValueMapListElement>(new_size); | 2604 zone->NewArray<HValueMapListElement>(new_size); |
2603 memset(new_lists, 0, sizeof(HValueMapListElement) * new_size); | 2605 memset(new_lists, 0, sizeof(HValueMapListElement) * new_size); |
2604 | 2606 |
2605 HValueMapListElement* old_lists = lists_; | 2607 HValueMapListElement* old_lists = lists_; |
2606 int old_size = lists_size_; | 2608 int old_size = lists_size_; |
2607 | 2609 |
2608 lists_size_ = new_size; | 2610 lists_size_ = new_size; |
2609 lists_ = new_lists; | 2611 lists_ = new_lists; |
2610 | 2612 |
2611 if (old_lists != NULL) { | 2613 if (old_lists != NULL) { |
2612 memcpy(lists_, old_lists, old_size * sizeof(HValueMapListElement)); | 2614 OS::MemCopy(lists_, old_lists, old_size * sizeof(HValueMapListElement)); |
2613 } | 2615 } |
2614 for (int i = old_size; i < lists_size_; ++i) { | 2616 for (int i = old_size; i < lists_size_; ++i) { |
2615 lists_[i].next = free_list_head_; | 2617 lists_[i].next = free_list_head_; |
2616 free_list_head_ = i; | 2618 free_list_head_ = i; |
2617 } | 2619 } |
2618 } | 2620 } |
2619 | 2621 |
2620 | 2622 |
2621 void HValueMap::Insert(HValue* value, Zone* zone) { | 2623 void HValueMap::Insert(HValue* value, Zone* zone) { |
2622 ASSERT(value != NULL); | 2624 ASSERT(value != NULL); |
(...skipping 25 matching lines...) Expand all Loading... |
2648 } | 2650 } |
2649 | 2651 |
2650 | 2652 |
2651 HSideEffectMap::HSideEffectMap(HSideEffectMap* other) : count_(other->count_) { | 2653 HSideEffectMap::HSideEffectMap(HSideEffectMap* other) : count_(other->count_) { |
2652 *this = *other; // Calls operator=. | 2654 *this = *other; // Calls operator=. |
2653 } | 2655 } |
2654 | 2656 |
2655 | 2657 |
2656 HSideEffectMap& HSideEffectMap::operator= (const HSideEffectMap& other) { | 2658 HSideEffectMap& HSideEffectMap::operator= (const HSideEffectMap& other) { |
2657 if (this != &other) { | 2659 if (this != &other) { |
2658 memcpy(data_, other.data_, kNumberOfTrackedSideEffects * kPointerSize); | 2660 OS::MemCopy(data_, other.data_, kNumberOfTrackedSideEffects * kPointerSize); |
2659 } | 2661 } |
2660 return *this; | 2662 return *this; |
2661 } | 2663 } |
2662 | 2664 |
2663 void HSideEffectMap::Kill(GVNFlagSet flags) { | 2665 void HSideEffectMap::Kill(GVNFlagSet flags) { |
2664 for (int i = 0; i < kNumberOfTrackedSideEffects; i++) { | 2666 for (int i = 0; i < kNumberOfTrackedSideEffects; i++) { |
2665 GVNFlag changes_flag = HValue::ChangesFlagFromInt(i); | 2667 GVNFlag changes_flag = HValue::ChangesFlagFromInt(i); |
2666 if (flags.Contains(changes_flag)) { | 2668 if (flags.Contains(changes_flag)) { |
2667 if (data_[i] != NULL) count_--; | 2669 if (data_[i] != NULL) count_--; |
2668 data_[i] = NULL; | 2670 data_[i] = NULL; |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2946 } | 2948 } |
2947 } | 2949 } |
2948 offset += OS::SNPrintF(buffer + offset, "]"); | 2950 offset += OS::SNPrintF(buffer + offset, "]"); |
2949 } | 2951 } |
2950 #else | 2952 #else |
2951 OS::SNPrintF(buffer, "0x%08X", flags.ToIntegral()); | 2953 OS::SNPrintF(buffer, "0x%08X", flags.ToIntegral()); |
2952 #endif | 2954 #endif |
2953 size_t string_len = strlen(underlying_buffer) + 1; | 2955 size_t string_len = strlen(underlying_buffer) + 1; |
2954 ASSERT(string_len <= sizeof(underlying_buffer)); | 2956 ASSERT(string_len <= sizeof(underlying_buffer)); |
2955 char* result = new char[strlen(underlying_buffer) + 1]; | 2957 char* result = new char[strlen(underlying_buffer) + 1]; |
2956 memcpy(result, underlying_buffer, string_len); | 2958 OS::MemCopy(result, underlying_buffer, string_len); |
2957 return SmartArrayPointer<char>(result); | 2959 return SmartArrayPointer<char>(result); |
2958 } | 2960 } |
2959 | 2961 |
2960 | 2962 |
2961 void HGlobalValueNumberer::LoopInvariantCodeMotion() { | 2963 void HGlobalValueNumberer::LoopInvariantCodeMotion() { |
2962 TRACE_GVN_1("Using optimistic loop invariant code motion: %s\n", | 2964 TRACE_GVN_1("Using optimistic loop invariant code motion: %s\n", |
2963 graph_->use_optimistic_licm() ? "yes" : "no"); | 2965 graph_->use_optimistic_licm() ? "yes" : "no"); |
2964 for (int i = graph_->blocks()->length() - 1; i >= 0; --i) { | 2966 for (int i = graph_->blocks()->length() - 1; i >= 0; --i) { |
2965 HBasicBlock* block = graph_->blocks()->at(i); | 2967 HBasicBlock* block = graph_->blocks()->at(i); |
2966 if (block->IsLoopHeader()) { | 2968 if (block->IsLoopHeader()) { |
(...skipping 8690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11657 } | 11659 } |
11658 } | 11660 } |
11659 | 11661 |
11660 #ifdef DEBUG | 11662 #ifdef DEBUG |
11661 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 11663 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
11662 if (allocator_ != NULL) allocator_->Verify(); | 11664 if (allocator_ != NULL) allocator_->Verify(); |
11663 #endif | 11665 #endif |
11664 } | 11666 } |
11665 | 11667 |
11666 } } // namespace v8::internal | 11668 } } // namespace v8::internal |
OLD | NEW |