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 // Platform-specific code for Win32. | 5 // Platform-specific code for Win32. |
6 | 6 |
7 // Secure API functions are not available using MinGW with msvcrt.dll | 7 // Secure API functions are not available using MinGW with msvcrt.dll |
8 // on Windows XP. Make sure MINGW_HAS_SECURE_API is not defined to | 8 // on Windows XP. Make sure MINGW_HAS_SECURE_API is not defined to |
9 // disable definition of secure API functions in standard headers that | 9 // disable definition of secure API functions in standard headers that |
10 // would conflict with our own implementation. | 10 // would conflict with our own implementation. |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 #endif // __MINGW32__ | 100 #endif // __MINGW32__ |
101 | 101 |
102 namespace v8 { | 102 namespace v8 { |
103 namespace internal { | 103 namespace internal { |
104 | 104 |
105 intptr_t OS::MaxVirtualMemory() { | 105 intptr_t OS::MaxVirtualMemory() { |
106 return 0; | 106 return 0; |
107 } | 107 } |
108 | 108 |
109 | 109 |
110 #if V8_TARGET_ARCH_IA32 | 110 #if V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_X87 |
111 static void MemMoveWrapper(void* dest, const void* src, size_t size) { | 111 static void MemMoveWrapper(void* dest, const void* src, size_t size) { |
112 memmove(dest, src, size); | 112 memmove(dest, src, size); |
113 } | 113 } |
114 | 114 |
115 | 115 |
116 // Initialize to library version so we can call this at any time during startup. | 116 // Initialize to library version so we can call this at any time during startup. |
117 static OS::MemMoveFunction memmove_function = &MemMoveWrapper; | 117 static OS::MemMoveFunction memmove_function = &MemMoveWrapper; |
118 | 118 |
119 // Defined in codegen-ia32.cc. | 119 // Defined in codegen-ia32.cc. |
120 OS::MemMoveFunction CreateMemMoveFunction(); | 120 OS::MemMoveFunction CreateMemMoveFunction(); |
121 | 121 |
122 // Copy memory area to disjoint memory area. | 122 // Copy memory area to disjoint memory area. |
123 void OS::MemMove(void* dest, const void* src, size_t size) { | 123 void OS::MemMove(void* dest, const void* src, size_t size) { |
124 if (size == 0) return; | 124 if (size == 0) return; |
125 // Note: here we rely on dependent reads being ordered. This is true | 125 // Note: here we rely on dependent reads being ordered. This is true |
126 // on all architectures we currently support. | 126 // on all architectures we currently support. |
127 (*memmove_function)(dest, src, size); | 127 (*memmove_function)(dest, src, size); |
128 } | 128 } |
129 | 129 |
130 #endif // V8_TARGET_ARCH_IA32 | 130 #endif // V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_X87 |
131 | 131 |
132 | 132 |
133 class TimezoneCache { | 133 class TimezoneCache { |
134 public: | 134 public: |
135 TimezoneCache() : initialized_(false) { } | 135 TimezoneCache() : initialized_(false) { } |
136 | 136 |
137 void Clear() { | 137 void Clear() { |
138 initialized_ = false; | 138 initialized_ = false; |
139 } | 139 } |
140 | 140 |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 // Returns a string identifying the current timezone for the | 446 // Returns a string identifying the current timezone for the |
447 // timestamp taking into account daylight saving. | 447 // timestamp taking into account daylight saving. |
448 char* Win32Time::LocalTimezone(TimezoneCache* cache) { | 448 char* Win32Time::LocalTimezone(TimezoneCache* cache) { |
449 // Return the standard or DST time zone name based on whether daylight | 449 // Return the standard or DST time zone name based on whether daylight |
450 // saving is in effect at the given time. | 450 // saving is in effect at the given time. |
451 return InDST(cache) ? cache->dst_tz_name_ : cache->std_tz_name_; | 451 return InDST(cache) ? cache->dst_tz_name_ : cache->std_tz_name_; |
452 } | 452 } |
453 | 453 |
454 | 454 |
455 void OS::PostSetUp() { | 455 void OS::PostSetUp() { |
456 #if V8_TARGET_ARCH_IA32 | 456 #if V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_X87 |
457 OS::MemMoveFunction generated_memmove = CreateMemMoveFunction(); | 457 OS::MemMoveFunction generated_memmove = CreateMemMoveFunction(); |
458 if (generated_memmove != NULL) { | 458 if (generated_memmove != NULL) { |
459 memmove_function = generated_memmove; | 459 memmove_function = generated_memmove; |
460 } | 460 } |
461 #endif | 461 #endif |
462 } | 462 } |
463 | 463 |
464 | 464 |
465 // Returns the accumulated user time for thread. | 465 // Returns the accumulated user time for thread. |
466 int OS::GetUserTime(uint32_t* secs, uint32_t* usecs) { | 466 int OS::GetUserTime(uint32_t* secs, uint32_t* usecs) { |
(...skipping 955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1422 ASSERT(result); | 1422 ASSERT(result); |
1423 } | 1423 } |
1424 | 1424 |
1425 | 1425 |
1426 | 1426 |
1427 void Thread::YieldCPU() { | 1427 void Thread::YieldCPU() { |
1428 Sleep(0); | 1428 Sleep(0); |
1429 } | 1429 } |
1430 | 1430 |
1431 } } // namespace v8::internal | 1431 } } // namespace v8::internal |
OLD | NEW |