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

Side by Side Diff: src/assembler.h

Issue 6991010: Remove NearLabel, replacing remaining occurrences with Label (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 7 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 | « no previous file | src/ia32/assembler-ia32.h » ('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 (c) 1994-2006 Sun Microsystems Inc. 1 // Copyright (c) 1994-2006 Sun Microsystems Inc.
2 // All Rights Reserved. 2 // All Rights Reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // - Redistributions of source code must retain the above copyright notice, 8 // - Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer. 9 // this list of conditions and the following disclaimer.
10 // 10 //
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 } 128 }
129 129
130 friend class Assembler; 130 friend class Assembler;
131 friend class RegexpAssembler; 131 friend class RegexpAssembler;
132 friend class Displacement; 132 friend class Displacement;
133 friend class RegExpMacroAssemblerIrregexp; 133 friend class RegExpMacroAssemblerIrregexp;
134 }; 134 };
135 135
136 136
137 // ----------------------------------------------------------------------------- 137 // -----------------------------------------------------------------------------
138 // NearLabels are labels used for short jumps (in Intel jargon).
139 // NearLabels should be used if it can be guaranteed that the jump range is
140 // within -128 to +127. We already use short jumps when jumping backwards,
141 // so using a NearLabel will only have performance impact if used for forward
142 // jumps.
143 class NearLabel BASE_EMBEDDED {
144 public:
145 NearLabel() { Unuse(); }
146 ~NearLabel() { ASSERT(!is_linked()); }
147
148 void Unuse() {
149 pos_ = -1;
150 unresolved_branches_ = 0;
151 #ifdef DEBUG
152 for (int i = 0; i < kMaxUnresolvedBranches; i++) {
153 unresolved_positions_[i] = -1;
154 }
155 #endif
156 }
157
158 int pos() {
159 ASSERT(is_bound());
160 return pos_;
161 }
162
163 bool is_bound() { return pos_ >= 0; }
164 bool is_linked() { return !is_bound() && unresolved_branches_ > 0; }
165 bool is_unused() { return !is_bound() && unresolved_branches_ == 0; }
166
167 void bind_to(int position) {
168 ASSERT(!is_bound());
169 pos_ = position;
170 }
171
172 void link_to(int position) {
173 ASSERT(!is_bound());
174 ASSERT(unresolved_branches_ < kMaxUnresolvedBranches);
175 unresolved_positions_[unresolved_branches_++] = position;
176 }
177
178 private:
179 static const int kMaxUnresolvedBranches = 8;
180 int pos_;
181 int unresolved_branches_;
182 int unresolved_positions_[kMaxUnresolvedBranches];
183
184 friend class Assembler;
185 };
186
187
188 // -----------------------------------------------------------------------------
189 // Relocation information 138 // Relocation information
190 139
191 140
192 // Relocation information consists of the address (pc) of the datum 141 // Relocation information consists of the address (pc) of the datum
193 // to which the relocation information applies, the relocation mode 142 // to which the relocation information applies, the relocation mode
194 // (rmode), and an optional data field. The relocation mode may be 143 // (rmode), and an optional data field. The relocation mode may be
195 // "descriptive" and not indicate a need for relocation, but simply 144 // "descriptive" and not indicate a need for relocation, but simply
196 // describe a property of the datum. Such rmodes are useful for GC 145 // describe a property of the datum. Such rmodes are useful for GC
197 // and nice disassembly output. 146 // and nice disassembly output.
198 147
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after
881 public: 830 public:
882 NullCallWrapper() { } 831 NullCallWrapper() { }
883 virtual ~NullCallWrapper() { } 832 virtual ~NullCallWrapper() { }
884 virtual void BeforeCall(int call_size) const { } 833 virtual void BeforeCall(int call_size) const { }
885 virtual void AfterCall() const { } 834 virtual void AfterCall() const { }
886 }; 835 };
887 836
888 } } // namespace v8::internal 837 } } // namespace v8::internal
889 838
890 #endif // V8_ASSEMBLER_H_ 839 #endif // V8_ASSEMBLER_H_
OLDNEW
« no previous file with comments | « no previous file | src/ia32/assembler-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698