| 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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 static void PrintError(const char* format, ...); | 196 static void PrintError(const char* format, ...); |
| 197 static void VPrintError(const char* format, va_list args); | 197 static void VPrintError(const char* format, va_list args); |
| 198 | 198 |
| 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 |
| 206 // Get the Alignment guaranteed by Allocate(). | 207 // Get the Alignment guaranteed by Allocate(). |
| 207 static size_t AllocateAlignment(); | 208 static size_t AllocateAlignment(); |
| 208 | 209 |
| 209 #ifdef ENABLE_HEAP_PROTECTION | 210 #ifdef ENABLE_HEAP_PROTECTION |
| 210 // Protect/unprotect a block of memory by marking it read-only/writable. | 211 // Protect/unprotect a block of memory by marking it read-only/writable. |
| 211 static void Protect(void* address, size_t size); | 212 static void Protect(void* address, size_t size); |
| 212 static void Unprotect(void* address, size_t size, bool is_executable); | 213 static void Unprotect(void* address, size_t size, bool is_executable); |
| 214 |
| 215 // Assign memory as a guard page so that access will cause an exception. |
| 216 static void Guard(void* address, const size_t size); |
| 213 #endif | 217 #endif |
| 214 | 218 |
| 215 // Returns an indication of whether a pointer is in a space that | 219 // Returns an indication of whether a pointer is in a space that |
| 216 // has been allocated by Allocate(). This method may conservatively | 220 // has been allocated by Allocate(). This method may conservatively |
| 217 // always return false, but giving more accurate information may | 221 // always return false, but giving more accurate information may |
| 218 // improve the robustness of the stack dump code in the presence of | 222 // improve the robustness of the stack dump code in the presence of |
| 219 // heap corruption. | 223 // heap corruption. |
| 220 static bool IsOutsideAllocatedSpace(void* pointer); | 224 static bool IsOutsideAllocatedSpace(void* pointer); |
| 221 | 225 |
| 222 // Sleep for a number of milliseconds. | 226 // Sleep for a number of milliseconds. |
| (...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 660 int samples_taken_; // Counts stack samples taken. | 664 int samples_taken_; // Counts stack samples taken. |
| 661 DISALLOW_IMPLICIT_CONSTRUCTORS(Sampler); | 665 DISALLOW_IMPLICIT_CONSTRUCTORS(Sampler); |
| 662 }; | 666 }; |
| 663 | 667 |
| 664 | 668 |
| 665 #endif // ENABLE_LOGGING_AND_PROFILING | 669 #endif // ENABLE_LOGGING_AND_PROFILING |
| 666 | 670 |
| 667 } } // namespace v8::internal | 671 } } // namespace v8::internal |
| 668 | 672 |
| 669 #endif // V8_PLATFORM_H_ | 673 #endif // V8_PLATFORM_H_ |
| OLD | NEW |