v8  3.25.30(node0.11.13)
V8 is Google's open source JavaScript engine
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
platform.h
Go to the documentation of this file.
1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are
4 // met:
5 //
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided
11 // with the distribution.
12 // * Neither the name of Google Inc. nor the names of its
13 // contributors may be used to endorse or promote products derived
14 // from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // This module contains the platform-specific code. This make the rest of the
29 // code less dependent on operating system, compilers and runtime libraries.
30 // This module does specifically not deal with differences between different
31 // processor architecture.
32 // The platform classes have the same definition for all platforms. The
33 // implementation for a particular platform is put in platform_<os>.cc.
34 // The build system then uses the implementation for the target platform.
35 //
36 // This design has been chosen because it is simple and fast. Alternatively,
37 // the platform dependent classes could have been implemented using abstract
38 // superclasses with virtual methods and having specializations for each
39 // platform. This design was rejected because it was more complicated and
40 // slower. It would require factory methods for selecting the right
41 // implementation and the overhead of virtual methods for performance
42 // sensitive like mutex locking/unlocking.
43 
44 #ifndef V8_PLATFORM_H_
45 #define V8_PLATFORM_H_
46 
47 #include <stdarg.h>
48 
49 #include "platform/mutex.h"
50 #include "platform/semaphore.h"
51 #include "utils.h"
52 #include "v8globals.h"
53 
54 #ifdef __sun
55 # ifndef signbit
56 namespace std {
57 int signbit(double x);
58 }
59 # endif
60 #endif
61 
62 #if V8_OS_QNX
63 #include "qnx-math.h"
64 #endif
65 
66 // Microsoft Visual C++ specific stuff.
67 #if V8_LIBC_MSVCRT
68 
69 #include "win32-headers.h"
70 #include "win32-math.h"
71 
72 int strncasecmp(const char* s1, const char* s2, int n);
73 
74 // Visual C++ 2013 and higher implement this function.
75 #if (_MSC_VER < 1800)
76 inline int lrint(double flt) {
77  int intgr;
78 #if V8_TARGET_ARCH_IA32
79  __asm {
80  fld flt
81  fistp intgr
82  };
83 #else
84  intgr = static_cast<int>(flt + 0.5);
85  if ((intgr & 1) != 0 && intgr - flt == 0.5) {
86  // If the number is halfway between two integers, round to the even one.
87  intgr--;
88  }
89 #endif
90  return intgr;
91 }
92 #endif // _MSC_VER < 1800
93 
94 #endif // V8_LIBC_MSVCRT
95 
96 namespace v8 {
97 namespace internal {
98 
99 double modulo(double x, double y);
100 
101 // Custom implementation of math functions.
102 double fast_exp(double input);
103 double fast_sqrt(double input);
104 // The custom exp implementation needs 16KB of lookup data; initialize it
105 // on demand.
107 
108 // ----------------------------------------------------------------------------
109 // Fast TLS support
110 
111 #ifndef V8_NO_FAST_TLS
112 
113 #if defined(_MSC_VER) && V8_HOST_ARCH_IA32
114 
115 #define V8_FAST_TLS_SUPPORTED 1
116 
117 INLINE(intptr_t InternalGetExistingThreadLocal(intptr_t index));
118 
119 inline intptr_t InternalGetExistingThreadLocal(intptr_t index) {
120  const intptr_t kTibInlineTlsOffset = 0xE10;
121  const intptr_t kTibExtraTlsOffset = 0xF94;
122  const intptr_t kMaxInlineSlots = 64;
123  const intptr_t kMaxSlots = kMaxInlineSlots + 1024;
124  ASSERT(0 <= index && index < kMaxSlots);
125  if (index < kMaxInlineSlots) {
126  return static_cast<intptr_t>(__readfsdword(kTibInlineTlsOffset +
127  kPointerSize * index));
128  }
129  intptr_t extra = static_cast<intptr_t>(__readfsdword(kTibExtraTlsOffset));
130  ASSERT(extra != 0);
131  return *reinterpret_cast<intptr_t*>(extra +
132  kPointerSize * (index - kMaxInlineSlots));
133 }
134 
135 #elif defined(__APPLE__) && (V8_HOST_ARCH_IA32 || V8_HOST_ARCH_X64)
136 
137 #define V8_FAST_TLS_SUPPORTED 1
138 
139 extern intptr_t kMacTlsBaseOffset;
140 
141 INLINE(intptr_t InternalGetExistingThreadLocal(intptr_t index));
142 
143 inline intptr_t InternalGetExistingThreadLocal(intptr_t index) {
144  intptr_t result;
145 #if V8_HOST_ARCH_IA32
146  asm("movl %%gs:(%1,%2,4), %0;"
147  :"=r"(result) // Output must be a writable register.
148  :"r"(kMacTlsBaseOffset), "r"(index));
149 #else
150  asm("movq %%gs:(%1,%2,8), %0;"
151  :"=r"(result)
152  :"r"(kMacTlsBaseOffset), "r"(index));
153 #endif
154  return result;
155 }
156 
157 #endif
158 
159 #endif // V8_NO_FAST_TLS
160 
161 
162 class TimezoneCache;
163 
164 
165 // ----------------------------------------------------------------------------
166 // OS
167 //
168 // This class has static methods for the different platform specific
169 // functions. Add methods here to cope with differences between the
170 // supported platforms.
171 
172 class OS {
173  public:
174  // Initializes the platform OS support that depend on CPU features. This is
175  // called after CPU initialization.
176  static void PostSetUp();
177 
178  // Returns the accumulated user time for thread. This routine
179  // can be used for profiling. The implementation should
180  // strive for high-precision timer resolution, preferable
181  // micro-second resolution.
182  static int GetUserTime(uint32_t* secs, uint32_t* usecs);
183 
184  // Returns current time as the number of milliseconds since
185  // 00:00:00 UTC, January 1, 1970.
186  static double TimeCurrentMillis();
187 
189  static void DisposeTimezoneCache(TimezoneCache* cache);
190  static void ClearTimezoneCache(TimezoneCache* cache);
191 
192  // Returns a string identifying the current time zone. The
193  // timestamp is used for determining if DST is in effect.
194  static const char* LocalTimezone(double time, TimezoneCache* cache);
195 
196  // Returns the local time offset in milliseconds east of UTC without
197  // taking daylight savings time into account.
198  static double LocalTimeOffset(TimezoneCache* cache);
199 
200  // Returns the daylight savings offset for the given time.
201  static double DaylightSavingsOffset(double time, TimezoneCache* cache);
202 
203  // Returns last OS error.
204  static int GetLastError();
205 
206  static FILE* FOpen(const char* path, const char* mode);
207  static bool Remove(const char* path);
208 
209  // Opens a temporary file, the file is auto removed on close.
210  static FILE* OpenTemporaryFile();
211 
212  // Log file open mode is platform-dependent due to line ends issues.
213  static const char* const LogFileOpenMode;
214 
215  // Print output to console. This is mostly used for debugging output.
216  // On platforms that has standard terminal output, the output
217  // should go to stdout.
218  static void Print(const char* format, ...);
219  static void VPrint(const char* format, va_list args);
220 
221  // Print output to a file. This is mostly used for debugging output.
222  static void FPrint(FILE* out, const char* format, ...);
223  static void VFPrint(FILE* out, const char* format, va_list args);
224 
225  // Print error output to console. This is mostly used for error message
226  // output. On platforms that has standard terminal output, the output
227  // should go to stderr.
228  static void PrintError(const char* format, ...);
229  static void VPrintError(const char* format, va_list args);
230 
231  // Allocate/Free memory used by JS heap. Pages are readable/writable, but
232  // they are not guaranteed to be executable unless 'executable' is true.
233  // Returns the address of allocated memory, or NULL if failed.
234  static void* Allocate(const size_t requested,
235  size_t* allocated,
236  bool is_executable);
237  static void Free(void* address, const size_t size);
238 
239  // This is the granularity at which the ProtectCode(...) call can set page
240  // permissions.
241  static intptr_t CommitPageSize();
242 
243  // Mark code segments non-writable.
244  static void ProtectCode(void* address, const size_t size);
245 
246  // Assign memory as a guard page so that access will cause an exception.
247  static void Guard(void* address, const size_t size);
248 
249  // Generate a random address to be used for hinting mmap().
250  static void* GetRandomMmapAddr();
251 
252  // Get the Alignment guaranteed by Allocate().
253  static size_t AllocateAlignment();
254 
255  // Sleep for a number of milliseconds.
256  static void Sleep(const int milliseconds);
257 
258  // Abort the current process.
259  static void Abort();
260 
261  // Debug break.
262  static void DebugBreak();
263 
264  // Walk the stack.
265  static const int kStackWalkError = -1;
266  static const int kStackWalkMaxNameLen = 256;
267  static const int kStackWalkMaxTextLen = 256;
268  struct StackFrame {
269  void* address;
271  };
272 
274  public:
275  static MemoryMappedFile* open(const char* name);
276  static MemoryMappedFile* create(const char* name, int size, void* initial);
277  virtual ~MemoryMappedFile() { }
278  virtual void* memory() = 0;
279  virtual int size() = 0;
280  };
281 
282  // Safe formatting print. Ensures that str is always null-terminated.
283  // Returns the number of chars written, or -1 if output was truncated.
284  static int SNPrintF(Vector<char> str, const char* format, ...);
285  static int VSNPrintF(Vector<char> str,
286  const char* format,
287  va_list args);
288 
289  static char* StrChr(char* str, int c);
290  static void StrNCpy(Vector<char> dest, const char* src, size_t n);
291 
292  // Support for the profiler. Can do nothing, in which case ticks
293  // occuring in shared libraries will not be properly accounted for.
294  static void LogSharedLibraryAddresses(Isolate* isolate);
295 
296  // Support for the profiler. Notifies the external profiling
297  // process that a code moving garbage collection starts. Can do
298  // nothing, in which case the code objects must not move (e.g., by
299  // using --never-compact) if accurate profiling is desired.
300  static void SignalCodeMovingGC();
301 
302  // The return value indicates the CPU features we are sure of because of the
303  // OS. For example MacOSX doesn't run on any x86 CPUs that don't have SSE2
304  // instructions.
305  // This is a little messy because the interpretation is subject to the cross
306  // of the CPU and the OS. The bits in the answer correspond to the bit
307  // positions indicated by the members of the CpuFeature enum from globals.h
308  static uint64_t CpuFeaturesImpliedByPlatform();
309 
310  // The total amount of physical memory available on the current system.
311  static uint64_t TotalPhysicalMemory();
312 
313  // Maximum size of the virtual memory. 0 means there is no artificial
314  // limit.
315  static intptr_t MaxVirtualMemory();
316 
317  // Returns the double constant NAN
318  static double nan_value();
319 
320  // Support runtime detection of whether the hard float option of the
321  // EABI is used.
322  static bool ArmUsingHardFloat();
323 
324  // Returns the activation frame alignment constraint or zero if
325  // the platform doesn't care. Guaranteed to be a power of two.
326  static int ActivationFrameAlignment();
327 
328 #if defined(V8_TARGET_ARCH_IA32)
329  // Limit below which the extra overhead of the MemCopy function is likely
330  // to outweigh the benefits of faster copying.
331  static const int kMinComplexMemCopy = 64;
332 
333  // Copy memory area. No restrictions.
334  static void MemMove(void* dest, const void* src, size_t size);
335  typedef void (*MemMoveFunction)(void* dest, const void* src, size_t size);
336 
337  // Keep the distinction of "move" vs. "copy" for the benefit of other
338  // architectures.
339  static void MemCopy(void* dest, const void* src, size_t size) {
340  MemMove(dest, src, size);
341  }
342 #elif defined(V8_HOST_ARCH_ARM)
343  typedef void (*MemCopyUint8Function)(uint8_t* dest,
344  const uint8_t* src,
345  size_t size);
346  static MemCopyUint8Function memcopy_uint8_function;
347  static void MemCopyUint8Wrapper(uint8_t* dest,
348  const uint8_t* src,
349  size_t chars) {
350  memcpy(dest, src, chars);
351  }
352  // For values < 16, the assembler function is slower than the inlined C code.
353  static const int kMinComplexMemCopy = 16;
354  static void MemCopy(void* dest, const void* src, size_t size) {
355  (*memcopy_uint8_function)(reinterpret_cast<uint8_t*>(dest),
356  reinterpret_cast<const uint8_t*>(src),
357  size);
358  }
359  static void MemMove(void* dest, const void* src, size_t size) {
360  memmove(dest, src, size);
361  }
362 
363  typedef void (*MemCopyUint16Uint8Function)(uint16_t* dest,
364  const uint8_t* src,
365  size_t size);
366  static MemCopyUint16Uint8Function memcopy_uint16_uint8_function;
367  static void MemCopyUint16Uint8Wrapper(uint16_t* dest,
368  const uint8_t* src,
369  size_t chars);
370  // For values < 12, the assembler function is slower than the inlined C code.
371  static const int kMinComplexConvertMemCopy = 12;
372  static void MemCopyUint16Uint8(uint16_t* dest,
373  const uint8_t* src,
374  size_t size) {
375  (*memcopy_uint16_uint8_function)(dest, src, size);
376  }
377 #elif defined(V8_HOST_ARCH_MIPS)
378  typedef void (*MemCopyUint8Function)(uint8_t* dest,
379  const uint8_t* src,
380  size_t size);
381  static MemCopyUint8Function memcopy_uint8_function;
382  static void MemCopyUint8Wrapper(uint8_t* dest,
383  const uint8_t* src,
384  size_t chars) {
385  memcpy(dest, src, chars);
386  }
387  // For values < 16, the assembler function is slower than the inlined C code.
388  static const int kMinComplexMemCopy = 16;
389  static void MemCopy(void* dest, const void* src, size_t size) {
390  (*memcopy_uint8_function)(reinterpret_cast<uint8_t*>(dest),
391  reinterpret_cast<const uint8_t*>(src),
392  size);
393  }
394  static void MemMove(void* dest, const void* src, size_t size) {
395  memmove(dest, src, size);
396  }
397 #else
398  // Copy memory area to disjoint memory area.
399  static void MemCopy(void* dest, const void* src, size_t size) {
400  memcpy(dest, src, size);
401  }
402  static void MemMove(void* dest, const void* src, size_t size) {
403  memmove(dest, src, size);
404  }
405  static const int kMinComplexMemCopy = 16 * kPointerSize;
406 #endif // V8_TARGET_ARCH_IA32
407 
408  static int GetCurrentProcessId();
409 
410  private:
411  static const int msPerSecond = 1000;
412 
413  DISALLOW_IMPLICIT_CONSTRUCTORS(OS);
414 };
415 
416 // Represents and controls an area of reserved memory.
417 // Control of the reserved memory can be assigned to another VirtualMemory
418 // object by assignment or copy-contructing. This removes the reserved memory
419 // from the original object.
421  public:
422  // Empty VirtualMemory object, controlling no reserved memory.
423  VirtualMemory();
424 
425  // Reserves virtual memory with size.
426  explicit VirtualMemory(size_t size);
427 
428  // Reserves virtual memory containing an area of the given size that
429  // is aligned per alignment. This may not be at the position returned
430  // by address().
431  VirtualMemory(size_t size, size_t alignment);
432 
433  // Releases the reserved memory, if any, controlled by this VirtualMemory
434  // object.
435  ~VirtualMemory();
436 
437  // Returns whether the memory has been reserved.
438  bool IsReserved();
439 
440  // Initialize or resets an embedded VirtualMemory object.
441  void Reset();
442 
443  // Returns the start address of the reserved memory.
444  // If the memory was reserved with an alignment, this address is not
445  // necessarily aligned. The user might need to round it up to a multiple of
446  // the alignment to get the start of the aligned block.
447  void* address() {
448  ASSERT(IsReserved());
449  return address_;
450  }
451 
452  // Returns the size of the reserved memory. The returned value is only
453  // meaningful when IsReserved() returns true.
454  // If the memory was reserved with an alignment, this size may be larger
455  // than the requested size.
456  size_t size() { return size_; }
457 
458  // Commits real memory. Returns whether the operation succeeded.
459  bool Commit(void* address, size_t size, bool is_executable);
460 
461  // Uncommit real memory. Returns whether the operation succeeded.
462  bool Uncommit(void* address, size_t size);
463 
464  // Creates a single guard page at the given address.
465  bool Guard(void* address);
466 
467  void Release() {
468  ASSERT(IsReserved());
469  // Notice: Order is important here. The VirtualMemory object might live
470  // inside the allocated region.
471  void* address = address_;
472  size_t size = size_;
473  Reset();
474  bool result = ReleaseRegion(address, size);
475  USE(result);
476  ASSERT(result);
477  }
478 
479  // Assign control of the reserved region to a different VirtualMemory object.
480  // The old object is no longer functional (IsReserved() returns false).
482  ASSERT(!IsReserved());
483  address_ = from->address_;
484  size_ = from->size_;
485  from->Reset();
486  }
487 
488  static void* ReserveRegion(size_t size);
489 
490  static bool CommitRegion(void* base, size_t size, bool is_executable);
491 
492  static bool UncommitRegion(void* base, size_t size);
493 
494  // Must be called with a base pointer that has been returned by ReserveRegion
495  // and the same size it was reserved with.
496  static bool ReleaseRegion(void* base, size_t size);
497 
498  // Returns true if OS performs lazy commits, i.e. the memory allocation call
499  // defers actual physical memory allocation till the first memory access.
500  // Otherwise returns false.
501  static bool HasLazyCommits();
502 
503  private:
504  void* address_; // Start address of the virtual memory.
505  size_t size_; // Size of the virtual memory.
506 };
507 
508 
509 // ----------------------------------------------------------------------------
510 // Thread
511 //
512 // Thread objects are used for creating and running threads. When the start()
513 // method is called the new thread starts running the run() method in the new
514 // thread. The Thread object should not be deallocated before the thread has
515 // terminated.
516 
517 class Thread {
518  public:
519  // Opaque data type for thread-local storage keys.
520  // LOCAL_STORAGE_KEY_MIN_VALUE and LOCAL_STORAGE_KEY_MAX_VALUE are specified
521  // to ensure that enumeration type has correct value range (see Issue 830 for
522  // more details).
526  };
527 
528  class Options {
529  public:
530  Options() : name_("v8:<unknown>"), stack_size_(0) {}
531  Options(const char* name, int stack_size = 0)
532  : name_(name), stack_size_(stack_size) {}
533 
534  const char* name() const { return name_; }
535  int stack_size() const { return stack_size_; }
536 
537  private:
538  const char* name_;
539  int stack_size_;
540  };
541 
542  // Create new thread.
543  explicit Thread(const Options& options);
544  virtual ~Thread();
545 
546  // Start new thread by calling the Run() method on the new thread.
547  void Start();
548 
549  // Start new thread and wait until Run() method is called on the new thread.
551  start_semaphore_ = new Semaphore(0);
552  Start();
553  start_semaphore_->Wait();
554  delete start_semaphore_;
555  start_semaphore_ = NULL;
556  }
557 
558  // Wait until thread terminates.
559  void Join();
560 
561  inline const char* name() const {
562  return name_;
563  }
564 
565  // Abstract method for run handler.
566  virtual void Run() = 0;
567 
568  // Thread-local storage.
570  static void DeleteThreadLocalKey(LocalStorageKey key);
571  static void* GetThreadLocal(LocalStorageKey key);
573  return static_cast<int>(reinterpret_cast<intptr_t>(GetThreadLocal(key)));
574  }
575  static void SetThreadLocal(LocalStorageKey key, void* value);
576  static void SetThreadLocalInt(LocalStorageKey key, int value) {
577  SetThreadLocal(key, reinterpret_cast<void*>(static_cast<intptr_t>(value)));
578  }
579  static bool HasThreadLocal(LocalStorageKey key) {
580  return GetThreadLocal(key) != NULL;
581  }
582 
583 #ifdef V8_FAST_TLS_SUPPORTED
584  static inline void* GetExistingThreadLocal(LocalStorageKey key) {
585  void* result = reinterpret_cast<void*>(
586  InternalGetExistingThreadLocal(static_cast<intptr_t>(key)));
587  ASSERT(result == GetThreadLocal(key));
588  return result;
589  }
590 #else
591  static inline void* GetExistingThreadLocal(LocalStorageKey key) {
592  return GetThreadLocal(key);
593  }
594 #endif
595 
596  // A hint to the scheduler to let another thread run.
597  static void YieldCPU();
598 
599 
600  // The thread name length is limited to 16 based on Linux's implementation of
601  // prctl().
602  static const int kMaxThreadNameLength = 16;
603 
604  class PlatformData;
605  PlatformData* data() { return data_; }
606 
608  if (start_semaphore_) start_semaphore_->Signal();
609  Run();
610  }
611 
612  private:
613  void set_name(const char* name);
614 
615  PlatformData* data_;
616 
617  char name_[kMaxThreadNameLength];
618  int stack_size_;
619  Semaphore* start_semaphore_;
620 
622 };
623 
624 } } // namespace v8::internal
625 
626 #endif // V8_PLATFORM_H_
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter NULL
Definition: flags.cc:269
const SwVfpRegister s2
const int kMinInt
Definition: globals.h:249
static void * GetThreadLocal(LocalStorageKey key)
static bool HasThreadLocal(LocalStorageKey key)
Definition: platform.h:579
static void Free(void *address, const size_t size)
Thread(const Options &options)
static int VSNPrintF(Vector< char > str, const char *format, va_list args)
static void LogSharedLibraryAddresses(Isolate *isolate)
static FILE * OpenTemporaryFile()
virtual void Run()=0
static bool ArmUsingHardFloat()
static void SignalCodeMovingGC()
static void * GetRandomMmapAddr()
static double DaylightSavingsOffset(double time, TimezoneCache *cache)
static void * ReserveRegion(size_t size)
double fast_sqrt(double input)
void TakeControl(VirtualMemory *from)
Definition: platform.h:481
static const int kStackWalkError
Definition: platform.h:265
static int GetUserTime(uint32_t *secs, uint32_t *usecs)
static void ClearTimezoneCache(TimezoneCache *cache)
static const int kStackWalkMaxTextLen
Definition: platform.h:267
const int kMaxInt
Definition: globals.h:248
#define ASSERT(condition)
Definition: checks.h:329
static void VFPrint(FILE *out, const char *format, va_list args)
unsigned short uint16_t
Definition: unicode.cc:46
static int GetThreadLocalInt(LocalStorageKey key)
Definition: platform.h:572
static MemoryMappedFile * open(const char *name)
static const int kMinComplexMemCopy
Definition: platform.h:405
double fast_exp(double input)
static void YieldCPU()
static void Abort()
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function not JSFunction itself flushes the cache of optimized code for closures on every GC functions with arguments object maximum number of escape analysis fix point iterations allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms concurrent on stack replacement do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes number of stack frames inspected by the profiler percentage of ICs that must have type info to allow optimization extra verbose compilation tracing generate extra emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV 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_string(expose_natives_as
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object size
Definition: flags.cc:211
static void MemCopy(void *dest, const void *src, size_t size)
Definition: platform.h:399
static void ProtectCode(void *address, const size_t size)
const int kPointerSize
Definition: globals.h:268
void lazily_initialize_fast_exp()
static LocalStorageKey CreateThreadLocalKey()
static FILE * FOpen(const char *path, const char *mode)
static MemoryMappedFile * create(const char *name, int size, void *initial)
bool Commit(void *address, size_t size, bool is_executable)
static void * GetExistingThreadLocal(LocalStorageKey key)
Definition: platform.h:591
static void VPrint(const char *format, va_list args)
#define DISALLOW_COPY_AND_ASSIGN(TypeName)
Definition: globals.h:359
static void MemMove(void *dest, const void *src, size_t size)
Definition: platform.h:402
static void Guard(void *address, const size_t size)
static void VPrintError(const char *format, va_list args)
double modulo(double x, double y)
static int GetCurrentProcessId()
static double TimeCurrentMillis()
static void DebugBreak()
void NotifyStartedAndRun()
Definition: platform.h:607
static void DeleteThreadLocalKey(LocalStorageKey key)
static void Sleep(const int milliseconds)
void StartSynchronously()
Definition: platform.h:550
static const char * LocalTimezone(double time, TimezoneCache *cache)
static void Print(const char *format,...)
const SwVfpRegister s1
static int SNPrintF(Vector< char > str, const char *format,...)
PlatformData * data()
Definition: platform.h:605
static const int kMaxThreadNameLength
Definition: platform.h:602
static const int kStackWalkMaxNameLen
Definition: platform.h:266
static void DisposeTimezoneCache(TimezoneCache *cache)
static bool ReleaseRegion(void *base, size_t size)
static bool CommitRegion(void *base, size_t size, bool is_executable)
static double nan_value()
INLINE(static HeapObject *EnsureDoubleAligned(Heap *heap, HeapObject *object, int size))
static void SetThreadLocal(LocalStorageKey key, void *value)
static void * Allocate(const size_t requested, size_t *allocated, bool is_executable)
static void PostSetUp()
static void PrintError(const char *format,...)
static bool UncommitRegion(void *base, size_t size)
Options(const char *name, int stack_size=0)
Definition: platform.h:531
char text[kStackWalkMaxTextLen]
Definition: platform.h:270
void USE(T)
Definition: globals.h:341
static void StrNCpy(Vector< char > dest, const char *src, size_t n)
static int ActivationFrameAlignment()
const char * name() const
Definition: platform.h:534
static size_t AllocateAlignment()
static TimezoneCache * CreateTimezoneCache()
static uint64_t CpuFeaturesImpliedByPlatform()
static bool Remove(const char *path)
static int GetLastError()
static intptr_t MaxVirtualMemory()
static void FPrint(FILE *out, const char *format,...)
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function not JSFunction itself flushes the cache of optimized code for closures on every GC functions with arguments object maximum number of escape analysis fix point iterations allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms concurrent on stack replacement do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes number of stack frames inspected by the profiler percentage of ICs that must have type info to allow optimization extra verbose compilation tracing generate extra emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV 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 expose natives in global object expose freeBuffer extension expose gc extension under the specified name expose externalize string extension number of stack frames to capture disable builtin natives files print name of functions for which code is generated use random jit cookie to mask large constants trace lazy optimization use adaptive optimizations always try to OSR functions trace optimize function deoptimization minimum length for automatic enable preparsing maximum number of optimization attempts before giving up cache prototype transitions trace debugging JSON request response trace out of bounds accesses to external arrays trace_js_array_abuse automatically set the debug break flag when debugger commands are in the queue abort by crashing maximum length of function source code printed in a stack trace max size of the new max size of the old max size of executable always perform global GCs print one trace line following each garbage collection do not print trace line after scavenger collection print statistics of the maximum memory committed for the heap in name
Definition: flags.cc:505
static intptr_t CommitPageSize()
static const char *const LogFileOpenMode
Definition: platform.h:213
static void SetThreadLocalInt(LocalStorageKey key, int value)
Definition: platform.h:576
static double LocalTimeOffset(TimezoneCache *cache)
int signbit(double x)
static char * StrChr(char *str, int c)
bool Uncommit(void *address, size_t size)
const char * name() const
Definition: platform.h:561
static uint64_t TotalPhysicalMemory()