OLD | NEW |
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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 ProbeImpl(cross_compile); | 176 ProbeImpl(cross_compile); |
177 } | 177 } |
178 | 178 |
179 static bool IsSupported(CpuFeature f) { | 179 static bool IsSupported(CpuFeature f) { |
180 return (supported_ & (1u << f)) != 0; | 180 return (supported_ & (1u << f)) != 0; |
181 } | 181 } |
182 | 182 |
183 static inline bool SupportsCrankshaft(); | 183 static inline bool SupportsCrankshaft(); |
184 | 184 |
185 static inline unsigned cache_line_size() { | 185 static inline unsigned cache_line_size() { |
186 ASSERT(cache_line_size_ != 0); | 186 DCHECK(cache_line_size_ != 0); |
187 return cache_line_size_; | 187 return cache_line_size_; |
188 } | 188 } |
189 | 189 |
190 static void PrintTarget(); | 190 static void PrintTarget(); |
191 static void PrintFeatures(); | 191 static void PrintFeatures(); |
192 | 192 |
193 // Flush instruction cache. | 193 // Flush instruction cache. |
194 static void FlushICache(void* start, size_t size); | 194 static void FlushICache(void* start, size_t size); |
195 | 195 |
196 private: | 196 private: |
(...skipping 19 matching lines...) Expand all Loading... |
216 enum Distance { | 216 enum Distance { |
217 kNear, kFar | 217 kNear, kFar |
218 }; | 218 }; |
219 | 219 |
220 INLINE(Label()) { | 220 INLINE(Label()) { |
221 Unuse(); | 221 Unuse(); |
222 UnuseNear(); | 222 UnuseNear(); |
223 } | 223 } |
224 | 224 |
225 INLINE(~Label()) { | 225 INLINE(~Label()) { |
226 ASSERT(!is_linked()); | 226 DCHECK(!is_linked()); |
227 ASSERT(!is_near_linked()); | 227 DCHECK(!is_near_linked()); |
228 } | 228 } |
229 | 229 |
230 INLINE(void Unuse()) { pos_ = 0; } | 230 INLINE(void Unuse()) { pos_ = 0; } |
231 INLINE(void UnuseNear()) { near_link_pos_ = 0; } | 231 INLINE(void UnuseNear()) { near_link_pos_ = 0; } |
232 | 232 |
233 INLINE(bool is_bound() const) { return pos_ < 0; } | 233 INLINE(bool is_bound() const) { return pos_ < 0; } |
234 INLINE(bool is_unused() const) { return pos_ == 0 && near_link_pos_ == 0; } | 234 INLINE(bool is_unused() const) { return pos_ == 0 && near_link_pos_ == 0; } |
235 INLINE(bool is_linked() const) { return pos_ > 0; } | 235 INLINE(bool is_linked() const) { return pos_ > 0; } |
236 INLINE(bool is_near_linked() const) { return near_link_pos_ > 0; } | 236 INLINE(bool is_near_linked() const) { return near_link_pos_ > 0; } |
237 | 237 |
238 // Returns the position of bound or linked labels. Cannot be used | 238 // Returns the position of bound or linked labels. Cannot be used |
239 // for unused labels. | 239 // for unused labels. |
240 int pos() const; | 240 int pos() const; |
241 int near_link_pos() const { return near_link_pos_ - 1; } | 241 int near_link_pos() const { return near_link_pos_ - 1; } |
242 | 242 |
243 private: | 243 private: |
244 // pos_ encodes both the binding state (via its sign) | 244 // pos_ encodes both the binding state (via its sign) |
245 // and the binding position (via its value) of a label. | 245 // and the binding position (via its value) of a label. |
246 // | 246 // |
247 // pos_ < 0 bound label, pos() returns the jump target position | 247 // pos_ < 0 bound label, pos() returns the jump target position |
248 // pos_ == 0 unused label | 248 // pos_ == 0 unused label |
249 // pos_ > 0 linked label, pos() returns the last reference position | 249 // pos_ > 0 linked label, pos() returns the last reference position |
250 int pos_; | 250 int pos_; |
251 | 251 |
252 // Behaves like |pos_| in the "> 0" case, but for near jumps to this label. | 252 // Behaves like |pos_| in the "> 0" case, but for near jumps to this label. |
253 int near_link_pos_; | 253 int near_link_pos_; |
254 | 254 |
255 void bind_to(int pos) { | 255 void bind_to(int pos) { |
256 pos_ = -pos - 1; | 256 pos_ = -pos - 1; |
257 ASSERT(is_bound()); | 257 DCHECK(is_bound()); |
258 } | 258 } |
259 void link_to(int pos, Distance distance = kFar) { | 259 void link_to(int pos, Distance distance = kFar) { |
260 if (distance == kNear) { | 260 if (distance == kNear) { |
261 near_link_pos_ = pos + 1; | 261 near_link_pos_ = pos + 1; |
262 ASSERT(is_near_linked()); | 262 DCHECK(is_near_linked()); |
263 } else { | 263 } else { |
264 pos_ = pos + 1; | 264 pos_ = pos + 1; |
265 ASSERT(is_linked()); | 265 DCHECK(is_linked()); |
266 } | 266 } |
267 } | 267 } |
268 | 268 |
269 friend class Assembler; | 269 friend class Assembler; |
270 friend class Displacement; | 270 friend class Displacement; |
271 friend class RegExpMacroAssemblerIrregexp; | 271 friend class RegExpMacroAssemblerIrregexp; |
272 | 272 |
273 #if V8_TARGET_ARCH_ARM64 | 273 #if V8_TARGET_ARCH_ARM64 |
274 // On ARM64, the Assembler keeps track of pointers to Labels to resolve | 274 // On ARM64, the Assembler keeps track of pointers to Labels to resolve |
275 // branches to distant targets. Copying labels would confuse the Assembler. | 275 // branches to distant targets. Copying labels would confuse the Assembler. |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 } | 377 } |
378 RelocInfo(byte* pc, double data64) | 378 RelocInfo(byte* pc, double data64) |
379 : pc_(pc), rmode_(NONE64), data64_(data64), host_(NULL) { | 379 : pc_(pc), rmode_(NONE64), data64_(data64), host_(NULL) { |
380 } | 380 } |
381 | 381 |
382 static inline bool IsRealRelocMode(Mode mode) { | 382 static inline bool IsRealRelocMode(Mode mode) { |
383 return mode >= FIRST_REAL_RELOC_MODE && | 383 return mode >= FIRST_REAL_RELOC_MODE && |
384 mode <= LAST_REAL_RELOC_MODE; | 384 mode <= LAST_REAL_RELOC_MODE; |
385 } | 385 } |
386 static inline bool IsPseudoRelocMode(Mode mode) { | 386 static inline bool IsPseudoRelocMode(Mode mode) { |
387 ASSERT(!IsRealRelocMode(mode)); | 387 DCHECK(!IsRealRelocMode(mode)); |
388 return mode >= FIRST_PSEUDO_RELOC_MODE && | 388 return mode >= FIRST_PSEUDO_RELOC_MODE && |
389 mode <= LAST_PSEUDO_RELOC_MODE; | 389 mode <= LAST_PSEUDO_RELOC_MODE; |
390 } | 390 } |
391 static inline bool IsConstructCall(Mode mode) { | 391 static inline bool IsConstructCall(Mode mode) { |
392 return mode == CONSTRUCT_CALL; | 392 return mode == CONSTRUCT_CALL; |
393 } | 393 } |
394 static inline bool IsCodeTarget(Mode mode) { | 394 static inline bool IsCodeTarget(Mode mode) { |
395 return mode <= LAST_CODE_ENUM; | 395 return mode <= LAST_CODE_ENUM; |
396 } | 396 } |
397 static inline bool IsEmbeddedObject(Mode mode) { | 397 static inline bool IsEmbeddedObject(Mode mode) { |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 // iteration iff bit k of mode_mask is set. | 674 // iteration iff bit k of mode_mask is set. |
675 explicit RelocIterator(Code* code, int mode_mask = -1); | 675 explicit RelocIterator(Code* code, int mode_mask = -1); |
676 explicit RelocIterator(const CodeDesc& desc, int mode_mask = -1); | 676 explicit RelocIterator(const CodeDesc& desc, int mode_mask = -1); |
677 | 677 |
678 // Iteration | 678 // Iteration |
679 bool done() const { return done_; } | 679 bool done() const { return done_; } |
680 void next(); | 680 void next(); |
681 | 681 |
682 // Return pointer valid until next next(). | 682 // Return pointer valid until next next(). |
683 RelocInfo* rinfo() { | 683 RelocInfo* rinfo() { |
684 ASSERT(!done()); | 684 DCHECK(!done()); |
685 return &rinfo_; | 685 return &rinfo_; |
686 } | 686 } |
687 | 687 |
688 private: | 688 private: |
689 // Advance* moves the position before/after reading. | 689 // Advance* moves the position before/after reading. |
690 // *Read* reads from current byte(s) into rinfo_. | 690 // *Read* reads from current byte(s) into rinfo_. |
691 // *Get* just reads and returns info on current byte. | 691 // *Get* just reads and returns info on current byte. |
692 void Advance(int bytes = 1) { pos_ -= bytes; } | 692 void Advance(int bytes = 1) { pos_ -= bytes; } |
693 int AdvanceGetTag(); | 693 int AdvanceGetTag(); |
694 int GetExtraTag(); | 694 int GetExtraTag(); |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
947 // byte NativeRegExpMacroAssembler::word_character_bitmap | 947 // byte NativeRegExpMacroAssembler::word_character_bitmap |
948 static ExternalReference re_word_character_map(); | 948 static ExternalReference re_word_character_map(); |
949 | 949 |
950 #endif | 950 #endif |
951 | 951 |
952 // This lets you register a function that rewrites all external references. | 952 // This lets you register a function that rewrites all external references. |
953 // Used by the ARM simulator to catch calls to external references. | 953 // Used by the ARM simulator to catch calls to external references. |
954 static void set_redirector(Isolate* isolate, | 954 static void set_redirector(Isolate* isolate, |
955 ExternalReferenceRedirector* redirector) { | 955 ExternalReferenceRedirector* redirector) { |
956 // We can't stack them. | 956 // We can't stack them. |
957 ASSERT(isolate->external_reference_redirector() == NULL); | 957 DCHECK(isolate->external_reference_redirector() == NULL); |
958 isolate->set_external_reference_redirector( | 958 isolate->set_external_reference_redirector( |
959 reinterpret_cast<ExternalReferenceRedirectorPointer*>(redirector)); | 959 reinterpret_cast<ExternalReferenceRedirectorPointer*>(redirector)); |
960 } | 960 } |
961 | 961 |
962 static ExternalReference stress_deopt_count(Isolate* isolate); | 962 static ExternalReference stress_deopt_count(Isolate* isolate); |
963 | 963 |
964 bool operator==(const ExternalReference& other) const { | 964 bool operator==(const ExternalReference& other) const { |
965 return address_ == other.address_; | 965 return address_ == other.address_; |
966 } | 966 } |
967 | 967 |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1120 | 1120 |
1121 private: | 1121 private: |
1122 int32_t multiplier_; | 1122 int32_t multiplier_; |
1123 int32_t shift_; | 1123 int32_t shift_; |
1124 }; | 1124 }; |
1125 | 1125 |
1126 | 1126 |
1127 } } // namespace v8::internal | 1127 } } // namespace v8::internal |
1128 | 1128 |
1129 #endif // V8_ASSEMBLER_H_ | 1129 #endif // V8_ASSEMBLER_H_ |
OLD | NEW |