| 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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 | 171 |
| 172 class OS { | 172 class OS { |
| 173 public: | 173 public: |
| 174 // Initializes the platform OS support. Called once at VM startup. | 174 // Initializes the platform OS support. Called once at VM startup. |
| 175 static void SetUp(); | 175 static void SetUp(); |
| 176 | 176 |
| 177 // Initializes the platform OS support that depend on CPU features. This is | 177 // Initializes the platform OS support that depend on CPU features. This is |
| 178 // called after CPU initialization. | 178 // called after CPU initialization. |
| 179 static void PostSetUp(); | 179 static void PostSetUp(); |
| 180 | 180 |
| 181 // Clean up platform-OS-related things. Called once at VM shutdown. | |
| 182 static void TearDown(); | |
| 183 | |
| 184 // Returns the accumulated user time for thread. This routine | 181 // Returns the accumulated user time for thread. This routine |
| 185 // can be used for profiling. The implementation should | 182 // can be used for profiling. The implementation should |
| 186 // strive for high-precision timer resolution, preferable | 183 // strive for high-precision timer resolution, preferable |
| 187 // micro-second resolution. | 184 // micro-second resolution. |
| 188 static int GetUserTime(uint32_t* secs, uint32_t* usecs); | 185 static int GetUserTime(uint32_t* secs, uint32_t* usecs); |
| 189 | 186 |
| 190 // Returns current time as the number of milliseconds since | 187 // Returns current time as the number of milliseconds since |
| 191 // 00:00:00 UTC, January 1, 1970. | 188 // 00:00:00 UTC, January 1, 1970. |
| 192 static double TimeCurrentMillis(); | 189 static double TimeCurrentMillis(); |
| 193 | 190 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 | 244 |
| 248 // Assign memory as a guard page so that access will cause an exception. | 245 // Assign memory as a guard page so that access will cause an exception. |
| 249 static void Guard(void* address, const size_t size); | 246 static void Guard(void* address, const size_t size); |
| 250 | 247 |
| 251 // Generate a random address to be used for hinting mmap(). | 248 // Generate a random address to be used for hinting mmap(). |
| 252 static void* GetRandomMmapAddr(); | 249 static void* GetRandomMmapAddr(); |
| 253 | 250 |
| 254 // Get the Alignment guaranteed by Allocate(). | 251 // Get the Alignment guaranteed by Allocate(). |
| 255 static size_t AllocateAlignment(); | 252 static size_t AllocateAlignment(); |
| 256 | 253 |
| 257 // Returns an indication of whether a pointer is in a space that | |
| 258 // has been allocated by Allocate(). This method may conservatively | |
| 259 // always return false, but giving more accurate information may | |
| 260 // improve the robustness of the stack dump code in the presence of | |
| 261 // heap corruption. | |
| 262 static bool IsOutsideAllocatedSpace(void* pointer); | |
| 263 | |
| 264 // Sleep for a number of milliseconds. | 254 // Sleep for a number of milliseconds. |
| 265 static void Sleep(const int milliseconds); | 255 static void Sleep(const int milliseconds); |
| 266 | 256 |
| 267 // Abort the current process. | 257 // Abort the current process. |
| 268 static void Abort(); | 258 static void Abort(); |
| 269 | 259 |
| 270 // Debug break. | 260 // Debug break. |
| 271 static void DebugBreak(); | 261 static void DebugBreak(); |
| 272 | 262 |
| 273 // Dump C++ current stack trace (only functional on Linux). | 263 // Dump C++ current stack trace (only functional on Linux). |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 608 char name_[kMaxThreadNameLength]; | 598 char name_[kMaxThreadNameLength]; |
| 609 int stack_size_; | 599 int stack_size_; |
| 610 Semaphore* start_semaphore_; | 600 Semaphore* start_semaphore_; |
| 611 | 601 |
| 612 DISALLOW_COPY_AND_ASSIGN(Thread); | 602 DISALLOW_COPY_AND_ASSIGN(Thread); |
| 613 }; | 603 }; |
| 614 | 604 |
| 615 } } // namespace v8::internal | 605 } } // namespace v8::internal |
| 616 | 606 |
| 617 #endif // V8_PLATFORM_H_ | 607 #endif // V8_PLATFORM_H_ |
| OLD | NEW |