| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 | 177 |
| 178 // Assign memory as a guard page so that access will cause an exception. | 178 // Assign memory as a guard page so that access will cause an exception. |
| 179 static void Guard(void* address, const size_t size); | 179 static void Guard(void* address, const size_t size); |
| 180 | 180 |
| 181 // Generate a random address to be used for hinting mmap(). | 181 // Generate a random address to be used for hinting mmap(). |
| 182 static void* GetRandomMmapAddr(); | 182 static void* GetRandomMmapAddr(); |
| 183 | 183 |
| 184 // Get the Alignment guaranteed by Allocate(). | 184 // Get the Alignment guaranteed by Allocate(). |
| 185 static size_t AllocateAlignment(); | 185 static size_t AllocateAlignment(); |
| 186 | 186 |
| 187 static intptr_t CommitPageSize(); |
| 188 |
| 187 // Returns an indication of whether a pointer is in a space that | 189 // Returns an indication of whether a pointer is in a space that |
| 188 // has been allocated by Allocate(). This method may conservatively | 190 // has been allocated by Allocate(). This method may conservatively |
| 189 // always return false, but giving more accurate information may | 191 // always return false, but giving more accurate information may |
| 190 // improve the robustness of the stack dump code in the presence of | 192 // improve the robustness of the stack dump code in the presence of |
| 191 // heap corruption. | 193 // heap corruption. |
| 192 static bool IsOutsideAllocatedSpace(void* pointer); | 194 static bool IsOutsideAllocatedSpace(void* pointer); |
| 193 | 195 |
| 194 // Sleep for a number of milliseconds. | 196 // Sleep for a number of milliseconds. |
| 195 static void Sleep(const int milliseconds); | 197 static void Sleep(const int milliseconds); |
| 196 | 198 |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 // If the memory was reserved with an alignment, this size may be larger | 347 // If the memory was reserved with an alignment, this size may be larger |
| 346 // than the requested size. | 348 // than the requested size. |
| 347 size_t size() { return size_; } | 349 size_t size() { return size_; } |
| 348 | 350 |
| 349 // Commits real memory. Returns whether the operation succeeded. | 351 // Commits real memory. Returns whether the operation succeeded. |
| 350 bool Commit(void* address, size_t size, bool is_executable); | 352 bool Commit(void* address, size_t size, bool is_executable); |
| 351 | 353 |
| 352 // Uncommit real memory. Returns whether the operation succeeded. | 354 // Uncommit real memory. Returns whether the operation succeeded. |
| 353 bool Uncommit(void* address, size_t size); | 355 bool Uncommit(void* address, size_t size); |
| 354 | 356 |
| 357 // Creates a single guard page at the given address. |
| 358 bool Guard(void* address); |
| 359 |
| 355 void Release() { | 360 void Release() { |
| 356 ASSERT(IsReserved()); | 361 ASSERT(IsReserved()); |
| 357 // Notice: Order is important here. The VirtualMemory object might live | 362 // Notice: Order is important here. The VirtualMemory object might live |
| 358 // inside the allocated region. | 363 // inside the allocated region. |
| 359 void* address = address_; | 364 void* address = address_; |
| 360 size_t size = size_; | 365 size_t size = size_; |
| 361 Reset(); | 366 Reset(); |
| 362 bool result = ReleaseRegion(address, size); | 367 bool result = ReleaseRegion(address, size); |
| 363 USE(result); | 368 USE(result); |
| 364 ASSERT(result); | 369 ASSERT(result); |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 684 Atomic32 active_; | 689 Atomic32 active_; |
| 685 PlatformData* data_; // Platform specific data. | 690 PlatformData* data_; // Platform specific data. |
| 686 int samples_taken_; // Counts stack samples taken. | 691 int samples_taken_; // Counts stack samples taken. |
| 687 DISALLOW_IMPLICIT_CONSTRUCTORS(Sampler); | 692 DISALLOW_IMPLICIT_CONSTRUCTORS(Sampler); |
| 688 }; | 693 }; |
| 689 | 694 |
| 690 | 695 |
| 691 } } // namespace v8::internal | 696 } } // namespace v8::internal |
| 692 | 697 |
| 693 #endif // V8_PLATFORM_H_ | 698 #endif // V8_PLATFORM_H_ |
| OLD | NEW |