Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: src/base/platform/platform.h

Issue 2396433008: [wasm] Add guard regions to end of WebAssembly.Memory buffers (Closed)
Patch Set: Merging with master Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/base/platform/platform-linux.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This module contains the platform-specific code. This make the rest of the 5 // This module contains the platform-specific code. This make the rest of the
6 // code less dependent on operating system, compilers and runtime libraries. 6 // code less dependent on operating system, compilers and runtime libraries.
7 // This module does specifically not deal with differences between different 7 // This module does specifically not deal with differences between different
8 // processor architecture. 8 // processor architecture.
9 // The platform classes have the same definition for all platforms. The 9 // The platform classes have the same definition for all platforms. The
10 // implementation for a particular platform is put in platform_<os>.cc. 10 // implementation for a particular platform is put in platform_<os>.cc.
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 static PRINTF_FORMAT(1, 0) void VPrintError(const char* format, va_list args); 171 static PRINTF_FORMAT(1, 0) void VPrintError(const char* format, va_list args);
172 172
173 // Allocate/Free memory used by JS heap. Pages are readable/writable, but 173 // Allocate/Free memory used by JS heap. Pages are readable/writable, but
174 // they are not guaranteed to be executable unless 'executable' is true. 174 // they are not guaranteed to be executable unless 'executable' is true.
175 // Returns the address of allocated memory, or NULL if failed. 175 // Returns the address of allocated memory, or NULL if failed.
176 static void* Allocate(const size_t requested, 176 static void* Allocate(const size_t requested,
177 size_t* allocated, 177 size_t* allocated,
178 bool is_executable); 178 bool is_executable);
179 static void Free(void* address, const size_t size); 179 static void Free(void* address, const size_t size);
180 180
181 // Allocates a region of memory that is inaccessible. On Windows this reserves
182 // but does not commit the memory. On Linux, it is equivalent to a call to
183 // Allocate() followed by Guard().
184 static void* AllocateGuarded(const size_t requested);
185
181 // This is the granularity at which the ProtectCode(...) call can set page 186 // This is the granularity at which the ProtectCode(...) call can set page
182 // permissions. 187 // permissions.
183 static intptr_t CommitPageSize(); 188 static intptr_t CommitPageSize();
184 189
185 // Mark code segments non-writable. 190 // Mark code segments non-writable.
186 static void ProtectCode(void* address, const size_t size); 191 static void ProtectCode(void* address, const size_t size);
187 192
188 // Assign memory as a guard page so that access will cause an exception. 193 // Assign memory as a guard page so that access will cause an exception.
189 static void Guard(void* address, const size_t size); 194 static void Guard(void* address, const size_t size);
190 195
196 // Make a region of memory readable and writable.
197 static void Unprotect(void* address, const size_t size);
198
191 // Generate a random address to be used for hinting mmap(). 199 // Generate a random address to be used for hinting mmap().
192 static void* GetRandomMmapAddr(); 200 static void* GetRandomMmapAddr();
193 201
194 // Get the Alignment guaranteed by Allocate(). 202 // Get the Alignment guaranteed by Allocate().
195 static size_t AllocateAlignment(); 203 static size_t AllocateAlignment();
196 204
197 // Sleep for a specified time interval. 205 // Sleep for a specified time interval.
198 static void Sleep(TimeDelta interval); 206 static void Sleep(TimeDelta interval);
199 207
200 // Abort the current process. 208 // Abort the current process.
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 int stack_size_; 521 int stack_size_;
514 Semaphore* start_semaphore_; 522 Semaphore* start_semaphore_;
515 523
516 DISALLOW_COPY_AND_ASSIGN(Thread); 524 DISALLOW_COPY_AND_ASSIGN(Thread);
517 }; 525 };
518 526
519 } // namespace base 527 } // namespace base
520 } // namespace v8 528 } // namespace v8
521 529
522 #endif // V8_BASE_PLATFORM_PLATFORM_H_ 530 #endif // V8_BASE_PLATFORM_PLATFORM_H_
OLDNEW
« no previous file with comments | « no previous file | src/base/platform/platform-linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698