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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 // Allocate/Free memory used by JS heap. Pages are readable/writable, but | 199 // Allocate/Free memory used by JS heap. Pages are readable/writable, but |
200 // they are not guaranteed to be executable unless 'executable' is true. | 200 // they are not guaranteed to be executable unless 'executable' is true. |
201 // Returns the address of allocated memory, or NULL if failed. | 201 // Returns the address of allocated memory, or NULL if failed. |
202 static void* Allocate(const size_t requested, | 202 static void* Allocate(const size_t requested, |
203 size_t* allocated, | 203 size_t* allocated, |
204 bool is_executable); | 204 bool is_executable); |
205 static void Free(void* address, const size_t size); | 205 static void Free(void* address, const size_t size); |
206 // Get the Alignment guaranteed by Allocate(). | 206 // Get the Alignment guaranteed by Allocate(). |
207 static size_t AllocateAlignment(); | 207 static size_t AllocateAlignment(); |
208 | 208 |
209 #ifdef ENABLE_HEAP_PROTECTION | |
210 // Protect/unprotect a block of memory by marking it read-only/writable. | |
211 static void Protect(void* address, size_t size); | |
212 static void Unprotect(void* address, size_t size, bool is_executable); | |
213 #endif | |
214 | |
215 // Returns an indication of whether a pointer is in a space that | 209 // Returns an indication of whether a pointer is in a space that |
216 // has been allocated by Allocate(). This method may conservatively | 210 // has been allocated by Allocate(). This method may conservatively |
217 // always return false, but giving more accurate information may | 211 // always return false, but giving more accurate information may |
218 // improve the robustness of the stack dump code in the presence of | 212 // improve the robustness of the stack dump code in the presence of |
219 // heap corruption. | 213 // heap corruption. |
220 static bool IsOutsideAllocatedSpace(void* pointer); | 214 static bool IsOutsideAllocatedSpace(void* pointer); |
221 | 215 |
222 // Sleep for a number of milliseconds. | 216 // Sleep for a number of milliseconds. |
223 static void Sleep(const int milliseconds); | 217 static void Sleep(const int milliseconds); |
224 | 218 |
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
660 int samples_taken_; // Counts stack samples taken. | 654 int samples_taken_; // Counts stack samples taken. |
661 DISALLOW_IMPLICIT_CONSTRUCTORS(Sampler); | 655 DISALLOW_IMPLICIT_CONSTRUCTORS(Sampler); |
662 }; | 656 }; |
663 | 657 |
664 | 658 |
665 #endif // ENABLE_LOGGING_AND_PROFILING | 659 #endif // ENABLE_LOGGING_AND_PROFILING |
666 | 660 |
667 } } // namespace v8::internal | 661 } } // namespace v8::internal |
668 | 662 |
669 #endif // V8_PLATFORM_H_ | 663 #endif // V8_PLATFORM_H_ |
OLD | NEW |