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.
8 #include "include/v8stdint.h"
10 #include "src/base/build_config.h"
11 #include "src/base/logging.h"
12 #include "src/base/macros.h"
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()
23 # define V8_INFINITY HUGE_VAL
25 # define V8_INFINITY INFINITY
28 #if V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_ARM || \
30 #define V8_TURBOFAN_BACKEND 1
32 #define V8_TURBOFAN_BACKEND 0
34 #if V8_TURBOFAN_BACKEND && !(V8_OS_WIN && V8_TARGET_ARCH_X64)
35 #define V8_TURBOFAN_TARGET 1
37 #define V8_TURBOFAN_TARGET 0
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
57 #if (V8_TARGET_ARCH_ARM && !V8_HOST_ARCH_ARM)
58 #define USE_SIMULATOR 1
60 #if (V8_TARGET_ARCH_MIPS && !V8_HOST_ARCH_MIPS)
61 #define USE_SIMULATOR 1
63 #if (V8_TARGET_ARCH_MIPS64 && !V8_HOST_ARCH_MIPS64)
64 #define USE_SIMULATOR 1
68 // Determine whether the architecture uses an out-of-line constant pool.
69 #define V8_OOL_CONSTANT_POOL 0
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
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
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
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.
96 typedef unsigned int __my_bool__;
97 #define bool __my_bool__ // use 'indirection' to avoid name clashes
100 typedef uint8_t byte;
101 typedef byte* Address;
103 // -----------------------------------------------------------------------------
106 struct float32x4_value_t { float storage[4]; };
107 struct float64x2_value_t { double storage[2]; };
108 struct int32x4_value_t { int32_t storage[4]; };
109 union simd128_value_t {
111 float32x4_value_t f4;
112 float64x2_value_t d2;
117 const int MB = KB * KB;
118 const int GB = KB * KB * KB;
119 const int kMaxInt = 0x7FFFFFFF;
120 const int kMinInt = -kMaxInt - 1;
121 const int kMaxInt8 = (1 << 7) - 1;
122 const int kMinInt8 = -(1 << 7);
123 const int kMaxUInt8 = (1 << 8) - 1;
124 const int kMinUInt8 = 0;
125 const int kMaxInt16 = (1 << 15) - 1;
126 const int kMinInt16 = -(1 << 15);
127 const int kMaxUInt16 = (1 << 16) - 1;
128 const int kMinUInt16 = 0;
130 const uint32_t kMaxUInt32 = 0xFFFFFFFFu;
132 const int kCharSize = sizeof(char); // NOLINT
133 const int kShortSize = sizeof(short); // NOLINT
134 const int kIntSize = sizeof(int); // NOLINT
135 const int kInt32Size = sizeof(int32_t); // NOLINT
136 const int kInt64Size = sizeof(int64_t); // NOLINT
137 const int kDoubleSize = sizeof(double); // NOLINT
138 const int kFloatSize = sizeof(float); // NOLINT
139 const int kFloat32x4Size = sizeof(float32x4_value_t); // NOLINT
140 const int kFloat64x2Size = sizeof(float64x2_value_t); // NOLINT
141 const int kInt32x4Size = sizeof(int32x4_value_t); // NOLINT
142 const int kSIMD128Size = sizeof(simd128_value_t); // NOLINT
143 const int kIntptrSize = sizeof(intptr_t); // NOLINT
144 const int kPointerSize = sizeof(void*); // NOLINT
145 #if V8_TARGET_ARCH_X64 && V8_TARGET_ARCH_32_BIT
146 const int kRegisterSize = kPointerSize + kPointerSize;
148 const int kRegisterSize = kPointerSize;
150 const int kPCOnStackSize = kRegisterSize;
151 const int kFPOnStackSize = kRegisterSize;
153 const int kDoubleSizeLog2 = 3;
155 #if V8_HOST_ARCH_64_BIT
156 const int kPointerSizeLog2 = 3;
157 const intptr_t kIntptrSignBit = V8_INT64_C(0x8000000000000000);
158 const uintptr_t kUintptrAllBitsSet = V8_UINT64_C(0xFFFFFFFFFFFFFFFF);
159 const bool kRequiresCodeRange = true;
160 const size_t kMaximalCodeRangeSize = 512 * MB;
162 const int kPointerSizeLog2 = 2;
163 const intptr_t kIntptrSignBit = 0x80000000;
164 const uintptr_t kUintptrAllBitsSet = 0xFFFFFFFFu;
165 #if V8_TARGET_ARCH_X64 && V8_TARGET_ARCH_32_BIT
166 // x32 port also requires code range.
167 const bool kRequiresCodeRange = true;
168 const size_t kMaximalCodeRangeSize = 256 * MB;
170 const bool kRequiresCodeRange = false;
171 const size_t kMaximalCodeRangeSize = 0 * MB;
175 STATIC_ASSERT(kPointerSize == (1 << kPointerSizeLog2));
177 const int kBitsPerByte = 8;
178 const int kBitsPerByteLog2 = 3;
179 const int kBitsPerPointer = kPointerSize * kBitsPerByte;
180 const int kBitsPerInt = kIntSize * kBitsPerByte;
182 // IEEE 754 single precision floating point number bit layout.
183 const uint32_t kBinary32SignMask = 0x80000000u;
184 const uint32_t kBinary32ExponentMask = 0x7f800000u;
185 const uint32_t kBinary32MantissaMask = 0x007fffffu;
186 const int kBinary32ExponentBias = 127;
187 const int kBinary32MaxExponent = 0xFE;
188 const int kBinary32MinExponent = 0x01;
189 const int kBinary32MantissaBits = 23;
190 const int kBinary32ExponentShift = 23;
192 // Quiet NaNs have bits 51 to 62 set, possibly the sign bit, and no
194 const uint64_t kQuietNaNMask = static_cast<uint64_t>(0xfff) << 51;
196 // Latin1/UTF-16 constants
197 // Code-point values in Unicode 4.0 are 21 bits wide.
198 // Code units in UTF-16 are 16 bits wide.
199 typedef uint16_t uc16;
200 typedef int32_t uc32;
201 const int kOneByteSize = kCharSize;
202 const int kUC16Size = sizeof(uc16); // NOLINT
205 // Round up n to be a multiple of sz, where sz is a power of 2.
206 #define ROUND_UP(n, sz) (((n) + ((sz) - 1)) & ~((sz) - 1))
209 // FUNCTION_ADDR(f) gets the address of a C function f.
210 #define FUNCTION_ADDR(f) \
211 (reinterpret_cast<v8::internal::Address>(reinterpret_cast<intptr_t>(f)))
214 // FUNCTION_CAST<F>(addr) casts an address into a function
215 // of type F. Used to invoke generated code from within C.
216 template <typename F>
217 F FUNCTION_CAST(Address addr) {
218 return reinterpret_cast<F>(reinterpret_cast<intptr_t>(addr));
222 // -----------------------------------------------------------------------------
223 // Forward declarations for frequently used classes
224 // (sorted alphabetically)
226 class FreeStoreAllocationPolicy;
227 template <typename T, class P = FreeStoreAllocationPolicy> class List;
229 // -----------------------------------------------------------------------------
230 // Declarations for use in both the preparser and the rest of V8.
232 // The Strict Mode (ECMA-262 5th edition, 4.2.2).
234 enum StrictMode { SLOPPY, STRICT };
237 // Mask for the sign bit in a smi.
238 const intptr_t kSmiSignMask = kIntptrSignBit;
240 const int kObjectAlignmentBits = kPointerSizeLog2;
241 const intptr_t kObjectAlignment = 1 << kObjectAlignmentBits;
242 const intptr_t kObjectAlignmentMask = kObjectAlignment - 1;
244 // Desired alignment for pointers.
245 const intptr_t kPointerAlignment = (1 << kPointerSizeLog2);
246 const intptr_t kPointerAlignmentMask = kPointerAlignment - 1;
248 // Desired alignment for double values.
249 const intptr_t kDoubleAlignment = 8;
250 const intptr_t kDoubleAlignmentMask = kDoubleAlignment - 1;
252 // Desired alignment for generated code is 32 bytes (to improve cache line
254 const int kCodeAlignmentBits = 5;
255 const intptr_t kCodeAlignment = 1 << kCodeAlignmentBits;
256 const intptr_t kCodeAlignmentMask = kCodeAlignment - 1;
258 // The owner field of a page is tagged with the page header tag. We need that
259 // to find out if a slot is part of a large object. If we mask out the lower
260 // 0xfffff bits (1M pages), go to the owner offset, and see that this field
261 // is tagged with the page header tag, we can just look up the owner.
262 // Otherwise, we know that we are somewhere (not within the first 1M) in a
264 const int kPageHeaderTag = 3;
265 const int kPageHeaderTagSize = 2;
266 const intptr_t kPageHeaderTagMask = (1 << kPageHeaderTagSize) - 1;
269 // Zap-value: The value used for zapping dead objects.
270 // Should be a recognizable hex value tagged as a failure.
271 #ifdef V8_HOST_ARCH_64_BIT
272 const Address kZapValue =
273 reinterpret_cast<Address>(V8_UINT64_C(0xdeadbeedbeadbeef));
274 const Address kHandleZapValue =
275 reinterpret_cast<Address>(V8_UINT64_C(0x1baddead0baddeaf));
276 const Address kGlobalHandleZapValue =
277 reinterpret_cast<Address>(V8_UINT64_C(0x1baffed00baffedf));
278 const Address kFromSpaceZapValue =
279 reinterpret_cast<Address>(V8_UINT64_C(0x1beefdad0beefdaf));
280 const uint64_t kDebugZapValue = V8_UINT64_C(0xbadbaddbbadbaddb);
281 const uint64_t kSlotsZapValue = V8_UINT64_C(0xbeefdeadbeefdeef);
282 const uint64_t kFreeListZapValue = 0xfeed1eaffeed1eaf;
284 const Address kZapValue = reinterpret_cast<Address>(0xdeadbeef);
285 const Address kHandleZapValue = reinterpret_cast<Address>(0xbaddeaf);
286 const Address kGlobalHandleZapValue = reinterpret_cast<Address>(0xbaffedf);
287 const Address kFromSpaceZapValue = reinterpret_cast<Address>(0xbeefdaf);
288 const uint32_t kSlotsZapValue = 0xbeefdeef;
289 const uint32_t kDebugZapValue = 0xbadbaddb;
290 const uint32_t kFreeListZapValue = 0xfeed1eaf;
293 const int kCodeZapValue = 0xbadc0de;
295 // On Intel architecture, cache line size is 64 bytes.
296 // On ARM it may be less (32 bytes), but as far this constant is
297 // used for aligning data, it doesn't hurt to align on a greater value.
298 #define PROCESSOR_CACHE_LINE_SIZE 64
300 // Constants relevant to double precision floating point numbers.
301 // If looking only at the top 32 bits, the QNaN mask is bits 19 to 30.
302 const uint32_t kQuietNaNHighBitsMask = 0xfff << (51 - 32);
305 // -----------------------------------------------------------------------------
306 // Forward declarations for frequently used classes
320 class DescriptorArray;
321 class TransitionArray;
322 class ExternalReference;
324 class FunctionTemplateInfo;
326 class SeededNumberDictionary;
327 class UnseededNumberDictionary;
328 class NameDictionary;
329 template <typename T> class MaybeHandle;
330 template <typename T> class Handle;
334 class InterceptorInfo;
340 class LargeObjectSpace;
342 class MacroAssembler;
345 class MarkCompactCollector;
354 template <typename Config, class Allocator = FreeStoreAllocationPolicy>
362 class MessageLocation;
364 typedef bool (*WeakSlotCallback)(Object** pointer);
366 typedef bool (*WeakSlotCallbackWithHeap)(Heap* heap, Object** pointer);
368 // -----------------------------------------------------------------------------
371 // NOTE: SpaceIterator depends on AllocationSpace enumeration values being
373 enum AllocationSpace {
374 NEW_SPACE, // Semispaces collected with copying collector.
375 OLD_POINTER_SPACE, // May contain pointers to new space.
376 OLD_DATA_SPACE, // Must not have pointers to new space.
377 CODE_SPACE, // No pointers to new space, marked executable.
378 MAP_SPACE, // Only and all map objects.
379 CELL_SPACE, // Only and all cell objects.
380 PROPERTY_CELL_SPACE, // Only and all global property cell objects.
381 LO_SPACE, // Promoted large objects.
382 INVALID_SPACE, // Only used in AllocationResult to signal success.
384 FIRST_SPACE = NEW_SPACE,
385 LAST_SPACE = LO_SPACE,
386 FIRST_PAGED_SPACE = OLD_POINTER_SPACE,
387 LAST_PAGED_SPACE = PROPERTY_CELL_SPACE
389 const int kSpaceTagSize = 3;
390 const int kSpaceTagMask = (1 << kSpaceTagSize) - 1;
393 // A flag that indicates whether objects should be pretenured when
394 // allocated (allocated directly into the old generation) or not
395 // (allocated in the young generation if the object size and type
397 enum PretenureFlag { NOT_TENURED, TENURED };
399 enum MinimumCapacity {
400 USE_DEFAULT_MINIMUM_CAPACITY,
401 USE_CUSTOM_MINIMUM_CAPACITY
404 enum GarbageCollector { SCAVENGER, MARK_COMPACTOR };
406 enum Executability { NOT_EXECUTABLE, EXECUTABLE };
410 VISIT_ALL_IN_SCAVENGE,
411 VISIT_ALL_IN_SWEEP_NEWSPACE,
415 // Flag indicating whether code is built into the VM (one of the natives files).
416 enum NativesFlag { NOT_NATIVES_CODE, NATIVES_CODE };
419 // A CodeDesc describes a buffer holding instructions and relocation
420 // information. The instructions start at the beginning of the buffer
421 // and grow forward, the relocation information starts at the end of
422 // the buffer and grows backward.
424 // |<--------------- buffer_size ---------------->|
425 // |<-- instr_size -->| |<-- reloc_size -->|
426 // +==================+========+==================+
427 // | instructions | free | reloc info |
428 // +==================+========+==================+
442 // Callback function used for iterating objects in heap spaces,
443 // for example, scanning heap objects.
444 typedef int (*HeapObjectCallback)(HeapObject* obj);
447 // Callback function used for checking constraints when copying/relocating
448 // objects. Returns true if an object can be copied/relocated from its
449 // old_addr to a new_addr.
450 typedef bool (*ConstraintCallback)(Address new_addr, Address old_addr);
453 // Callback function on inline caches, used for iterating over inline caches
455 typedef void (*InlineCacheCallback)(Code* code, Address ic);
458 // State for inline cache call sites. Aliased as IC::State.
459 enum InlineCacheState {
460 // Has never been executed.
462 // Has been executed but monomorhic state has been delayed.
464 // Has been executed and only one receiver type has been seen.
466 // Check failed due to prototype (or map deprecation).
468 // Multiple receiver types have been seen.
470 // Many receiver types have been seen.
472 // A generic handler is installed and no extra typefeedback is recorded.
474 // Special state for debug break or step in prepare stubs.
476 // Type-vector-based ICs have a default state, with the full calculation
477 // of IC state only determined by a look at the IC and the typevector
483 enum CallFunctionFlags {
484 NO_CALL_FUNCTION_FLAGS,
486 // Always wrap the receiver and call to the JSFunction. Only use this flag
487 // both the receiver type and the target method are statically known.
492 enum CallConstructorFlags {
493 NO_CALL_CONSTRUCTOR_FLAGS,
494 // The call target is cached in the instruction stream.
495 RECORD_CONSTRUCTOR_TARGET
499 enum CacheHolderFlag {
501 kCacheOnPrototypeReceiverIsDictionary,
502 kCacheOnPrototypeReceiverIsPrimitive,
507 // The Store Buffer (GC).
509 kStoreBufferFullEvent,
510 kStoreBufferStartScanningPagesEvent,
511 kStoreBufferScanningPageEvent
515 typedef void (*StoreBufferCallback)(Heap* heap,
517 StoreBufferEvent event);
520 // Union used for fast testing of specific double values.
521 union DoubleRepresentation {
524 DoubleRepresentation(double x) { value = x; }
525 bool operator==(const DoubleRepresentation& other) const {
526 return bits == other.bits;
531 // Union used for customized checking of the IEEE double types
532 // inlined within v8 runtime, rather than going to the underlying
533 // platform headers and libraries
534 union IeeeDoubleLittleEndianArchType {
537 unsigned int man_low :32;
538 unsigned int man_high :20;
539 unsigned int exp :11;
540 unsigned int sign :1;
545 union IeeeDoubleBigEndianArchType {
548 unsigned int sign :1;
549 unsigned int exp :11;
550 unsigned int man_high :20;
551 unsigned int man_low :32;
557 struct AccessorDescriptor {
558 Object* (*getter)(Isolate* isolate, Object* object, void* data);
560 Isolate* isolate, JSObject* object, Object* value, void* data);
565 // Logging and profiling. A StateTag represents a possible state of
566 // the VM. The logger maintains a stack of these. Creating a VMState
567 // object enters a state by pushing on the stack, and destroying a
568 // VMState object leaves a state by popping the current state from the
581 // -----------------------------------------------------------------------------
586 #define HAS_SMI_TAG(value) \
587 ((reinterpret_cast<intptr_t>(value) & kSmiTagMask) == kSmiTag)
589 #define HAS_FAILURE_TAG(value) \
590 ((reinterpret_cast<intptr_t>(value) & kFailureTagMask) == kFailureTag)
592 // OBJECT_POINTER_ALIGN returns the value aligned as a HeapObject pointer
593 #define OBJECT_POINTER_ALIGN(value) \
594 (((value) + kObjectAlignmentMask) & ~kObjectAlignmentMask)
596 // POINTER_SIZE_ALIGN returns the value aligned as a pointer.
597 #define POINTER_SIZE_ALIGN(value) \
598 (((value) + kPointerAlignmentMask) & ~kPointerAlignmentMask)
600 // CODE_POINTER_ALIGN returns the value aligned as a generated code segment.
601 #define CODE_POINTER_ALIGN(value) \
602 (((value) + kCodeAlignmentMask) & ~kCodeAlignmentMask)
604 // Support for tracking C++ memory allocation. Insert TRACK_MEMORY("Fisk")
605 // inside a C++ class and new and delete will be overloaded so logging is
607 // This file (globals.h) is included before log.h, so we use direct calls to
608 // the Logger rather than the LOG macro.
610 #define TRACK_MEMORY(name) \
611 void* operator new(size_t size) { \
612 void* result = ::operator new(size); \
613 Logger::NewEventStatic(name, result, size); \
616 void operator delete(void* object) { \
617 Logger::DeleteEventStatic(name, object); \
618 ::operator delete(object); \
621 #define TRACK_MEMORY(name)
625 // CPU feature flags.
637 MOVW_MOVT_IMMEDIATE_LOADS,
648 NUMBER_OF_CPU_FEATURES
652 // Used to specify if a macro instruction must perform a smi check on tagged
661 EVAL_SCOPE, // The top-level scope for an eval source.
662 FUNCTION_SCOPE, // The top-level scope for a function.
663 MODULE_SCOPE, // The scope introduced by a module literal
664 GLOBAL_SCOPE, // The top-level scope for a program or a top-level eval.
665 CATCH_SCOPE, // The scope introduced by catch.
666 BLOCK_SCOPE, // The scope introduced by a new block.
667 WITH_SCOPE // The scope introduced by with.
671 const uint32_t kHoleNanUpper32 = 0x7FFFFFFF;
672 const uint32_t kHoleNanLower32 = 0xFFFFFFFF;
673 const uint32_t kNaNOrInfinityLowerBoundUpper32 = 0x7FF00000;
675 const uint64_t kHoleNanInt64 =
676 (static_cast<uint64_t>(kHoleNanUpper32) << 32) | kHoleNanLower32;
677 const uint64_t kLastNonNaNInt64 =
678 (static_cast<uint64_t>(kNaNOrInfinityLowerBoundUpper32) << 32);
681 // The order of this enum has to be kept in sync with the predicates below.
683 // User declared variables:
684 VAR, // declared via 'var', and 'function' declarations
686 CONST_LEGACY, // declared via legacy 'const' declarations
688 LET, // declared via 'let' declarations (first lexical)
690 CONST, // declared via 'const' declarations
692 MODULE, // declared via 'module' declaration (last lexical)
694 // Variables introduced by the compiler:
695 INTERNAL, // like VAR, but not user-visible (may or may not
698 TEMPORARY, // temporary variables (not user-visible), stack-allocated
699 // unless the scope as a whole has forced context allocation
701 DYNAMIC, // always require dynamic lookup (we don't know
704 DYNAMIC_GLOBAL, // requires dynamic lookup, but we know that the
705 // variable is global unless it has been shadowed
706 // by an eval-introduced variable
708 DYNAMIC_LOCAL // requires dynamic lookup, but we know that the
709 // variable is local and where it is unless it
710 // has been shadowed by an eval-introduced
715 inline bool IsDynamicVariableMode(VariableMode mode) {
716 return mode >= DYNAMIC && mode <= DYNAMIC_LOCAL;
720 inline bool IsDeclaredVariableMode(VariableMode mode) {
721 return mode >= VAR && mode <= MODULE;
725 inline bool IsLexicalVariableMode(VariableMode mode) {
726 return mode >= LET && mode <= MODULE;
730 inline bool IsImmutableVariableMode(VariableMode mode) {
731 return (mode >= CONST && mode <= MODULE) || mode == CONST_LEGACY;
735 // ES6 Draft Rev3 10.2 specifies declarative environment records with mutable
736 // and immutable bindings that can be in two states: initialized and
737 // uninitialized. In ES5 only immutable bindings have these two states. When
738 // accessing a binding, it needs to be checked for initialization. However in
739 // the following cases the binding is initialized immediately after creation
740 // so the initialization check can always be skipped:
741 // 1. Var declared local variables.
743 // 2. A local variable introduced by a function declaration.
746 // function x(foo) {}
747 // 4. Catch bound variables.
748 // try {} catch (foo) {}
749 // 6. Function variables of named function expressions.
750 // var x = function foo() {}
751 // 7. Implicit binding of 'this'.
752 // 8. Implicit binding of 'arguments' in functions.
754 // ES5 specified object environment records which are introduced by ES elements
755 // such as Program and WithStatement that associate identifier bindings with the
756 // properties of some object. In the specification only mutable bindings exist
757 // (which may be non-writable) and have no distinct initialization step. However
758 // V8 allows const declarations in global code with distinct creation and
759 // initialization steps which are represented by non-writable properties in the
760 // global object. As a result also these bindings need to be checked for
763 // The following enum specifies a flag that indicates if the binding needs a
764 // distinct initialization step (kNeedsInitialization) or if the binding is
765 // immediately initialized upon creation (kCreatedInitialized).
766 enum InitializationFlag {
767 kNeedsInitialization,
772 enum MaybeAssignedFlag { kNotAssigned, kMaybeAssigned };
775 enum ClearExceptionFlag {
782 TREAT_MINUS_ZERO_AS_ZERO,
787 enum Signedness { kSigned, kUnsigned };
793 kGeneratorFunction = 2,
795 kConciseGeneratorMethod = kGeneratorFunction | kConciseMethod
799 inline bool IsValidFunctionKind(FunctionKind kind) {
800 return kind == FunctionKind::kNormalFunction ||
801 kind == FunctionKind::kArrowFunction ||
802 kind == FunctionKind::kGeneratorFunction ||
803 kind == FunctionKind::kConciseMethod ||
804 kind == FunctionKind::kConciseGeneratorMethod;
808 inline bool IsArrowFunction(FunctionKind kind) {
809 DCHECK(IsValidFunctionKind(kind));
810 return kind & FunctionKind::kArrowFunction;
814 inline bool IsGeneratorFunction(FunctionKind kind) {
815 DCHECK(IsValidFunctionKind(kind));
816 return kind & FunctionKind::kGeneratorFunction;
820 inline bool IsConciseMethod(FunctionKind kind) {
821 DCHECK(IsValidFunctionKind(kind));
822 return kind & FunctionKind::kConciseMethod;
824 } } // namespace v8::internal
826 namespace i = v8::internal;
828 #endif // V8_GLOBALS_H_