OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 }; | 116 }; |
117 | 117 |
118 | 118 |
119 void TraceGVN(const char* msg, ...) { | 119 void TraceGVN(const char* msg, ...) { |
120 va_list arguments; | 120 va_list arguments; |
121 va_start(arguments, msg); | 121 va_start(arguments, msg); |
122 OS::VPrint(msg, arguments); | 122 OS::VPrint(msg, arguments); |
123 va_end(arguments); | 123 va_end(arguments); |
124 } | 124 } |
125 | 125 |
| 126 |
126 // Wrap TraceGVN in macros to avoid the expense of evaluating its arguments when | 127 // Wrap TraceGVN in macros to avoid the expense of evaluating its arguments when |
127 // --trace-gvn is off. | 128 // --trace-gvn is off. |
128 #define TRACE_GVN_1(msg, a1) \ | 129 #define TRACE_GVN_1(msg, a1) \ |
129 if (FLAG_trace_gvn) { \ | 130 if (FLAG_trace_gvn) { \ |
130 TraceGVN(msg, a1); \ | 131 TraceGVN(msg, a1); \ |
131 } | 132 } |
132 | 133 |
133 #define TRACE_GVN_2(msg, a1, a2) \ | 134 #define TRACE_GVN_2(msg, a1, a2) \ |
134 if (FLAG_trace_gvn) { \ | 135 if (FLAG_trace_gvn) { \ |
135 TraceGVN(msg, a1, a2); \ | 136 TraceGVN(msg, a1, a2); \ |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 } | 333 } |
333 | 334 |
334 | 335 |
335 HSideEffectMap& HSideEffectMap::operator= (const HSideEffectMap& other) { | 336 HSideEffectMap& HSideEffectMap::operator= (const HSideEffectMap& other) { |
336 if (this != &other) { | 337 if (this != &other) { |
337 OS::MemCopy(data_, other.data_, kNumberOfTrackedSideEffects * kPointerSize); | 338 OS::MemCopy(data_, other.data_, kNumberOfTrackedSideEffects * kPointerSize); |
338 } | 339 } |
339 return *this; | 340 return *this; |
340 } | 341 } |
341 | 342 |
| 343 |
342 void HSideEffectMap::Kill(GVNFlagSet flags) { | 344 void HSideEffectMap::Kill(GVNFlagSet flags) { |
343 for (int i = 0; i < kNumberOfTrackedSideEffects; i++) { | 345 for (int i = 0; i < kNumberOfTrackedSideEffects; i++) { |
344 GVNFlag changes_flag = HValue::ChangesFlagFromInt(i); | 346 GVNFlag changes_flag = HValue::ChangesFlagFromInt(i); |
345 if (flags.Contains(changes_flag)) { | 347 if (flags.Contains(changes_flag)) { |
346 if (data_[i] != NULL) count_--; | 348 if (data_[i] != NULL) count_--; |
347 data_[i] = NULL; | 349 data_[i] = NULL; |
348 } | 350 } |
349 } | 351 } |
350 } | 352 } |
351 | 353 |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
741 | 743 |
742 GvnBasicBlockState* previous_; | 744 GvnBasicBlockState* previous_; |
743 GvnBasicBlockState* next_; | 745 GvnBasicBlockState* next_; |
744 HBasicBlock* block_; | 746 HBasicBlock* block_; |
745 HValueMap* map_; | 747 HValueMap* map_; |
746 HSideEffectMap dominators_; | 748 HSideEffectMap dominators_; |
747 int dominated_index_; | 749 int dominated_index_; |
748 int length_; | 750 int length_; |
749 }; | 751 }; |
750 | 752 |
| 753 |
751 // This is a recursive traversal of the dominator tree but it has been turned | 754 // This is a recursive traversal of the dominator tree but it has been turned |
752 // into a loop to avoid stack overflows. | 755 // into a loop to avoid stack overflows. |
753 // The logical "stack frames" of the recursion are kept in a list of | 756 // The logical "stack frames" of the recursion are kept in a list of |
754 // GvnBasicBlockState instances. | 757 // GvnBasicBlockState instances. |
755 void HGlobalValueNumberingPhase::AnalyzeGraph() { | 758 void HGlobalValueNumberingPhase::AnalyzeGraph() { |
756 HBasicBlock* entry_block = graph()->entry_block(); | 759 HBasicBlock* entry_block = graph()->entry_block(); |
757 HValueMap* entry_map = new(zone()) HValueMap(zone()); | 760 HValueMap* entry_map = new(zone()) HValueMap(zone()); |
758 GvnBasicBlockState* current = | 761 GvnBasicBlockState* current = |
759 GvnBasicBlockState::CreateEntry(zone(), entry_block, entry_map); | 762 GvnBasicBlockState::CreateEntry(zone(), entry_block, entry_map); |
760 | 763 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
845 dominated); | 848 dominated); |
846 successor_map->Kill(side_effects_on_all_paths); | 849 successor_map->Kill(side_effects_on_all_paths); |
847 successor_dominators->Kill(side_effects_on_all_paths); | 850 successor_dominators->Kill(side_effects_on_all_paths); |
848 } | 851 } |
849 } | 852 } |
850 current = next; | 853 current = next; |
851 } | 854 } |
852 } | 855 } |
853 | 856 |
854 } } // namespace v8::internal | 857 } } // namespace v8::internal |
OLD | NEW |