#ifndef V8_GLOBALS_H_
#define V8_GLOBALS_H_
-#include "include/v8stdint.h"
+#include <stddef.h>
+#include <stdint.h>
#include "src/base/build_config.h"
#include "src/base/logging.h"
#endif
#if V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_ARM || \
- V8_TARGET_ARCH_ARM64
+ V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_MIPS
#define V8_TURBOFAN_BACKEND 1
#else
#define V8_TURBOFAN_BACKEND 0
#endif
-#if V8_TURBOFAN_BACKEND && !V8_TARGET_ARCH_ARM64 && \
- !(V8_OS_WIN && V8_TARGET_ARCH_X64)
+#if V8_TURBOFAN_BACKEND && !(V8_OS_WIN && V8_TARGET_ARCH_X64)
#define V8_TURBOFAN_TARGET 1
#else
#define V8_TURBOFAN_TARGET 0
// Determine whether the architecture uses an out-of-line constant pool.
#define V8_OOL_CONSTANT_POOL 0
+#ifdef V8_TARGET_ARCH_ARM
+// Set stack limit lower for ARM than for other architectures because
+// stack allocating MacroAssembler takes 120K bytes.
+// See issue crbug.com/405338
+#define V8_DEFAULT_STACK_SIZE_KB 864
+#else
+// Slightly less than 1MB, since Windows' default stack size for
+// the main execution thread is 1MB for both 32 and 64-bit.
+#define V8_DEFAULT_STACK_SIZE_KB 984
+#endif
+
+
// Support for alternative bool type. This is only enabled if the code is
// compiled with USE_MYBOOL defined. This catches some nasty type bugs.
// For instance, 'bool b = "false";' results in b == true! This is a hidden
// -----------------------------------------------------------------------------
// Constants
+struct float32x4_value_t { float storage[4]; };
+struct float64x2_value_t { double storage[2]; };
+struct int32x4_value_t { int32_t storage[4]; };
+union simd128_value_t {
+ double d[2];
+ float32x4_value_t f4;
+ float64x2_value_t d2;
+ int32x4_value_t i4;
+};
+
const int KB = 1024;
const int MB = KB * KB;
const int GB = KB * KB * KB;
const uint32_t kMaxUInt32 = 0xFFFFFFFFu;
-const int kCharSize = sizeof(char); // NOLINT
-const int kShortSize = sizeof(short); // NOLINT
-const int kIntSize = sizeof(int); // NOLINT
-const int kInt32Size = sizeof(int32_t); // NOLINT
-const int kInt64Size = sizeof(int64_t); // NOLINT
-const int kDoubleSize = sizeof(double); // NOLINT
-const int kIntptrSize = sizeof(intptr_t); // NOLINT
-const int kPointerSize = sizeof(void*); // NOLINT
+const int kCharSize = sizeof(char); // NOLINT
+const int kShortSize = sizeof(short); // NOLINT
+const int kIntSize = sizeof(int); // NOLINT
+const int kInt32Size = sizeof(int32_t); // NOLINT
+const int kInt64Size = sizeof(int64_t); // NOLINT
+const int kDoubleSize = sizeof(double); // NOLINT
+const int kFloatSize = sizeof(float); // NOLINT
+const int kFloat32x4Size = sizeof(float32x4_value_t); // NOLINT
+const int kFloat64x2Size = sizeof(float64x2_value_t); // NOLINT
+const int kInt32x4Size = sizeof(int32x4_value_t); // NOLINT
+const int kSIMD128Size = sizeof(simd128_value_t); // NOLINT
+const int kIntptrSize = sizeof(intptr_t); // NOLINT
+const int kPointerSize = sizeof(void*); // NOLINT
#if V8_TARGET_ARCH_X64 && V8_TARGET_ARCH_32_BIT
const int kRegisterSize = kPointerSize + kPointerSize;
#else
const uintptr_t kUintptrAllBitsSet = V8_UINT64_C(0xFFFFFFFFFFFFFFFF);
const bool kRequiresCodeRange = true;
const size_t kMaximalCodeRangeSize = 512 * MB;
+#if V8_OS_WIN
+const size_t kMinimumCodeRangeSize = 4 * MB;
+const size_t kReservedCodeRangePages = 1;
+#else
+const size_t kMinimumCodeRangeSize = 3 * MB;
+const size_t kReservedCodeRangePages = 0;
+#endif
#else
const int kPointerSizeLog2 = 2;
const intptr_t kIntptrSignBit = 0x80000000;
// x32 port also requires code range.
const bool kRequiresCodeRange = true;
const size_t kMaximalCodeRangeSize = 256 * MB;
+const size_t kMinimumCodeRangeSize = 3 * MB;
+const size_t kReservedCodeRangePages = 0;
#else
const bool kRequiresCodeRange = false;
const size_t kMaximalCodeRangeSize = 0 * MB;
+const size_t kMinimumCodeRangeSize = 0 * MB;
+const size_t kReservedCodeRangePages = 0;
#endif
#endif
#endif
const int kCodeZapValue = 0xbadc0de;
+const uint32_t kPhantomReferenceZap = 0xca11bac;
// On Intel architecture, cache line size is 64 bytes.
// On ARM it may be less (32 bytes), but as far this constant is
CELL_SPACE, // Only and all cell objects.
PROPERTY_CELL_SPACE, // Only and all global property cell objects.
LO_SPACE, // Promoted large objects.
- INVALID_SPACE, // Only used in AllocationResult to signal success.
FIRST_SPACE = NEW_SPACE,
LAST_SPACE = LO_SPACE,
};
-// Logging and profiling. A StateTag represents a possible state of
-// the VM. The logger maintains a stack of these. Creating a VMState
-// object enters a state by pushing on the stack, and destroying a
-// VMState object leaves a state by popping the current state from the
-// stack.
-
-enum StateTag {
- JS,
- GC,
- COMPILER,
- OTHER,
- EXTERNAL,
- IDLE
-};
-
-
// -----------------------------------------------------------------------------
// Macros
// CPU feature flags.
enum CpuFeature {
- // x86
- SSE4_1,
- SSE3,
- SAHF,
- // ARM
- VFP3,
- ARMv7,
- SUDIV,
- MLS,
- UNALIGNED_ACCESSES,
- MOVW_MOVT_IMMEDIATE_LOADS,
- VFP32DREGS,
- NEON,
- // MIPS
- FPU,
- // ARM64
- ALWAYS_ALIGN_CSP,
- NUMBER_OF_CPU_FEATURES
+ // x86
+ SSE4_1,
+ SSE3,
+ SAHF,
+ // ARM
+ VFP3,
+ ARMv7,
+ ARMv8,
+ SUDIV,
+ MLS,
+ UNALIGNED_ACCESSES,
+ MOVW_MOVT_IMMEDIATE_LOADS,
+ VFP32DREGS,
+ NEON,
+ // MIPS, MIPS64
+ FPU,
+ FP64FPU,
+ MIPSr1,
+ MIPSr2,
+ MIPSr6,
+ // ARM64
+ ALWAYS_ALIGN_CSP,
+ NUMBER_OF_CPU_FEATURES
};
GLOBAL_SCOPE, // The top-level scope for a program or a top-level eval.
CATCH_SCOPE, // The scope introduced by catch.
BLOCK_SCOPE, // The scope introduced by a new block.
- WITH_SCOPE // The scope introduced by with.
+ WITH_SCOPE, // The scope introduced by with.
+ ARROW_SCOPE // The top-level scope for an arrow function literal.
};
FAIL_ON_MINUS_ZERO
};
+
+enum Signedness { kSigned, kUnsigned };
+
+
+enum FunctionKind {
+ kNormalFunction = 0,
+ kArrowFunction = 1,
+ kGeneratorFunction = 2,
+ kConciseMethod = 4,
+ kConciseGeneratorMethod = kGeneratorFunction | kConciseMethod
+};
+
+
+inline bool IsValidFunctionKind(FunctionKind kind) {
+ return kind == FunctionKind::kNormalFunction ||
+ kind == FunctionKind::kArrowFunction ||
+ kind == FunctionKind::kGeneratorFunction ||
+ kind == FunctionKind::kConciseMethod ||
+ kind == FunctionKind::kConciseGeneratorMethod;
+}
+
+
+inline bool IsArrowFunction(FunctionKind kind) {
+ DCHECK(IsValidFunctionKind(kind));
+ return kind & FunctionKind::kArrowFunction;
+}
+
+
+inline bool IsGeneratorFunction(FunctionKind kind) {
+ DCHECK(IsValidFunctionKind(kind));
+ return kind & FunctionKind::kGeneratorFunction;
+}
+
+
+inline bool IsConciseMethod(FunctionKind kind) {
+ DCHECK(IsValidFunctionKind(kind));
+ return kind & FunctionKind::kConciseMethod;
+}
} } // namespace v8::internal
namespace i = v8::internal;