9 # error "V8 does not support the SPARC CPU architecture."
19 #include <sys/regset.h>
20 #include <sys/stack.h>
44 return fpclass(x) & FP_NZERO;
59 if (std::isnan(time))
return "";
60 time_t tv =
static_cast<time_t
>(std::floor(time/
msPerSecond));
61 struct tm* t = localtime(&tv);
62 if (
NULL == t)
return "";
69 return -
static_cast<double>(timezone *
msPerSecond);
76 const size_t msize =
RoundUp(requested, getpagesize());
77 int prot = PROT_READ | PROT_WRITE | (is_executable ? PROT_EXEC : 0);
78 void* mbase = mmap(
NULL, msize, prot, MAP_PRIVATE | MAP_ANON, -1, 0);
80 if (mbase == MAP_FAILED)
return NULL;
86 class PosixMemoryMappedFile :
public OS::MemoryMappedFile {
104 fseek(
file, 0, SEEK_END);
108 mmap(0,
size, PROT_READ | PROT_WRITE, MAP_SHARED, fileno(
file), 0);
117 int result = fwrite(initial,
size, 1,
file);
123 mmap(0,
size, PROT_READ | PROT_WRITE, MAP_SHARED, fileno(
file), 0);
124 return new PosixMemoryMappedFile(
file, memory,
size);
129 if (memory_) munmap(memory_, size_);
135 return std::vector<SharedLibraryAddress>();
151 VirtualMemory::VirtualMemory(
size_t size)
152 : address_(ReserveRegion(
size)), size_(
size) { }
155 VirtualMemory::VirtualMemory(
size_t size,
size_t alignment)
156 : address_(
NULL), size_(0) {
163 MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE,
166 if (reservation == MAP_FAILED)
return;
168 uint8_t* base =
static_cast<uint8_t*
>(reservation);
169 uint8_t* aligned_base =
RoundUp(base, alignment);
173 if (aligned_base != base) {
174 size_t prefix_size =
static_cast<size_t>(aligned_base - base);
176 request_size -= prefix_size;
182 if (aligned_size != request_size) {
183 size_t suffix_size = request_size - aligned_size;
184 OS::Free(aligned_base + aligned_size, suffix_size);
185 request_size -= suffix_size;
188 DCHECK(aligned_size == request_size);
190 address_ =
static_cast<void*
>(aligned_base);
191 size_ = aligned_size;
195 VirtualMemory::~VirtualMemory() {
197 bool result = ReleaseRegion(address(),
size());
204 bool VirtualMemory::IsReserved() {
205 return address_ !=
NULL;
209 void VirtualMemory::Reset() {
215 bool VirtualMemory::Commit(
void* address,
size_t size,
bool is_executable) {
216 return CommitRegion(address,
size, is_executable);
220 bool VirtualMemory::Uncommit(
void* address,
size_t size) {
221 return UncommitRegion(address,
size);
225 bool VirtualMemory::Guard(
void* address) {
226 OS::Guard(address, OS::CommitPageSize());
231 void* VirtualMemory::ReserveRegion(
size_t size) {
232 void* result = mmap(OS::GetRandomMmapAddr(),
235 MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE,
239 if (result == MAP_FAILED)
return NULL;
245 bool VirtualMemory::CommitRegion(
void* base,
size_t size,
bool is_executable) {
246 int prot = PROT_READ | PROT_WRITE | (is_executable ? PROT_EXEC : 0);
247 if (MAP_FAILED == mmap(base,
250 MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED,
259 bool VirtualMemory::UncommitRegion(
void* base,
size_t size) {
263 MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE | MAP_FIXED,
269 bool VirtualMemory::ReleaseRegion(
void* base,
size_t size) {
270 return munmap(base,
size) == 0;
274 bool VirtualMemory::HasLazyCommits() {
static MemoryMappedFile * create(const char *name, int size, void *initial)
virtual void * memory()=0
static MemoryMappedFile * open(const char *name)
static void * GetRandomMmapAddr()
static size_t AllocateAlignment()
static void SignalCodeMovingGC()
static void * Allocate(const size_t requested, size_t *allocated, bool is_executable)
static const char * LocalTimezone(double time, TimezoneCache *cache)
static std::vector< SharedLibraryAddress > GetSharedLibraryAddresses()
static double LocalTimeOffset(TimezoneCache *cache)
static void Free(void *address, const size_t size)
static const int msPerSecond
virtual ~PosixMemoryMappedFile()
PosixMemoryMappedFile(FILE *file, void *memory, int size)
virtual ~PosixMemoryMappedFile()
enable harmony numeric enable harmony object literal extensions Optimize object size
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 enable alignment of csp to bytes on platforms which prefer the register to always be expose gc extension under the specified name show built in functions in stack traces use random jit cookie to mask large constants minimum length for automatic enable preparsing CPU profiler sampling interval in microseconds trace out of bounds accesses to external arrays default size of stack region v8 is allowed to maximum length of function source code printed in a stack trace min size of a semi the new space consists of two semi spaces print one trace line following each garbage collection do not print trace line after scavenger collection print cumulative GC statistics in name
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 enable alignment of csp to bytes on platforms which prefer the register to always be expose gc extension under the specified name show built in functions in stack traces use random jit cookie to mask large constants minimum length for automatic enable preparsing CPU profiler sampling interval in microseconds trace out of bounds accesses to external arrays default size of stack region v8 is allowed to maximum length of function source code printed in a stack trace min size of a semi the new space consists of two semi spaces print one trace line following each garbage collection do not print trace line after scavenger collection print cumulative GC statistics in only print modified registers Trace simulator debug messages Implied by trace sim abort randomize hashes to avoid predictable hash Fixed seed to use to hash property Print the time it takes to deserialize the snapshot A filename with extra code to be included in the A file to write the raw snapshot bytes A file to write the raw context snapshot bytes Write V8 startup blob file(mksnapshot only)") DEFINE_BOOL(profile_hydrogen_code_stub_compilation
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 enable alignment of csp to bytes on platforms which prefer the register to always be NULL
#define DCHECK_LE(v1, v2)
#define DCHECK(condition)
T RoundUp(T x, intptr_t m)
static const int kMmapFdOffset
Debugger support for the V8 JavaScript engine.