Line data Source code
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
3 : // found in the LICENSE file.
4 :
5 : #ifndef V8_CRANKSHAFT_HYDROGEN_CHECK_ELIMINATION_H_
6 : #define V8_CRANKSHAFT_HYDROGEN_CHECK_ELIMINATION_H_
7 :
8 : #include "src/crankshaft/hydrogen.h"
9 : #include "src/crankshaft/hydrogen-alias-analysis.h"
10 :
11 : namespace v8 {
12 : namespace internal {
13 :
14 :
15 : // Remove CheckMaps instructions through flow- and branch-sensitive analysis.
16 283729 : class HCheckEliminationPhase : public HPhase {
17 : public:
18 6525783 : explicit HCheckEliminationPhase(HGraph* graph)
19 : : HPhase("H_Check Elimination", graph), aliasing_(),
20 283730 : 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 6242053 : STRING_TYPE_LIST(ADD_STRING_MAP)
26 : #undef ADD_STRING_MAP
27 : DCHECK_EQ(kStringMapsSize, string_maps_.size());
28 : #ifdef DEBUG
29 : redundant_ = 0;
30 : removed_ = 0;
31 : removed_cho_ = 0;
32 : removed_cit_ = 0;
33 : narrowed_ = 0;
34 : loads_ = 0;
35 : empty_ = 0;
36 : compares_true_ = 0;
37 : compares_false_ = 0;
38 : transitions_ = 0;
39 : #endif
40 283728 : }
41 :
42 : void Run();
43 :
44 : friend class HCheckTable;
45 :
46 : private:
47 : const UniqueSet<Map>* string_maps() const { return &string_maps_; }
48 :
49 : void PrintStats();
50 :
51 : HAliasAnalyzer* aliasing_;
52 : #define COUNT(type, size, name, Name) + 1
53 : static const int kStringMapsSize = 0 STRING_TYPE_LIST(COUNT);
54 : #undef COUNT
55 : UniqueSet<Map> string_maps_;
56 : #ifdef DEBUG
57 : int redundant_;
58 : int removed_;
59 : int removed_cho_;
60 : int removed_cit_;
61 : int narrowed_;
62 : int loads_;
63 : int empty_;
64 : int compares_true_;
65 : int compares_false_;
66 : int transitions_;
67 : #endif
68 : };
69 :
70 :
71 : } // namespace internal
72 : } // namespace v8
73 :
74 : #endif // V8_CRANKSHAFT_HYDROGEN_CHECK_ELIMINATION_H_
|