V8 Project
globals.h
Go to the documentation of this file.
1 // Copyright 2012 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_GLOBALS_H_
6 #define V8_GLOBALS_H_
7 
8 #include "include/v8stdint.h"
9 
10 #include "src/base/build_config.h"
11 #include "src/base/logging.h"
12 #include "src/base/macros.h"
13 
14 // Unfortunately, the INFINITY macro cannot be used with the '-pedantic'
15 // warning flag and certain versions of GCC due to a bug:
16 // http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11931
17 // For now, we use the more involved template-based version from <limits>, but
18 // only when compiling with GCC versions affected by the bug (2.96.x - 4.0.x)
19 #if V8_CC_GNU && V8_GNUC_PREREQ(2, 96, 0) && !V8_GNUC_PREREQ(4, 1, 0)
20 # include <limits> // NOLINT
21 # define V8_INFINITY std::numeric_limits<double>::infinity()
22 #elif V8_LIBC_MSVCRT
23 # define V8_INFINITY HUGE_VAL
24 #else
25 # define V8_INFINITY INFINITY
26 #endif
27 
28 #if V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_ARM || \
29  V8_TARGET_ARCH_ARM64
30 #define V8_TURBOFAN_BACKEND 1
31 #else
32 #define V8_TURBOFAN_BACKEND 0
33 #endif
34 #if V8_TURBOFAN_BACKEND && !(V8_OS_WIN && V8_TARGET_ARCH_X64)
35 #define V8_TURBOFAN_TARGET 1
36 #else
37 #define V8_TURBOFAN_TARGET 0
38 #endif
39 
40 namespace v8 {
41 
42 namespace base {
43 class Mutex;
44 class RecursiveMutex;
45 class VirtualMemory;
46 }
47 
48 namespace internal {
49 
50 // Determine whether we are running in a simulated environment.
51 // Setting USE_SIMULATOR explicitly from the build script will force
52 // the use of a simulated environment.
53 #if !defined(USE_SIMULATOR)
54 #if (V8_TARGET_ARCH_ARM64 && !V8_HOST_ARCH_ARM64)
55 #define USE_SIMULATOR 1
56 #endif
57 #if (V8_TARGET_ARCH_ARM && !V8_HOST_ARCH_ARM)
58 #define USE_SIMULATOR 1
59 #endif
60 #if (V8_TARGET_ARCH_MIPS && !V8_HOST_ARCH_MIPS)
61 #define USE_SIMULATOR 1
62 #endif
63 #if (V8_TARGET_ARCH_MIPS64 && !V8_HOST_ARCH_MIPS64)
64 #define USE_SIMULATOR 1
65 #endif
66 #endif
67 
68 // Determine whether the architecture uses an out-of-line constant pool.
69 #define V8_OOL_CONSTANT_POOL 0
70 
71 #ifdef V8_TARGET_ARCH_ARM
72 // Set stack limit lower for ARM than for other architectures because
73 // stack allocating MacroAssembler takes 120K bytes.
74 // See issue crbug.com/405338
75 #define V8_DEFAULT_STACK_SIZE_KB 864
76 #else
77 // Slightly less than 1MB, since Windows' default stack size for
78 // the main execution thread is 1MB for both 32 and 64-bit.
79 #define V8_DEFAULT_STACK_SIZE_KB 984
80 #endif
81 
82 
83 // Support for alternative bool type. This is only enabled if the code is
84 // compiled with USE_MYBOOL defined. This catches some nasty type bugs.
85 // For instance, 'bool b = "false";' results in b == true! This is a hidden
86 // source of bugs.
87 // However, redefining the bool type does have some negative impact on some
88 // platforms. It gives rise to compiler warnings (i.e. with
89 // MSVC) in the API header files when mixing code that uses the standard
90 // bool with code that uses the redefined version.
91 // This does not actually belong in the platform code, but needs to be
92 // defined here because the platform code uses bool, and platform.h is
93 // include very early in the main include file.
94 
95 #ifdef USE_MYBOOL
96 typedef unsigned int __my_bool__;
97 #define bool __my_bool__ // use 'indirection' to avoid name clashes
98 #endif
99 
100 typedef uint8_t byte;
101 typedef byte* Address;
102 
103 // -----------------------------------------------------------------------------
104 // Constants
105 
106 const int KB = 1024;
107 const int MB = KB * KB;
108 const int GB = KB * KB * KB;
109 const int kMaxInt = 0x7FFFFFFF;
110 const int kMinInt = -kMaxInt - 1;
111 const int kMaxInt8 = (1 << 7) - 1;
112 const int kMinInt8 = -(1 << 7);
113 const int kMaxUInt8 = (1 << 8) - 1;
114 const int kMinUInt8 = 0;
115 const int kMaxInt16 = (1 << 15) - 1;
116 const int kMinInt16 = -(1 << 15);
117 const int kMaxUInt16 = (1 << 16) - 1;
118 const int kMinUInt16 = 0;
119 
120 const uint32_t kMaxUInt32 = 0xFFFFFFFFu;
121 
122 const int kCharSize = sizeof(char); // NOLINT
123 const int kShortSize = sizeof(short); // NOLINT
124 const int kIntSize = sizeof(int); // NOLINT
125 const int kInt32Size = sizeof(int32_t); // NOLINT
126 const int kInt64Size = sizeof(int64_t); // NOLINT
127 const int kDoubleSize = sizeof(double); // NOLINT
128 const int kIntptrSize = sizeof(intptr_t); // NOLINT
129 const int kPointerSize = sizeof(void*); // NOLINT
130 #if V8_TARGET_ARCH_X64 && V8_TARGET_ARCH_32_BIT
132 #else
134 #endif
137 
138 const int kDoubleSizeLog2 = 3;
139 
140 #if V8_HOST_ARCH_64_BIT
141 const int kPointerSizeLog2 = 3;
142 const intptr_t kIntptrSignBit = V8_INT64_C(0x8000000000000000);
143 const uintptr_t kUintptrAllBitsSet = V8_UINT64_C(0xFFFFFFFFFFFFFFFF);
144 const bool kRequiresCodeRange = true;
145 const size_t kMaximalCodeRangeSize = 512 * MB;
146 #else
147 const int kPointerSizeLog2 = 2;
148 const intptr_t kIntptrSignBit = 0x80000000;
149 const uintptr_t kUintptrAllBitsSet = 0xFFFFFFFFu;
150 #if V8_TARGET_ARCH_X64 && V8_TARGET_ARCH_32_BIT
151 // x32 port also requires code range.
152 const bool kRequiresCodeRange = true;
153 const size_t kMaximalCodeRangeSize = 256 * MB;
154 #else
155 const bool kRequiresCodeRange = false;
156 const size_t kMaximalCodeRangeSize = 0 * MB;
157 #endif
158 #endif
159 
161 
162 const int kBitsPerByte = 8;
163 const int kBitsPerByteLog2 = 3;
166 
167 // IEEE 754 single precision floating point number bit layout.
168 const uint32_t kBinary32SignMask = 0x80000000u;
169 const uint32_t kBinary32ExponentMask = 0x7f800000u;
170 const uint32_t kBinary32MantissaMask = 0x007fffffu;
171 const int kBinary32ExponentBias = 127;
172 const int kBinary32MaxExponent = 0xFE;
173 const int kBinary32MinExponent = 0x01;
174 const int kBinary32MantissaBits = 23;
175 const int kBinary32ExponentShift = 23;
176 
177 // Quiet NaNs have bits 51 to 62 set, possibly the sign bit, and no
178 // other bits set.
179 const uint64_t kQuietNaNMask = static_cast<uint64_t>(0xfff) << 51;
180 
181 // Latin1/UTF-16 constants
182 // Code-point values in Unicode 4.0 are 21 bits wide.
183 // Code units in UTF-16 are 16 bits wide.
184 typedef uint16_t uc16;
185 typedef int32_t uc32;
187 const int kUC16Size = sizeof(uc16); // NOLINT
188 
189 
190 // Round up n to be a multiple of sz, where sz is a power of 2.
191 #define ROUND_UP(n, sz) (((n) + ((sz) - 1)) & ~((sz) - 1))
192 
193 
194 // FUNCTION_ADDR(f) gets the address of a C function f.
195 #define FUNCTION_ADDR(f) \
196  (reinterpret_cast<v8::internal::Address>(reinterpret_cast<intptr_t>(f)))
197 
198 
199 // FUNCTION_CAST<F>(addr) casts an address into a function
200 // of type F. Used to invoke generated code from within C.
201 template <typename F>
203  return reinterpret_cast<F>(reinterpret_cast<intptr_t>(addr));
204 }
205 
206 
207 // -----------------------------------------------------------------------------
208 // Forward declarations for frequently used classes
209 // (sorted alphabetically)
210 
211 class FreeStoreAllocationPolicy;
212 template <typename T, class P = FreeStoreAllocationPolicy> class List;
213 
214 // -----------------------------------------------------------------------------
215 // Declarations for use in both the preparser and the rest of V8.
216 
217 // The Strict Mode (ECMA-262 5th edition, 4.2.2).
218 
220 
221 
222 // Mask for the sign bit in a smi.
223 const intptr_t kSmiSignMask = kIntptrSignBit;
224 
228 
229 // Desired alignment for pointers.
230 const intptr_t kPointerAlignment = (1 << kPointerSizeLog2);
232 
233 // Desired alignment for double values.
234 const intptr_t kDoubleAlignment = 8;
236 
237 // Desired alignment for generated code is 32 bytes (to improve cache line
238 // utilization).
239 const int kCodeAlignmentBits = 5;
240 const intptr_t kCodeAlignment = 1 << kCodeAlignmentBits;
241 const intptr_t kCodeAlignmentMask = kCodeAlignment - 1;
242 
243 // The owner field of a page is tagged with the page header tag. We need that
244 // to find out if a slot is part of a large object. If we mask out the lower
245 // 0xfffff bits (1M pages), go to the owner offset, and see that this field
246 // is tagged with the page header tag, we can just look up the owner.
247 // Otherwise, we know that we are somewhere (not within the first 1M) in a
248 // large object.
249 const int kPageHeaderTag = 3;
250 const int kPageHeaderTagSize = 2;
251 const intptr_t kPageHeaderTagMask = (1 << kPageHeaderTagSize) - 1;
252 
253 
254 // Zap-value: The value used for zapping dead objects.
255 // Should be a recognizable hex value tagged as a failure.
256 #ifdef V8_HOST_ARCH_64_BIT
257 const Address kZapValue =
258  reinterpret_cast<Address>(V8_UINT64_C(0xdeadbeedbeadbeef));
259 const Address kHandleZapValue =
260  reinterpret_cast<Address>(V8_UINT64_C(0x1baddead0baddeaf));
262  reinterpret_cast<Address>(V8_UINT64_C(0x1baffed00baffedf));
264  reinterpret_cast<Address>(V8_UINT64_C(0x1beefdad0beefdaf));
265 const uint64_t kDebugZapValue = V8_UINT64_C(0xbadbaddbbadbaddb);
266 const uint64_t kSlotsZapValue = V8_UINT64_C(0xbeefdeadbeefdeef);
267 const uint64_t kFreeListZapValue = 0xfeed1eaffeed1eaf;
268 #else
269 const Address kZapValue = reinterpret_cast<Address>(0xdeadbeef);
270 const Address kHandleZapValue = reinterpret_cast<Address>(0xbaddeaf);
271 const Address kGlobalHandleZapValue = reinterpret_cast<Address>(0xbaffedf);
272 const Address kFromSpaceZapValue = reinterpret_cast<Address>(0xbeefdaf);
273 const uint32_t kSlotsZapValue = 0xbeefdeef;
274 const uint32_t kDebugZapValue = 0xbadbaddb;
275 const uint32_t kFreeListZapValue = 0xfeed1eaf;
276 #endif
277 
278 const int kCodeZapValue = 0xbadc0de;
279 
280 // On Intel architecture, cache line size is 64 bytes.
281 // On ARM it may be less (32 bytes), but as far this constant is
282 // used for aligning data, it doesn't hurt to align on a greater value.
283 #define PROCESSOR_CACHE_LINE_SIZE 64
284 
285 // Constants relevant to double precision floating point numbers.
286 // If looking only at the top 32 bits, the QNaN mask is bits 19 to 30.
287 const uint32_t kQuietNaNHighBitsMask = 0xfff << (51 - 32);
288 
289 
290 // -----------------------------------------------------------------------------
291 // Forward declarations for frequently used classes
292 
293 class AccessorInfo;
294 class Allocation;
295 class Arguments;
296 class Assembler;
297 class Code;
298 class CodeGenerator;
299 class CodeStub;
300 class Context;
301 class Debug;
302 class Debugger;
303 class DebugInfo;
304 class Descriptor;
305 class DescriptorArray;
306 class TransitionArray;
307 class ExternalReference;
308 class FixedArray;
310 class MemoryChunk;
313 class NameDictionary;
314 template <typename T> class MaybeHandle;
315 template <typename T> class Handle;
316 class Heap;
317 class HeapObject;
318 class IC;
319 class InterceptorInfo;
320 class Isolate;
321 class JSReceiver;
322 class JSArray;
323 class JSFunction;
324 class JSObject;
325 class LargeObjectSpace;
326 class LookupResult;
327 class MacroAssembler;
328 class Map;
329 class MapSpace;
331 class NewSpace;
332 class Object;
333 class OldSpace;
334 class Foreign;
335 class Scope;
336 class ScopeInfo;
337 class Script;
338 class Smi;
339 template <typename Config, class Allocator = FreeStoreAllocationPolicy>
340  class SplayTree;
341 class String;
342 class Name;
343 class Struct;
344 class Variable;
345 class RelocInfo;
346 class Deserializer;
347 class MessageLocation;
348 
349 typedef bool (*WeakSlotCallback)(Object** pointer);
350 
351 typedef bool (*WeakSlotCallbackWithHeap)(Heap* heap, Object** pointer);
352 
353 // -----------------------------------------------------------------------------
354 // Miscellaneous
355 
356 // NOTE: SpaceIterator depends on AllocationSpace enumeration values being
357 // consecutive.
359  NEW_SPACE, // Semispaces collected with copying collector.
360  OLD_POINTER_SPACE, // May contain pointers to new space.
361  OLD_DATA_SPACE, // Must not have pointers to new space.
362  CODE_SPACE, // No pointers to new space, marked executable.
363  MAP_SPACE, // Only and all map objects.
364  CELL_SPACE, // Only and all cell objects.
365  PROPERTY_CELL_SPACE, // Only and all global property cell objects.
366  LO_SPACE, // Promoted large objects.
367  INVALID_SPACE, // Only used in AllocationResult to signal success.
368 
373 };
374 const int kSpaceTagSize = 3;
375 const int kSpaceTagMask = (1 << kSpaceTagSize) - 1;
376 
377 
378 // A flag that indicates whether objects should be pretenured when
379 // allocated (allocated directly into the old generation) or not
380 // (allocated in the young generation if the object size and type
381 // allows).
383 
387 };
388 
390 
392 
393 enum VisitMode {
398 };
399 
400 // Flag indicating whether code is built into the VM (one of the natives files).
402 
403 
404 // A CodeDesc describes a buffer holding instructions and relocation
405 // information. The instructions start at the beginning of the buffer
406 // and grow forward, the relocation information starts at the end of
407 // the buffer and grows backward.
408 //
409 // |<--------------- buffer_size ---------------->|
410 // |<-- instr_size -->| |<-- reloc_size -->|
411 // +==================+========+==================+
412 // | instructions | free | reloc info |
413 // +==================+========+==================+
414 // ^
415 // |
416 // buffer
417 
418 struct CodeDesc {
419  byte* buffer;
424 };
425 
426 
427 // Callback function used for iterating objects in heap spaces,
428 // for example, scanning heap objects.
430 
431 
432 // Callback function used for checking constraints when copying/relocating
433 // objects. Returns true if an object can be copied/relocated from its
434 // old_addr to a new_addr.
435 typedef bool (*ConstraintCallback)(Address new_addr, Address old_addr);
436 
437 
438 // Callback function on inline caches, used for iterating over inline caches
439 // in compiled code.
440 typedef void (*InlineCacheCallback)(Code* code, Address ic);
441 
442 
443 // State for inline cache call sites. Aliased as IC::State.
445  // Has never been executed.
447  // Has been executed but monomorhic state has been delayed.
449  // Has been executed and only one receiver type has been seen.
451  // Check failed due to prototype (or map deprecation).
453  // Multiple receiver types have been seen.
455  // Many receiver types have been seen.
457  // A generic handler is installed and no extra typefeedback is recorded.
459  // Special state for debug break or step in prepare stubs.
461  // Type-vector-based ICs have a default state, with the full calculation
462  // of IC state only determined by a look at the IC and the typevector
463  // together.
464  DEFAULT
465 };
466 
467 
471  // Always wrap the receiver and call to the JSFunction. Only use this flag
472  // both the receiver type and the target method are statically known.
474 };
475 
476 
479  // The call target is cached in the instruction stream.
481 };
482 
483 
489 };
490 
491 
492 // The Store Buffer (GC).
493 typedef enum {
498 
499 
500 typedef void (*StoreBufferCallback)(Heap* heap,
501  MemoryChunk* page,
502  StoreBufferEvent event);
503 
504 
505 // Union used for fast testing of specific double values.
507  double value;
508  int64_t bits;
509  DoubleRepresentation(double x) { value = x; }
510  bool operator==(const DoubleRepresentation& other) const {
511  return bits == other.bits;
512  }
513 };
514 
515 
516 // Union used for customized checking of the IEEE double types
517 // inlined within v8 runtime, rather than going to the underlying
518 // platform headers and libraries
520  double d;
521  struct {
522  unsigned int man_low :32;
523  unsigned int man_high :20;
524  unsigned int exp :11;
525  unsigned int sign :1;
526  } bits;
527 };
528 
529 
531  double d;
532  struct {
533  unsigned int sign :1;
534  unsigned int exp :11;
535  unsigned int man_high :20;
536  unsigned int man_low :32;
537  } bits;
538 };
539 
540 
541 // AccessorCallback
543  Object* (*getter)(Isolate* isolate, Object* object, void* data);
544  Object* (*setter)(
545  Isolate* isolate, JSObject* object, Object* value, void* data);
546  void* data;
547 };
548 
549 
550 // Logging and profiling. A StateTag represents a possible state of
551 // the VM. The logger maintains a stack of these. Creating a VMState
552 // object enters a state by pushing on the stack, and destroying a
553 // VMState object leaves a state by popping the current state from the
554 // stack.
555 
556 enum StateTag {
557  JS,
558  GC,
562  IDLE
563 };
564 
565 
566 // -----------------------------------------------------------------------------
567 // Macros
568 
569 // Testers for test.
570 
571 #define HAS_SMI_TAG(value) \
572  ((reinterpret_cast<intptr_t>(value) & kSmiTagMask) == kSmiTag)
573 
574 #define HAS_FAILURE_TAG(value) \
575  ((reinterpret_cast<intptr_t>(value) & kFailureTagMask) == kFailureTag)
576 
577 // OBJECT_POINTER_ALIGN returns the value aligned as a HeapObject pointer
578 #define OBJECT_POINTER_ALIGN(value) \
579  (((value) + kObjectAlignmentMask) & ~kObjectAlignmentMask)
580 
581 // POINTER_SIZE_ALIGN returns the value aligned as a pointer.
582 #define POINTER_SIZE_ALIGN(value) \
583  (((value) + kPointerAlignmentMask) & ~kPointerAlignmentMask)
584 
585 // CODE_POINTER_ALIGN returns the value aligned as a generated code segment.
586 #define CODE_POINTER_ALIGN(value) \
587  (((value) + kCodeAlignmentMask) & ~kCodeAlignmentMask)
588 
589 // Support for tracking C++ memory allocation. Insert TRACK_MEMORY("Fisk")
590 // inside a C++ class and new and delete will be overloaded so logging is
591 // performed.
592 // This file (globals.h) is included before log.h, so we use direct calls to
593 // the Logger rather than the LOG macro.
594 #ifdef DEBUG
595 #define TRACK_MEMORY(name) \
596  void* operator new(size_t size) { \
597  void* result = ::operator new(size); \
598  Logger::NewEventStatic(name, result, size); \
599  return result; \
600  } \
601  void operator delete(void* object) { \
602  Logger::DeleteEventStatic(name, object); \
603  ::operator delete(object); \
604  }
605 #else
606 #define TRACK_MEMORY(name)
607 #endif
608 
609 
610 // CPU feature flags.
612  // x86
616  // ARM
625  // MIPS, MIPS64
631  // ARM64
634 };
635 
636 
637 // Used to specify if a macro instruction must perform a smi check on tagged
638 // values.
642 };
643 
644 
645 enum ScopeType {
646  EVAL_SCOPE, // The top-level scope for an eval source.
647  FUNCTION_SCOPE, // The top-level scope for a function.
648  MODULE_SCOPE, // The scope introduced by a module literal
649  GLOBAL_SCOPE, // The top-level scope for a program or a top-level eval.
650  CATCH_SCOPE, // The scope introduced by catch.
651  BLOCK_SCOPE, // The scope introduced by a new block.
652  WITH_SCOPE // The scope introduced by with.
653 };
654 
655 
656 const uint32_t kHoleNanUpper32 = 0x7FFFFFFF;
657 const uint32_t kHoleNanLower32 = 0xFFFFFFFF;
659 
660 const uint64_t kHoleNanInt64 =
661  (static_cast<uint64_t>(kHoleNanUpper32) << 32) | kHoleNanLower32;
662 const uint64_t kLastNonNaNInt64 =
663  (static_cast<uint64_t>(kNaNOrInfinityLowerBoundUpper32) << 32);
664 
665 
666 // The order of this enum has to be kept in sync with the predicates below.
668  // User declared variables:
669  VAR, // declared via 'var', and 'function' declarations
670 
671  CONST_LEGACY, // declared via legacy 'const' declarations
672 
673  LET, // declared via 'let' declarations (first lexical)
674 
675  CONST, // declared via 'const' declarations
676 
677  MODULE, // declared via 'module' declaration (last lexical)
678 
679  // Variables introduced by the compiler:
680  INTERNAL, // like VAR, but not user-visible (may or may not
681  // be in a context)
682 
683  TEMPORARY, // temporary variables (not user-visible), stack-allocated
684  // unless the scope as a whole has forced context allocation
685 
686  DYNAMIC, // always require dynamic lookup (we don't know
687  // the declaration)
688 
689  DYNAMIC_GLOBAL, // requires dynamic lookup, but we know that the
690  // variable is global unless it has been shadowed
691  // by an eval-introduced variable
692 
693  DYNAMIC_LOCAL // requires dynamic lookup, but we know that the
694  // variable is local and where it is unless it
695  // has been shadowed by an eval-introduced
696  // variable
697 };
698 
699 
701  return mode >= DYNAMIC && mode <= DYNAMIC_LOCAL;
702 }
703 
704 
706  return mode >= VAR && mode <= MODULE;
707 }
708 
709 
711  return mode >= LET && mode <= MODULE;
712 }
713 
714 
716  return (mode >= CONST && mode <= MODULE) || mode == CONST_LEGACY;
717 }
718 
719 
720 // ES6 Draft Rev3 10.2 specifies declarative environment records with mutable
721 // and immutable bindings that can be in two states: initialized and
722 // uninitialized. In ES5 only immutable bindings have these two states. When
723 // accessing a binding, it needs to be checked for initialization. However in
724 // the following cases the binding is initialized immediately after creation
725 // so the initialization check can always be skipped:
726 // 1. Var declared local variables.
727 // var foo;
728 // 2. A local variable introduced by a function declaration.
729 // function foo() {}
730 // 3. Parameters
731 // function x(foo) {}
732 // 4. Catch bound variables.
733 // try {} catch (foo) {}
734 // 6. Function variables of named function expressions.
735 // var x = function foo() {}
736 // 7. Implicit binding of 'this'.
737 // 8. Implicit binding of 'arguments' in functions.
738 //
739 // ES5 specified object environment records which are introduced by ES elements
740 // such as Program and WithStatement that associate identifier bindings with the
741 // properties of some object. In the specification only mutable bindings exist
742 // (which may be non-writable) and have no distinct initialization step. However
743 // V8 allows const declarations in global code with distinct creation and
744 // initialization steps which are represented by non-writable properties in the
745 // global object. As a result also these bindings need to be checked for
746 // initialization.
747 //
748 // The following enum specifies a flag that indicates if the binding needs a
749 // distinct initialization step (kNeedsInitialization) or if the binding is
750 // immediately initialized upon creation (kCreatedInitialized).
754 };
755 
756 
758 
759 
763 };
764 
765 
769 };
770 
771 
773 
774 
781 };
782 
783 
785  return kind == FunctionKind::kNormalFunction ||
790 }
791 
792 
793 inline bool IsArrowFunction(FunctionKind kind) {
795  return kind & FunctionKind::kArrowFunction;
796 }
797 
798 
801  return kind & FunctionKind::kGeneratorFunction;
802 }
803 
804 
805 inline bool IsConciseMethod(FunctionKind kind) {
807  return kind & FunctionKind::kConciseMethod;
808 }
809 } } // namespace v8::internal
810 
811 namespace i = v8::internal;
812 
813 #endif // V8_GLOBALS_H_
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long mode(MIPS only)") DEFINE_BOOL(enable_always_align_csp
#define DCHECK(condition)
Definition: logging.h:205
#define V8_UINT64_C(x)
Definition: macros.h:357
#define V8_INT64_C(x)
Definition: macros.h:358
unsigned short uint16_t
Definition: unicode.cc:23
int int32_t
Definition: unicode.cc:24
const int kOneByteSize
Definition: globals.h:186
bool(* WeakSlotCallback)(Object **pointer)
Definition: globals.h:349
const int kPointerSize
Definition: globals.h:129
bool(* ConstraintCallback)(Address new_addr, Address old_addr)
Definition: globals.h:435
const uint32_t kDebugZapValue
Definition: globals.h:274
bool(* WeakSlotCallbackWithHeap)(Heap *heap, Object **pointer)
Definition: globals.h:351
@ ALWAYS_ALIGN_CSP
Definition: globals.h:632
@ MOVW_MOVT_IMMEDIATE_LOADS
Definition: globals.h:622
@ UNALIGNED_ACCESSES
Definition: globals.h:621
@ NUMBER_OF_CPU_FEATURES
Definition: globals.h:633
@ DONT_DO_SMI_CHECK
Definition: globals.h:640
@ DO_SMI_CHECK
Definition: globals.h:641
const int kMaxUInt8
Definition: globals.h:113
bool IsValidFunctionKind(FunctionKind kind)
Definition: globals.h:784
const int KB
Definition: globals.h:106
@ NOT_EXECUTABLE
Definition: globals.h:391
const int kBitsPerInt
Definition: globals.h:165
InitializationFlag
Definition: globals.h:751
@ kNeedsInitialization
Definition: globals.h:752
@ kCreatedInitialized
Definition: globals.h:753
bool IsArrowFunction(FunctionKind kind)
Definition: globals.h:793
const int kBinary32MantissaBits
Definition: globals.h:174
const int kSpaceTagMask
Definition: globals.h:375
const int kBinary32ExponentShift
Definition: globals.h:175
const uintptr_t kUintptrAllBitsSet
Definition: globals.h:149
ClearExceptionFlag
Definition: globals.h:760
@ KEEP_EXCEPTION
Definition: globals.h:761
@ CLEAR_EXCEPTION
Definition: globals.h:762
const Address kHandleZapValue
Definition: globals.h:270
const int kBinary32MinExponent
Definition: globals.h:173
const int kPCOnStackSize
Definition: globals.h:135
@ VISIT_ONLY_STRONG
Definition: globals.h:397
@ VISIT_ALL_IN_SWEEP_NEWSPACE
Definition: globals.h:396
@ VISIT_ALL_IN_SCAVENGE
Definition: globals.h:395
const intptr_t kPointerAlignmentMask
Definition: globals.h:231
const intptr_t kCodeAlignment
Definition: globals.h:240
bool IsLexicalVariableMode(VariableMode mode)
Definition: globals.h:710
const intptr_t kSmiSignMask
Definition: globals.h:223
bool IsDeclaredVariableMode(VariableMode mode)
Definition: globals.h:705
const int kBinary32ExponentBias
Definition: globals.h:171
const int kMaxInt8
Definition: globals.h:111
const Address kGlobalHandleZapValue
Definition: globals.h:271
const intptr_t kPageHeaderTagMask
Definition: globals.h:251
@ USE_DEFAULT_MINIMUM_CAPACITY
Definition: globals.h:385
@ USE_CUSTOM_MINIMUM_CAPACITY
Definition: globals.h:386
const int kDoubleSizeLog2
Definition: globals.h:138
const int kDoubleSize
Definition: globals.h:127
bool IsGeneratorFunction(FunctionKind kind)
Definition: globals.h:799
const size_t kMaximalCodeRangeSize
Definition: globals.h:156
bool IsConciseMethod(FunctionKind kind)
Definition: globals.h:805
const Address kZapValue
Definition: globals.h:269
const int kIntptrSize
Definition: globals.h:128
void(* InlineCacheCallback)(Code *code, Address ic)
Definition: globals.h:440
const int kMaxInt
Definition: globals.h:109
const int kMinInt8
Definition: globals.h:112
const int kPointerSizeLog2
Definition: globals.h:147
const int kPageHeaderTag
Definition: globals.h:249
@ kStoreBufferScanningPageEvent
Definition: globals.h:496
@ kStoreBufferStartScanningPagesEvent
Definition: globals.h:495
@ kStoreBufferFullEvent
Definition: globals.h:494
@ kCacheOnPrototype
Definition: globals.h:485
@ kCacheOnReceiver
Definition: globals.h:488
@ kCacheOnPrototypeReceiverIsPrimitive
Definition: globals.h:487
@ kCacheOnPrototypeReceiverIsDictionary
Definition: globals.h:486
@ kNotAssigned
Definition: globals.h:757
@ kMaybeAssigned
Definition: globals.h:757
const int kBitsPerPointer
Definition: globals.h:164
const int kMinUInt8
Definition: globals.h:114
const int kRegisterSize
Definition: globals.h:133
const intptr_t kObjectAlignmentMask
Definition: globals.h:227
@ FAIL_ON_MINUS_ZERO
Definition: globals.h:768
@ TREAT_MINUS_ZERO_AS_ZERO
Definition: globals.h:767
const int kShortSize
Definition: globals.h:123
const intptr_t kObjectAlignment
Definition: globals.h:226
bool IsImmutableVariableMode(VariableMode mode)
Definition: globals.h:715
const int kUC16Size
Definition: globals.h:187
const int kInt64Size
Definition: globals.h:126
const uint64_t kLastNonNaNInt64
Definition: globals.h:662
const Address kFromSpaceZapValue
Definition: globals.h:272
@ DYNAMIC_GLOBAL
Definition: globals.h:689
@ DYNAMIC_LOCAL
Definition: globals.h:693
@ CONST_LEGACY
Definition: globals.h:671
const uint32_t kFreeListZapValue
Definition: globals.h:275
const bool kRequiresCodeRange
Definition: globals.h:155
const int kInt32Size
Definition: globals.h:125
const int kMinUInt16
Definition: globals.h:118
const int kBinary32MaxExponent
Definition: globals.h:172
const int kBitsPerByteLog2
Definition: globals.h:163
const int kMinInt
Definition: globals.h:110
byte * Address
Definition: globals.h:101
const intptr_t kCodeAlignmentMask
Definition: globals.h:241
const uint32_t kQuietNaNHighBitsMask
Definition: globals.h:287
void(* StoreBufferCallback)(Heap *heap, MemoryChunk *page, StoreBufferEvent event)
Definition: globals.h:500
const uint32_t kBinary32SignMask
Definition: globals.h:168
const int kIntSize
Definition: globals.h:124
const uint64_t kQuietNaNMask
Definition: globals.h:179
@ FIRST_PAGED_SPACE
Definition: globals.h:371
@ INVALID_SPACE
Definition: globals.h:367
@ LAST_PAGED_SPACE
Definition: globals.h:372
@ OLD_DATA_SPACE
Definition: globals.h:361
@ PROPERTY_CELL_SPACE
Definition: globals.h:365
@ OLD_POINTER_SPACE
Definition: globals.h:360
const int kPageHeaderTagSize
Definition: globals.h:250
const int kFPOnStackSize
Definition: globals.h:136
int(* HeapObjectCallback)(HeapObject *obj)
Definition: globals.h:429
const int kObjectAlignmentBits
Definition: globals.h:225
const int kCodeAlignmentBits
Definition: globals.h:239
const uint32_t kBinary32ExponentMask
Definition: globals.h:169
const int kMaxInt16
Definition: globals.h:115
STATIC_ASSERT(sizeof(CPURegister)==sizeof(Register))
const uint64_t kHoleNanInt64
Definition: globals.h:660
const int kBitsPerByte
Definition: globals.h:162
const intptr_t kIntptrSignBit
Definition: globals.h:148
const int kMaxUInt16
Definition: globals.h:117
CallConstructorFlags
Definition: globals.h:477
@ NO_CALL_CONSTRUCTOR_FLAGS
Definition: globals.h:478
@ RECORD_CONSTRUCTOR_TARGET
Definition: globals.h:480
const uint32_t kNaNOrInfinityLowerBoundUpper32
Definition: globals.h:658
bool IsDynamicVariableMode(VariableMode mode)
Definition: globals.h:700
uint16_t uc16
Definition: globals.h:184
const int MB
Definition: globals.h:107
const int kCodeZapValue
Definition: globals.h:278
const uint32_t kMaxUInt32
Definition: globals.h:120
const int kSpaceTagSize
Definition: globals.h:374
@ FUNCTION_SCOPE
Definition: globals.h:647
@ MODULE_SCOPE
Definition: globals.h:648
@ GLOBAL_SCOPE
Definition: globals.h:649
const uint32_t kHoleNanLower32
Definition: globals.h:657
const int kMinInt16
Definition: globals.h:116
@ MARK_COMPACTOR
Definition: globals.h:389
const uint32_t kSlotsZapValue
Definition: globals.h:273
@ NOT_NATIVES_CODE
Definition: globals.h:401
@ NATIVES_CODE
Definition: globals.h:401
int32_t uc32
Definition: globals.h:185
@ NO_CALL_FUNCTION_FLAGS
Definition: globals.h:469
@ WRAP_AND_CALL
Definition: globals.h:473
@ CALL_AS_METHOD
Definition: globals.h:470
const int GB
Definition: globals.h:108
const int kCharSize
Definition: globals.h:122
const intptr_t kDoubleAlignment
Definition: globals.h:234
const intptr_t kPointerAlignment
Definition: globals.h:230
@ kNormalFunction
Definition: globals.h:776
@ kGeneratorFunction
Definition: globals.h:778
@ kConciseGeneratorMethod
Definition: globals.h:780
@ kConciseMethod
Definition: globals.h:779
@ kArrowFunction
Definition: globals.h:777
const uint32_t kBinary32MantissaMask
Definition: globals.h:170
F FUNCTION_CAST(Address addr)
Definition: globals.h:202
@ UNINITIALIZED
Definition: globals.h:446
@ PROTOTYPE_FAILURE
Definition: globals.h:452
@ PREMONOMORPHIC
Definition: globals.h:448
const intptr_t kDoubleAlignmentMask
Definition: globals.h:235
const uint32_t kHoleNanUpper32
Definition: globals.h:656
uint8_t byte
Definition: globals.h:100
Debugger support for the V8 JavaScript engine.
Definition: accessors.cc:20
Assembler * origin
Definition: globals.h:423
bool operator==(const DoubleRepresentation &other) const
Definition: globals.h:510
struct v8::internal::IeeeDoubleBigEndianArchType::@16 bits
struct v8::internal::IeeeDoubleLittleEndianArchType::@15 bits