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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 :"r"(kMacTlsBaseOffset), "r"(index)); | 152 :"r"(kMacTlsBaseOffset), "r"(index)); |
153 #endif | 153 #endif |
154 return result; | 154 return result; |
155 } | 155 } |
156 | 156 |
157 #endif | 157 #endif |
158 | 158 |
159 #endif // V8_NO_FAST_TLS | 159 #endif // V8_NO_FAST_TLS |
160 | 160 |
161 | 161 |
| 162 class TimezoneCache; |
| 163 |
| 164 |
162 // ---------------------------------------------------------------------------- | 165 // ---------------------------------------------------------------------------- |
163 // OS | 166 // OS |
164 // | 167 // |
165 // This class has static methods for the different platform specific | 168 // This class has static methods for the different platform specific |
166 // functions. Add methods here to cope with differences between the | 169 // functions. Add methods here to cope with differences between the |
167 // supported platforms. | 170 // supported platforms. |
168 | 171 |
169 class OS { | 172 class OS { |
170 public: | 173 public: |
171 // Initializes the platform OS support that depend on CPU features. This is | 174 // Initializes the platform OS support that depend on CPU features. This is |
172 // called after CPU initialization. | 175 // called after CPU initialization. |
173 static void PostSetUp(); | 176 static void PostSetUp(); |
174 | 177 |
175 // Returns the accumulated user time for thread. This routine | 178 // Returns the accumulated user time for thread. This routine |
176 // can be used for profiling. The implementation should | 179 // can be used for profiling. The implementation should |
177 // strive for high-precision timer resolution, preferable | 180 // strive for high-precision timer resolution, preferable |
178 // micro-second resolution. | 181 // micro-second resolution. |
179 static int GetUserTime(uint32_t* secs, uint32_t* usecs); | 182 static int GetUserTime(uint32_t* secs, uint32_t* usecs); |
180 | 183 |
181 // Returns current time as the number of milliseconds since | 184 // Returns current time as the number of milliseconds since |
182 // 00:00:00 UTC, January 1, 1970. | 185 // 00:00:00 UTC, January 1, 1970. |
183 static double TimeCurrentMillis(); | 186 static double TimeCurrentMillis(); |
184 | 187 |
| 188 static TimezoneCache* CreateTimezoneCache(); |
| 189 static void DisposeTimezoneCache(TimezoneCache* cache); |
| 190 static void ClearTimezoneCache(TimezoneCache* cache); |
| 191 |
185 // Returns a string identifying the current time zone. The | 192 // Returns a string identifying the current time zone. The |
186 // timestamp is used for determining if DST is in effect. | 193 // timestamp is used for determining if DST is in effect. |
187 static const char* LocalTimezone(double time); | 194 static const char* LocalTimezone(double time, TimezoneCache* cache); |
188 | 195 |
189 // Returns the local time offset in milliseconds east of UTC without | 196 // Returns the local time offset in milliseconds east of UTC without |
190 // taking daylight savings time into account. | 197 // taking daylight savings time into account. |
191 static double LocalTimeOffset(); | 198 static double LocalTimeOffset(TimezoneCache* cache); |
192 | 199 |
193 // Returns the daylight savings offset for the given time. | 200 // Returns the daylight savings offset for the given time. |
194 static double DaylightSavingsOffset(double time); | 201 static double DaylightSavingsOffset(double time, TimezoneCache* cache); |
195 | |
196 static void TimeZoneChanged(); | |
197 | 202 |
198 // Returns last OS error. | 203 // Returns last OS error. |
199 static int GetLastError(); | 204 static int GetLastError(); |
200 | 205 |
201 static FILE* FOpen(const char* path, const char* mode); | 206 static FILE* FOpen(const char* path, const char* mode); |
202 static bool Remove(const char* path); | 207 static bool Remove(const char* path); |
203 | 208 |
204 // Opens a temporary file, the file is auto removed on close. | 209 // Opens a temporary file, the file is auto removed on close. |
205 static FILE* OpenTemporaryFile(); | 210 static FILE* OpenTemporaryFile(); |
206 | 211 |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
612 char name_[kMaxThreadNameLength]; | 617 char name_[kMaxThreadNameLength]; |
613 int stack_size_; | 618 int stack_size_; |
614 Semaphore* start_semaphore_; | 619 Semaphore* start_semaphore_; |
615 | 620 |
616 DISALLOW_COPY_AND_ASSIGN(Thread); | 621 DISALLOW_COPY_AND_ASSIGN(Thread); |
617 }; | 622 }; |
618 | 623 |
619 } } // namespace v8::internal | 624 } } // namespace v8::internal |
620 | 625 |
621 #endif // V8_PLATFORM_H_ | 626 #endif // V8_PLATFORM_H_ |
OLD | NEW |