OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 // timestamp is used for determining if DST is in effect. | 125 // timestamp is used for determining if DST is in effect. |
126 static char* LocalTimezone(double time); | 126 static char* LocalTimezone(double time); |
127 | 127 |
128 // Returns the local time offset in milliseconds east of UTC without | 128 // Returns the local time offset in milliseconds east of UTC without |
129 // taking daylight savings time into account. | 129 // taking daylight savings time into account. |
130 static double LocalTimeOffset(); | 130 static double LocalTimeOffset(); |
131 | 131 |
132 // Returns the daylight savings offset for the given time. | 132 // Returns the daylight savings offset for the given time. |
133 static double DaylightSavingsOffset(double time); | 133 static double DaylightSavingsOffset(double time); |
134 | 134 |
| 135 static FILE* FOpen(const char* path, const char* mode); |
| 136 |
135 // Print output to console. This is mostly used for debugging output. | 137 // Print output to console. This is mostly used for debugging output. |
136 // On platforms that has standard terminal output, the output | 138 // On platforms that has standard terminal output, the output |
137 // should go to stdout. | 139 // should go to stdout. |
138 static void Print(const char* format, ...); | 140 static void Print(const char* format, ...); |
139 static void VPrint(const char* format, va_list args); | 141 static void VPrint(const char* format, va_list args); |
140 | 142 |
141 // Print error output to console. This is mostly used for error message | 143 // Print error output to console. This is mostly used for error message |
142 // output. On platforms that has standard terminal output, the output | 144 // output. On platforms that has standard terminal output, the output |
143 // should go to stderr. | 145 // should go to stderr. |
144 static void PrintError(const char* format, ...); | 146 static void PrintError(const char* format, ...); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 | 193 |
192 class MemoryMappedFile { | 194 class MemoryMappedFile { |
193 public: | 195 public: |
194 static MemoryMappedFile* create(const char* name, int size, void* initial); | 196 static MemoryMappedFile* create(const char* name, int size, void* initial); |
195 virtual ~MemoryMappedFile() { } | 197 virtual ~MemoryMappedFile() { } |
196 virtual void* memory() = 0; | 198 virtual void* memory() = 0; |
197 }; | 199 }; |
198 | 200 |
199 // Safe formatting print. Ensures that str is always null-terminated. | 201 // Safe formatting print. Ensures that str is always null-terminated. |
200 // Returns the number of chars written, or -1 if output was truncated. | 202 // Returns the number of chars written, or -1 if output was truncated. |
201 static int SNPrintF(char* str, size_t size, const char* format, ...); | 203 static int SNPrintF(Vector<char> str, const char* format, ...); |
202 static int VSNPrintF(char* str, | 204 static int VSNPrintF(Vector<char> str, |
203 size_t size, | |
204 const char* format, | 205 const char* format, |
205 va_list args); | 206 va_list args); |
206 | 207 |
| 208 static void StrNCpy(Vector<char> dest, const char* src, size_t n); |
| 209 static void WcsCpy(Vector<wchar_t> dest, const wchar_t* src); |
| 210 static char* StrDup(const char* str); |
| 211 |
207 // Support for profiler. Can do nothing, in which case ticks | 212 // Support for profiler. Can do nothing, in which case ticks |
208 // occuring in shared libraries will not be properly accounted | 213 // occuring in shared libraries will not be properly accounted |
209 // for. | 214 // for. |
210 static void LogSharedLibraryAddresses(); | 215 static void LogSharedLibraryAddresses(); |
211 | 216 |
212 // Returns the double constant NAN | 217 // Returns the double constant NAN |
213 static double nan_value(); | 218 static double nan_value(); |
214 | 219 |
215 private: | 220 private: |
216 static const int msPerSecond = 1000; | 221 static const int msPerSecond = 1000; |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 bool active_; | 437 bool active_; |
433 PlatformData* data_; // Platform specific data. | 438 PlatformData* data_; // Platform specific data. |
434 DISALLOW_IMPLICIT_CONSTRUCTORS(Sampler); | 439 DISALLOW_IMPLICIT_CONSTRUCTORS(Sampler); |
435 }; | 440 }; |
436 | 441 |
437 #endif // ENABLE_LOGGING_AND_PROFILING | 442 #endif // ENABLE_LOGGING_AND_PROFILING |
438 | 443 |
439 } } // namespace v8::internal | 444 } } // namespace v8::internal |
440 | 445 |
441 #endif // V8_PLATFORM_H_ | 446 #endif // V8_PLATFORM_H_ |
OLD | NEW |