Chromium Code Reviews| 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 #ifndef V8_HYDROGEN_CHECK_ELIMINATION_H_ | 5 #ifndef V8_HYDROGEN_CHECK_ELIMINATION_H_ |
| 6 #define V8_HYDROGEN_CHECK_ELIMINATION_H_ | 6 #define V8_HYDROGEN_CHECK_ELIMINATION_H_ |
| 7 | 7 |
| 8 #include "hydrogen.h" | 8 #include "hydrogen.h" |
| 9 #include "hydrogen-alias-analysis.h" | 9 #include "hydrogen-alias-analysis.h" |
| 10 | 10 |
| 11 namespace v8 { | 11 namespace v8 { |
| 12 namespace internal { | 12 namespace internal { |
| 13 | 13 |
| 14 | 14 |
| 15 // Remove CheckMaps instructions through flow- and branch-sensitive analysis. | 15 // Remove CheckMaps instructions through flow- and branch-sensitive analysis. |
| 16 class HCheckEliminationPhase : public HPhase { | 16 class HCheckEliminationPhase : public HPhase { |
| 17 public: | 17 public: |
| 18 explicit HCheckEliminationPhase(HGraph* graph) | 18 explicit HCheckEliminationPhase(HGraph* graph) |
| 19 : HPhase("H_Check Elimination", graph), aliasing_() { | 19 : HPhase("H_Check Elimination", graph), aliasing_(), |
| 20 string_maps_(kStringMapsSize, zone()) { | |
| 21 // Compute the set of string maps. | |
| 22 #define ADD_STRING_MAP(type, size, name, Name) \ | |
| 23 string_maps_.Add(Unique<Map>::CreateImmovable( \ | |
| 24 graph->isolate()->factory()->name##_map()), zone()); | |
| 25 STRING_TYPE_LIST(ADD_STRING_MAP) | |
| 26 #undef ADD_STRING_MAP | |
| 27 ASSERT_EQ(kStringMapsSize, string_maps_.size()); | |
| 20 #ifdef DEBUG | 28 #ifdef DEBUG |
| 21 redundant_ = 0; | 29 redundant_ = 0; |
| 22 removed_ = 0; | 30 removed_ = 0; |
| 23 removed_cho_ = 0; | 31 removed_cho_ = 0; |
|
Igor Sheludko
2014/05/30 10:00:41
removed_cit_ = 0;
Benedikt Meurer
2014/05/31 11:15:46
Done.
| |
| 24 narrowed_ = 0; | 32 narrowed_ = 0; |
| 25 loads_ = 0; | 33 loads_ = 0; |
| 26 empty_ = 0; | 34 empty_ = 0; |
| 27 compares_true_ = 0; | 35 compares_true_ = 0; |
| 28 compares_false_ = 0; | 36 compares_false_ = 0; |
| 29 transitions_ = 0; | 37 transitions_ = 0; |
| 30 #endif | 38 #endif |
| 31 } | 39 } |
| 32 | 40 |
| 33 void Run(); | 41 void Run(); |
| 34 | 42 |
| 35 friend class HCheckTable; | 43 friend class HCheckTable; |
| 36 | 44 |
| 37 private: | 45 private: |
| 46 const UniqueSet<Map>* string_maps() const { return &string_maps_; } | |
| 47 | |
| 38 void PrintStats(); | 48 void PrintStats(); |
| 39 | 49 |
| 40 HAliasAnalyzer* aliasing_; | 50 HAliasAnalyzer* aliasing_; |
| 51 #define COUNT(type, size, name, Name) + 1 | |
| 52 static const int kStringMapsSize = 0 STRING_TYPE_LIST(COUNT); | |
| 53 #undef COUNT | |
| 54 UniqueSet<Map> string_maps_; | |
| 41 #ifdef DEBUG | 55 #ifdef DEBUG |
| 42 int redundant_; | 56 int redundant_; |
| 43 int removed_; | 57 int removed_; |
| 44 int removed_cho_; | 58 int removed_cho_; |
| 59 int removed_cit_; | |
| 45 int narrowed_; | 60 int narrowed_; |
| 46 int loads_; | 61 int loads_; |
| 47 int empty_; | 62 int empty_; |
| 48 int compares_true_; | 63 int compares_true_; |
| 49 int compares_false_; | 64 int compares_false_; |
| 50 int transitions_; | 65 int transitions_; |
| 51 #endif | 66 #endif |
| 52 }; | 67 }; |
| 53 | 68 |
| 54 | 69 |
| 55 } } // namespace v8::internal | 70 } } // namespace v8::internal |
| 56 | 71 |
| 57 #endif // V8_HYDROGEN_CHECK_ELIMINATION_H_ | 72 #endif // V8_HYDROGEN_CHECK_ELIMINATION_H_ |
| OLD | NEW |