Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(127)

Side by Side Diff: src/hydrogen-gvn.h

Issue 430503007: Rename ASSERT* to DCHECK*. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: REBASE and fixes Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/hydrogen-flow-engine.h ('k') | src/hydrogen-gvn.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_GVN_H_ 5 #ifndef V8_HYDROGEN_GVN_H_
6 #define V8_HYDROGEN_GVN_H_ 6 #define V8_HYDROGEN_GVN_H_
7 7
8 #include "src/compiler.h" 8 #include "src/compiler.h"
9 #include "src/hydrogen.h" 9 #include "src/hydrogen.h"
10 #include "src/hydrogen-instructions.h" 10 #include "src/hydrogen-instructions.h"
11 #include "src/zone.h" 11 #include "src/zone.h"
12 12
13 namespace v8 { 13 namespace v8 {
14 namespace internal { 14 namespace internal {
15 15
16 class OStream; 16 class OStream;
17 17
18 // This class extends GVNFlagSet with additional "special" dynamic side effects, 18 // This class extends GVNFlagSet with additional "special" dynamic side effects,
19 // which can be used to represent side effects that cannot be expressed using 19 // which can be used to represent side effects that cannot be expressed using
20 // the GVNFlags of an HInstruction. These special side effects are tracked by a 20 // the GVNFlags of an HInstruction. These special side effects are tracked by a
21 // SideEffectsTracker (see below). 21 // SideEffectsTracker (see below).
22 class SideEffects V8_FINAL { 22 class SideEffects V8_FINAL {
23 public: 23 public:
24 static const int kNumberOfSpecials = 64 - kNumberOfFlags; 24 static const int kNumberOfSpecials = 64 - kNumberOfFlags;
25 25
26 SideEffects() : bits_(0) { 26 SideEffects() : bits_(0) {
27 ASSERT(kNumberOfFlags + kNumberOfSpecials == sizeof(bits_) * CHAR_BIT); 27 DCHECK(kNumberOfFlags + kNumberOfSpecials == sizeof(bits_) * CHAR_BIT);
28 } 28 }
29 explicit SideEffects(GVNFlagSet flags) : bits_(flags.ToIntegral()) {} 29 explicit SideEffects(GVNFlagSet flags) : bits_(flags.ToIntegral()) {}
30 bool IsEmpty() const { return bits_ == 0; } 30 bool IsEmpty() const { return bits_ == 0; }
31 bool ContainsFlag(GVNFlag flag) const { 31 bool ContainsFlag(GVNFlag flag) const {
32 return (bits_ & MaskFlag(flag)) != 0; 32 return (bits_ & MaskFlag(flag)) != 0;
33 } 33 }
34 bool ContainsSpecial(int special) const { 34 bool ContainsSpecial(int special) const {
35 return (bits_ & MaskSpecial(special)) != 0; 35 return (bits_ & MaskSpecial(special)) != 0;
36 } 36 }
37 bool ContainsAnyOf(SideEffects set) const { return (bits_ & set.bits_) != 0; } 37 bool ContainsAnyOf(SideEffects set) const { return (bits_ & set.bits_) != 0; }
38 void Add(SideEffects set) { bits_ |= set.bits_; } 38 void Add(SideEffects set) { bits_ |= set.bits_; }
39 void AddSpecial(int special) { bits_ |= MaskSpecial(special); } 39 void AddSpecial(int special) { bits_ |= MaskSpecial(special); }
40 void RemoveFlag(GVNFlag flag) { bits_ &= ~MaskFlag(flag); } 40 void RemoveFlag(GVNFlag flag) { bits_ &= ~MaskFlag(flag); }
41 void RemoveAll() { bits_ = 0; } 41 void RemoveAll() { bits_ = 0; }
42 uint64_t ToIntegral() const { return bits_; } 42 uint64_t ToIntegral() const { return bits_; }
43 43
44 private: 44 private:
45 uint64_t MaskFlag(GVNFlag flag) const { 45 uint64_t MaskFlag(GVNFlag flag) const {
46 return static_cast<uint64_t>(1) << static_cast<unsigned>(flag); 46 return static_cast<uint64_t>(1) << static_cast<unsigned>(flag);
47 } 47 }
48 uint64_t MaskSpecial(int special) const { 48 uint64_t MaskSpecial(int special) const {
49 ASSERT(special >= 0); 49 DCHECK(special >= 0);
50 ASSERT(special < kNumberOfSpecials); 50 DCHECK(special < kNumberOfSpecials);
51 return static_cast<uint64_t>(1) << static_cast<unsigned>( 51 return static_cast<uint64_t>(1) << static_cast<unsigned>(
52 special + kNumberOfFlags); 52 special + kNumberOfFlags);
53 } 53 }
54 54
55 uint64_t bits_; 55 uint64_t bits_;
56 }; 56 };
57 57
58 58
59 struct TrackedEffects; 59 struct TrackedEffects;
60 60
61 // Tracks global variable and inobject field loads/stores in a fine grained 61 // Tracks global variable and inobject field loads/stores in a fine grained
62 // fashion, and represents them using the "special" dynamic side effects of the 62 // fashion, and represents them using the "special" dynamic side effects of the
63 // SideEffects class (see above). This way unrelated global variable/inobject 63 // SideEffects class (see above). This way unrelated global variable/inobject
64 // field stores don't prevent hoisting and merging of global variable/inobject 64 // field stores don't prevent hoisting and merging of global variable/inobject
65 // field loads. 65 // field loads.
66 class SideEffectsTracker V8_FINAL BASE_EMBEDDED { 66 class SideEffectsTracker V8_FINAL BASE_EMBEDDED {
67 public: 67 public:
68 SideEffectsTracker() : num_global_vars_(0), num_inobject_fields_(0) {} 68 SideEffectsTracker() : num_global_vars_(0), num_inobject_fields_(0) {}
69 SideEffects ComputeChanges(HInstruction* instr); 69 SideEffects ComputeChanges(HInstruction* instr);
70 SideEffects ComputeDependsOn(HInstruction* instr); 70 SideEffects ComputeDependsOn(HInstruction* instr);
71 71
72 private: 72 private:
73 friend OStream& operator<<(OStream& os, const TrackedEffects& f); 73 friend OStream& operator<<(OStream& os, const TrackedEffects& f);
74 bool ComputeGlobalVar(Unique<Cell> cell, int* index); 74 bool ComputeGlobalVar(Unique<Cell> cell, int* index);
75 bool ComputeInobjectField(HObjectAccess access, int* index); 75 bool ComputeInobjectField(HObjectAccess access, int* index);
76 76
77 static int GlobalVar(int index) { 77 static int GlobalVar(int index) {
78 ASSERT(index >= 0); 78 DCHECK(index >= 0);
79 ASSERT(index < kNumberOfGlobalVars); 79 DCHECK(index < kNumberOfGlobalVars);
80 return index; 80 return index;
81 } 81 }
82 static int InobjectField(int index) { 82 static int InobjectField(int index) {
83 ASSERT(index >= 0); 83 DCHECK(index >= 0);
84 ASSERT(index < kNumberOfInobjectFields); 84 DCHECK(index < kNumberOfInobjectFields);
85 return index + kNumberOfGlobalVars; 85 return index + kNumberOfGlobalVars;
86 } 86 }
87 87
88 // Track up to four global vars. 88 // Track up to four global vars.
89 static const int kNumberOfGlobalVars = 4; 89 static const int kNumberOfGlobalVars = 4;
90 Unique<Cell> global_vars_[kNumberOfGlobalVars]; 90 Unique<Cell> global_vars_[kNumberOfGlobalVars];
91 int num_global_vars_; 91 int num_global_vars_;
92 92
93 // Track up to n inobject fields. 93 // Track up to n inobject fields.
94 static const int kNumberOfInobjectFields = 94 static const int kNumberOfInobjectFields =
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 // Used when collecting side effects on paths from dominator to 145 // Used when collecting side effects on paths from dominator to
146 // dominated. 146 // dominated.
147 BitVector visited_on_paths_; 147 BitVector visited_on_paths_;
148 148
149 DISALLOW_COPY_AND_ASSIGN(HGlobalValueNumberingPhase); 149 DISALLOW_COPY_AND_ASSIGN(HGlobalValueNumberingPhase);
150 }; 150 };
151 151
152 } } // namespace v8::internal 152 } } // namespace v8::internal
153 153
154 #endif // V8_HYDROGEN_GVN_H_ 154 #endif // V8_HYDROGEN_GVN_H_
OLDNEW
« no previous file with comments | « src/hydrogen-flow-engine.h ('k') | src/hydrogen-gvn.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698