OLD | NEW |
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 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 | 301 |
302 // Construct a virtual memory by assigning it some already mapped address | 302 // Construct a virtual memory by assigning it some already mapped address |
303 // and size. | 303 // and size. |
304 VirtualMemory(void* address, size_t size) : address_(address), size_(size) {} | 304 VirtualMemory(void* address, size_t size) : address_(address), size_(size) {} |
305 | 305 |
306 // Releases the reserved memory, if any, controlled by this VirtualMemory | 306 // Releases the reserved memory, if any, controlled by this VirtualMemory |
307 // object. | 307 // object. |
308 ~VirtualMemory(); | 308 ~VirtualMemory(); |
309 | 309 |
310 // Returns whether the memory has been reserved. | 310 // Returns whether the memory has been reserved. |
311 bool IsReserved(); | 311 bool IsReserved() const; |
312 | 312 |
313 // Initialize or resets an embedded VirtualMemory object. | 313 // Initialize or resets an embedded VirtualMemory object. |
314 void Reset(); | 314 void Reset(); |
315 | 315 |
316 // Returns the start address of the reserved memory. | 316 // Returns the start address of the reserved memory. |
317 // If the memory was reserved with an alignment, this address is not | 317 // If the memory was reserved with an alignment, this address is not |
318 // necessarily aligned. The user might need to round it up to a multiple of | 318 // necessarily aligned. The user might need to round it up to a multiple of |
319 // the alignment to get the start of the aligned block. | 319 // the alignment to get the start of the aligned block. |
320 void* address() { | 320 void* address() const { |
321 DCHECK(IsReserved()); | 321 DCHECK(IsReserved()); |
322 return address_; | 322 return address_; |
323 } | 323 } |
324 | 324 |
325 // Returns the size of the reserved memory. The returned value is only | 325 // Returns the size of the reserved memory. The returned value is only |
326 // meaningful when IsReserved() returns true. | 326 // meaningful when IsReserved() returns true. |
327 // If the memory was reserved with an alignment, this size may be larger | 327 // If the memory was reserved with an alignment, this size may be larger |
328 // than the requested size. | 328 // than the requested size. |
329 size_t size() { return size_; } | 329 size_t size() const { return size_; } |
330 | 330 |
331 // Commits real memory. Returns whether the operation succeeded. | 331 // Commits real memory. Returns whether the operation succeeded. |
332 bool Commit(void* address, size_t size, bool is_executable); | 332 bool Commit(void* address, size_t size, bool is_executable); |
333 | 333 |
334 // Uncommit real memory. Returns whether the operation succeeded. | 334 // Uncommit real memory. Returns whether the operation succeeded. |
335 bool Uncommit(void* address, size_t size); | 335 bool Uncommit(void* address, size_t size); |
336 | 336 |
337 // Creates a single guard page at the given address. | 337 // Creates a single guard page at the given address. |
338 bool Guard(void* address); | 338 bool Guard(void* address); |
339 | 339 |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 int stack_size_; | 512 int stack_size_; |
513 Semaphore* start_semaphore_; | 513 Semaphore* start_semaphore_; |
514 | 514 |
515 DISALLOW_COPY_AND_ASSIGN(Thread); | 515 DISALLOW_COPY_AND_ASSIGN(Thread); |
516 }; | 516 }; |
517 | 517 |
518 } // namespace base | 518 } // namespace base |
519 } // namespace v8 | 519 } // namespace v8 |
520 | 520 |
521 #endif // V8_BASE_PLATFORM_PLATFORM_H_ | 521 #endif // V8_BASE_PLATFORM_PLATFORM_H_ |
OLD | NEW |