| OLD | NEW | 
|    1 // Copyright 2012 the V8 project authors. All rights reserved. |    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 |    2 // Use of this source code is governed by a BSD-style license that can be | 
|    3 // found in the LICENSE file. |    3 // found in the LICENSE file. | 
|    4  |    4  | 
|    5 // This module contains the platform-specific code. This make the rest of the |    5 // This module contains the platform-specific code. This make the rest of the | 
|    6 // code less dependent on operating system, compilers and runtime libraries. |    6 // code less dependent on operating system, compilers and runtime libraries. | 
|    7 // This module does specifically not deal with differences between different |    7 // This module does specifically not deal with differences between different | 
|    8 // processor architecture. |    8 // processor architecture. | 
|    9 // The platform classes have the same definition for all platforms. The |    9 // The platform classes have the same definition for all platforms. The | 
|   10 // implementation for a particular platform is put in platform_<os>.cc. |   10 // implementation for a particular platform is put in platform_<os>.cc. | 
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  132  |  132  | 
|  133 // ---------------------------------------------------------------------------- |  133 // ---------------------------------------------------------------------------- | 
|  134 // OS |  134 // OS | 
|  135 // |  135 // | 
|  136 // This class has static methods for the different platform specific |  136 // This class has static methods for the different platform specific | 
|  137 // functions. Add methods here to cope with differences between the |  137 // functions. Add methods here to cope with differences between the | 
|  138 // supported platforms. |  138 // supported platforms. | 
|  139  |  139  | 
|  140 class OS { |  140 class OS { | 
|  141  public: |  141  public: | 
|  142   // Initializes the platform OS support that depend on CPU features. This is |  | 
|  143   // called after CPU initialization. |  | 
|  144   static void PostSetUp(); |  | 
|  145  |  | 
|  146   // Returns the accumulated user time for thread. This routine |  142   // Returns the accumulated user time for thread. This routine | 
|  147   // can be used for profiling. The implementation should |  143   // can be used for profiling. The implementation should | 
|  148   // strive for high-precision timer resolution, preferable |  144   // strive for high-precision timer resolution, preferable | 
|  149   // micro-second resolution. |  145   // micro-second resolution. | 
|  150   static int GetUserTime(uint32_t* secs,  uint32_t* usecs); |  146   static int GetUserTime(uint32_t* secs,  uint32_t* usecs); | 
|  151  |  147  | 
|  152   // Returns current time as the number of milliseconds since |  148   // Returns current time as the number of milliseconds since | 
|  153   // 00:00:00 UTC, January 1, 1970. |  149   // 00:00:00 UTC, January 1, 1970. | 
|  154   static double TimeCurrentMillis(); |  150   static double TimeCurrentMillis(); | 
|  155  |  151  | 
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  285   static double nan_value(); |  281   static double nan_value(); | 
|  286  |  282  | 
|  287   // Support runtime detection of whether the hard float option of the |  283   // Support runtime detection of whether the hard float option of the | 
|  288   // EABI is used. |  284   // EABI is used. | 
|  289   static bool ArmUsingHardFloat(); |  285   static bool ArmUsingHardFloat(); | 
|  290  |  286  | 
|  291   // Returns the activation frame alignment constraint or zero if |  287   // Returns the activation frame alignment constraint or zero if | 
|  292   // the platform doesn't care. Guaranteed to be a power of two. |  288   // the platform doesn't care. Guaranteed to be a power of two. | 
|  293   static int ActivationFrameAlignment(); |  289   static int ActivationFrameAlignment(); | 
|  294  |  290  | 
|  295 #if defined(V8_TARGET_ARCH_IA32) || defined(V8_TARGET_ARCH_X87) |  | 
|  296   // Limit below which the extra overhead of the MemCopy function is likely |  | 
|  297   // to outweigh the benefits of faster copying. |  | 
|  298   static const int kMinComplexMemCopy = 64; |  | 
|  299  |  | 
|  300   // Copy memory area. No restrictions. |  | 
|  301   static void MemMove(void* dest, const void* src, size_t size); |  | 
|  302   typedef void (*MemMoveFunction)(void* dest, const void* src, size_t size); |  | 
|  303  |  | 
|  304   // Keep the distinction of "move" vs. "copy" for the benefit of other |  | 
|  305   // architectures. |  | 
|  306   static void MemCopy(void* dest, const void* src, size_t size) { |  | 
|  307     MemMove(dest, src, size); |  | 
|  308   } |  | 
|  309 #elif defined(V8_HOST_ARCH_ARM) |  | 
|  310   typedef void (*MemCopyUint8Function)(uint8_t* dest, |  | 
|  311                                        const uint8_t* src, |  | 
|  312                                        size_t size); |  | 
|  313   static MemCopyUint8Function memcopy_uint8_function; |  | 
|  314   static void MemCopyUint8Wrapper(uint8_t* dest, |  | 
|  315                                   const uint8_t* src, |  | 
|  316                                   size_t chars) { |  | 
|  317     memcpy(dest, src, chars); |  | 
|  318   } |  | 
|  319   // For values < 16, the assembler function is slower than the inlined C code. |  | 
|  320   static const int kMinComplexMemCopy = 16; |  | 
|  321   static void MemCopy(void* dest, const void* src, size_t size) { |  | 
|  322     (*memcopy_uint8_function)(reinterpret_cast<uint8_t*>(dest), |  | 
|  323                               reinterpret_cast<const uint8_t*>(src), |  | 
|  324                               size); |  | 
|  325   } |  | 
|  326   static void MemMove(void* dest, const void* src, size_t size) { |  | 
|  327     memmove(dest, src, size); |  | 
|  328   } |  | 
|  329  |  | 
|  330   typedef void (*MemCopyUint16Uint8Function)(uint16_t* dest, |  | 
|  331                                              const uint8_t* src, |  | 
|  332                                              size_t size); |  | 
|  333   static MemCopyUint16Uint8Function memcopy_uint16_uint8_function; |  | 
|  334   static void MemCopyUint16Uint8Wrapper(uint16_t* dest, |  | 
|  335                                         const uint8_t* src, |  | 
|  336                                         size_t chars); |  | 
|  337   // For values < 12, the assembler function is slower than the inlined C code. |  | 
|  338   static const int kMinComplexConvertMemCopy = 12; |  | 
|  339   static void MemCopyUint16Uint8(uint16_t* dest, |  | 
|  340                                  const uint8_t* src, |  | 
|  341                                  size_t size) { |  | 
|  342     (*memcopy_uint16_uint8_function)(dest, src, size); |  | 
|  343   } |  | 
|  344 #elif defined(V8_HOST_ARCH_MIPS) |  | 
|  345   typedef void (*MemCopyUint8Function)(uint8_t* dest, |  | 
|  346                                        const uint8_t* src, |  | 
|  347                                        size_t size); |  | 
|  348   static MemCopyUint8Function memcopy_uint8_function; |  | 
|  349   static void MemCopyUint8Wrapper(uint8_t* dest, |  | 
|  350                                   const uint8_t* src, |  | 
|  351                                   size_t chars) { |  | 
|  352     memcpy(dest, src, chars); |  | 
|  353   } |  | 
|  354   // For values < 16, the assembler function is slower than the inlined C code. |  | 
|  355   static const int kMinComplexMemCopy = 16; |  | 
|  356   static void MemCopy(void* dest, const void* src, size_t size) { |  | 
|  357     (*memcopy_uint8_function)(reinterpret_cast<uint8_t*>(dest), |  | 
|  358                               reinterpret_cast<const uint8_t*>(src), |  | 
|  359                               size); |  | 
|  360   } |  | 
|  361   static void MemMove(void* dest, const void* src, size_t size) { |  | 
|  362     memmove(dest, src, size); |  | 
|  363   } |  | 
|  364 #else |  | 
|  365   // Copy memory area to disjoint memory area. |  | 
|  366   static void MemCopy(void* dest, const void* src, size_t size) { |  | 
|  367     memcpy(dest, src, size); |  | 
|  368   } |  | 
|  369   static void MemMove(void* dest, const void* src, size_t size) { |  | 
|  370     memmove(dest, src, size); |  | 
|  371   } |  | 
|  372   static const int kMinComplexMemCopy = 16 * kPointerSize; |  | 
|  373 #endif  // V8_TARGET_ARCH_IA32 |  | 
|  374  |  | 
|  375   static int GetCurrentProcessId(); |  291   static int GetCurrentProcessId(); | 
|  376  |  292  | 
|  377  private: |  293  private: | 
|  378   static const int msPerSecond = 1000; |  294   static const int msPerSecond = 1000; | 
|  379  |  295  | 
|  380   DISALLOW_IMPLICIT_CONSTRUCTORS(OS); |  296   DISALLOW_IMPLICIT_CONSTRUCTORS(OS); | 
|  381 }; |  297 }; | 
|  382  |  298  | 
|  383 // Represents and controls an area of reserved memory. |  299 // Represents and controls an area of reserved memory. | 
|  384 // Control of the reserved memory can be assigned to another VirtualMemory |  300 // Control of the reserved memory can be assigned to another VirtualMemory | 
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  584   char name_[kMaxThreadNameLength]; |  500   char name_[kMaxThreadNameLength]; | 
|  585   int stack_size_; |  501   int stack_size_; | 
|  586   Semaphore* start_semaphore_; |  502   Semaphore* start_semaphore_; | 
|  587  |  503  | 
|  588   DISALLOW_COPY_AND_ASSIGN(Thread); |  504   DISALLOW_COPY_AND_ASSIGN(Thread); | 
|  589 }; |  505 }; | 
|  590  |  506  | 
|  591 } }  // namespace v8::internal |  507 } }  // namespace v8::internal | 
|  592  |  508  | 
|  593 #endif  // V8_PLATFORM_H_ |  509 #endif  // V8_PLATFORM_H_ | 
| OLD | NEW |