OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 #define STRUNCATE 80 | 58 #define STRUNCATE 80 |
59 | 59 |
60 inline void MemoryBarrier() { | 60 inline void MemoryBarrier() { |
61 int barrier = 0; | 61 int barrier = 0; |
62 __asm__ __volatile__("xchgl %%eax,%0 ":"=r" (barrier)); | 62 __asm__ __volatile__("xchgl %%eax,%0 ":"=r" (barrier)); |
63 } | 63 } |
64 | 64 |
65 #endif // __MINGW64_VERSION_MAJOR | 65 #endif // __MINGW64_VERSION_MAJOR |
66 | 66 |
67 | 67 |
68 #ifndef MINGW_HAS_SECURE_API | 68 #ifdef MINGW_HAS_SECURE_API |
| 69 #define localtime_s v8_localtime_s |
| 70 #define fopen_s v8_fopen_s |
| 71 #define _vsnprintf_s v8_vsnprintf_s |
| 72 #define strncpy_s v8_strncpy_s |
| 73 #endif // MINGW_HAS_SECURE_API |
| 74 |
69 | 75 |
70 int localtime_s(tm* out_tm, const time_t* time) { | 76 int localtime_s(tm* out_tm, const time_t* time) { |
71 tm* posix_local_time_struct = localtime(time); | 77 tm* posix_local_time_struct = localtime(time); |
72 if (posix_local_time_struct == NULL) return 1; | 78 if (posix_local_time_struct == NULL) return 1; |
73 *out_tm = *posix_local_time_struct; | 79 *out_tm = *posix_local_time_struct; |
74 return 0; | 80 return 0; |
75 } | 81 } |
76 | 82 |
77 | 83 |
78 int fopen_s(FILE** pFile, const char* filename, const char* mode) { | 84 int fopen_s(FILE** pFile, const char* filename, const char* mode) { |
(...skipping 27 matching lines...) Expand all Loading... |
106 *(dest++) = *(source++); | 112 *(dest++) = *(source++); |
107 --dest_size; | 113 --dest_size; |
108 --count; | 114 --count; |
109 } | 115 } |
110 } | 116 } |
111 CHECK_GT(dest_size, 0); | 117 CHECK_GT(dest_size, 0); |
112 *dest = 0; | 118 *dest = 0; |
113 return 0; | 119 return 0; |
114 } | 120 } |
115 | 121 |
116 #endif // MINGW_HAS_SECURE_API | |
117 | |
118 #endif // __MINGW32__ | 122 #endif // __MINGW32__ |
119 | 123 |
120 // Generate a pseudo-random number in the range 0-2^31-1. Usually | 124 // Generate a pseudo-random number in the range 0-2^31-1. Usually |
121 // defined in stdlib.h. Missing in both Microsoft Visual Studio C++ and MinGW. | 125 // defined in stdlib.h. Missing in both Microsoft Visual Studio C++ and MinGW. |
122 int random() { | 126 int random() { |
123 return rand(); | 127 return rand(); |
124 } | 128 } |
125 | 129 |
126 | 130 |
127 namespace v8 { | 131 namespace v8 { |
(...skipping 1997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2125 | 2129 |
2126 | 2130 |
2127 void Sampler::Stop() { | 2131 void Sampler::Stop() { |
2128 ASSERT(IsActive()); | 2132 ASSERT(IsActive()); |
2129 SamplerThread::RemoveActiveSampler(this); | 2133 SamplerThread::RemoveActiveSampler(this); |
2130 SetActive(false); | 2134 SetActive(false); |
2131 } | 2135 } |
2132 | 2136 |
2133 | 2137 |
2134 } } // namespace v8::internal | 2138 } } // namespace v8::internal |
OLD | NEW |