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

Side by Side Diff: src/assembler.h

Issue 2645063002: includes: move Label out of assembler.h. (Closed)
Patch Set: oops Created 3 years, 11 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
« no previous file with comments | « BUILD.gn ('k') | src/assembler.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 (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 22 matching lines...) Expand all
33 // Copyright 2012 the V8 project authors. All rights reserved. 33 // Copyright 2012 the V8 project authors. All rights reserved.
34 34
35 #ifndef V8_ASSEMBLER_H_ 35 #ifndef V8_ASSEMBLER_H_
36 #define V8_ASSEMBLER_H_ 36 #define V8_ASSEMBLER_H_
37 37
38 #include "src/allocation.h" 38 #include "src/allocation.h"
39 #include "src/builtins/builtins.h" 39 #include "src/builtins/builtins.h"
40 #include "src/deoptimize-reason.h" 40 #include "src/deoptimize-reason.h"
41 #include "src/globals.h" 41 #include "src/globals.h"
42 #include "src/isolate.h" 42 #include "src/isolate.h"
43 #include "src/label.h"
43 #include "src/log.h" 44 #include "src/log.h"
44 #include "src/register-configuration.h" 45 #include "src/register-configuration.h"
45 #include "src/runtime/runtime.h" 46 #include "src/runtime/runtime.h"
46 47
47 namespace v8 { 48 namespace v8 {
48 49
49 // Forward declarations. 50 // Forward declarations.
50 class ApiFunction; 51 class ApiFunction;
51 52
52 namespace internal { 53 namespace internal {
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 static void ProbeImpl(bool cross_compile); 266 static void ProbeImpl(bool cross_compile);
266 267
267 static unsigned supported_; 268 static unsigned supported_;
268 static unsigned icache_line_size_; 269 static unsigned icache_line_size_;
269 static unsigned dcache_line_size_; 270 static unsigned dcache_line_size_;
270 static bool initialized_; 271 static bool initialized_;
271 DISALLOW_COPY_AND_ASSIGN(CpuFeatures); 272 DISALLOW_COPY_AND_ASSIGN(CpuFeatures);
272 }; 273 };
273 274
274 275
275 // -----------------------------------------------------------------------------
276 // Labels represent pc locations; they are typically jump or call targets.
277 // After declaration, a label can be freely used to denote known or (yet)
278 // unknown pc location. Assembler::bind() is used to bind a label to the
279 // current pc. A label can be bound only once.
280
281 class Label {
282 public:
283 enum Distance {
284 kNear, kFar
285 };
286
287 INLINE(Label()) {
288 Unuse();
289 UnuseNear();
290 }
291
292 INLINE(~Label()) {
293 DCHECK(!is_linked());
294 DCHECK(!is_near_linked());
295 }
296
297 INLINE(void Unuse()) { pos_ = 0; }
298 INLINE(void UnuseNear()) { near_link_pos_ = 0; }
299
300 INLINE(bool is_bound() const) { return pos_ < 0; }
301 INLINE(bool is_unused() const) { return pos_ == 0 && near_link_pos_ == 0; }
302 INLINE(bool is_linked() const) { return pos_ > 0; }
303 INLINE(bool is_near_linked() const) { return near_link_pos_ > 0; }
304
305 // Returns the position of bound or linked labels. Cannot be used
306 // for unused labels.
307 int pos() const;
308 int near_link_pos() const { return near_link_pos_ - 1; }
309
310 private:
311 // pos_ encodes both the binding state (via its sign)
312 // and the binding position (via its value) of a label.
313 //
314 // pos_ < 0 bound label, pos() returns the jump target position
315 // pos_ == 0 unused label
316 // pos_ > 0 linked label, pos() returns the last reference position
317 int pos_;
318
319 // Behaves like |pos_| in the "> 0" case, but for near jumps to this label.
320 int near_link_pos_;
321
322 void bind_to(int pos) {
323 pos_ = -pos - 1;
324 DCHECK(is_bound());
325 }
326 void link_to(int pos, Distance distance = kFar) {
327 if (distance == kNear) {
328 near_link_pos_ = pos + 1;
329 DCHECK(is_near_linked());
330 } else {
331 pos_ = pos + 1;
332 DCHECK(is_linked());
333 }
334 }
335
336 friend class Assembler;
337 friend class Displacement;
338 friend class RegExpMacroAssemblerIrregexp;
339
340 #if V8_TARGET_ARCH_ARM64
341 // On ARM64, the Assembler keeps track of pointers to Labels to resolve
342 // branches to distant targets. Copying labels would confuse the Assembler.
343 DISALLOW_COPY_AND_ASSIGN(Label); // NOLINT
344 #endif
345 };
346
347
348 enum SaveFPRegsMode { kDontSaveFPRegs, kSaveFPRegs }; 276 enum SaveFPRegsMode { kDontSaveFPRegs, kSaveFPRegs };
349 277
350 enum ArgvMode { kArgvOnStack, kArgvInRegister }; 278 enum ArgvMode { kArgvOnStack, kArgvInRegister };
351 279
352 // Specifies whether to perform icache flush operations on RelocInfo updates. 280 // Specifies whether to perform icache flush operations on RelocInfo updates.
353 // If FLUSH_ICACHE_IF_NEEDED, the icache will always be flushed if an 281 // If FLUSH_ICACHE_IF_NEEDED, the icache will always be flushed if an
354 // instruction was modified. If SKIP_ICACHE_FLUSH the flush will always be 282 // instruction was modified. If SKIP_ICACHE_FLUSH the flush will always be
355 // skipped (only use this if you will flush the icache manually before it is 283 // skipped (only use this if you will flush the icache manually before it is
356 // executed). 284 // executed).
357 enum ICacheFlushMode { FLUSH_ICACHE_IF_NEEDED, SKIP_ICACHE_FLUSH }; 285 enum ICacheFlushMode { FLUSH_ICACHE_IF_NEEDED, SKIP_ICACHE_FLUSH };
(...skipping 949 matching lines...) Expand 10 before | Expand all | Expand 10 after
1307 std::vector<ConstantPoolEntry> shared_entries; 1235 std::vector<ConstantPoolEntry> shared_entries;
1308 }; 1236 };
1309 1237
1310 Label emitted_label_; // Records pc_offset of emitted pool 1238 Label emitted_label_; // Records pc_offset of emitted pool
1311 PerTypeEntryInfo info_[ConstantPoolEntry::NUMBER_OF_TYPES]; 1239 PerTypeEntryInfo info_[ConstantPoolEntry::NUMBER_OF_TYPES];
1312 }; 1240 };
1313 1241
1314 } // namespace internal 1242 } // namespace internal
1315 } // namespace v8 1243 } // namespace v8
1316 #endif // V8_ASSEMBLER_H_ 1244 #endif // V8_ASSEMBLER_H_
OLDNEW
« no previous file with comments | « BUILD.gn ('k') | src/assembler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698