| 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 1395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1406 | 1406 |
| 1407 VirtualMemory::VirtualMemory(size_t size, size_t alignment) | 1407 VirtualMemory::VirtualMemory(size_t size, size_t alignment) |
| 1408 : address_(NULL), size_(0) { | 1408 : address_(NULL), size_(0) { |
| 1409 ASSERT(IsAligned(alignment, static_cast<intptr_t>(OS::AllocateAlignment()))); | 1409 ASSERT(IsAligned(alignment, static_cast<intptr_t>(OS::AllocateAlignment()))); |
| 1410 size_t request_size = RoundUp(size + alignment, | 1410 size_t request_size = RoundUp(size + alignment, |
| 1411 static_cast<intptr_t>(OS::AllocateAlignment())); | 1411 static_cast<intptr_t>(OS::AllocateAlignment())); |
| 1412 void* address = ReserveRegion(request_size); | 1412 void* address = ReserveRegion(request_size); |
| 1413 if (address == NULL) return; | 1413 if (address == NULL) return; |
| 1414 Address base = RoundUp(static_cast<Address>(address), alignment); | 1414 Address base = RoundUp(static_cast<Address>(address), alignment); |
| 1415 // Try reducing the size by freeing and then reallocating a specific area. | 1415 // Try reducing the size by freeing and then reallocating a specific area. |
| 1416 ReleaseRegion(address, request_size); | 1416 bool result = ReleaseRegion(address, request_size); |
| 1417 USE(result); |
| 1418 ASSERT(result); |
| 1417 address = VirtualAlloc(base, size, MEM_RESERVE, PAGE_NOACCESS); | 1419 address = VirtualAlloc(base, size, MEM_RESERVE, PAGE_NOACCESS); |
| 1418 if (address != NULL) { | 1420 if (address != NULL) { |
| 1419 request_size = size; | 1421 request_size = size; |
| 1420 ASSERT(base == static_cast<Address>(address)); | 1422 ASSERT(base == static_cast<Address>(address)); |
| 1421 } else { | 1423 } else { |
| 1422 // Resizing failed, just go with a bigger area. | 1424 // Resizing failed, just go with a bigger area. |
| 1423 address = ReserveRegion(request_size); | 1425 address = ReserveRegion(request_size); |
| 1424 if (address == NULL) return; | 1426 if (address == NULL) return; |
| 1425 } | 1427 } |
| 1426 address_ = address; | 1428 address_ = address; |
| (...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2031 | 2033 |
| 2032 | 2034 |
| 2033 void Sampler::Stop() { | 2035 void Sampler::Stop() { |
| 2034 ASSERT(IsActive()); | 2036 ASSERT(IsActive()); |
| 2035 SamplerThread::RemoveActiveSampler(this); | 2037 SamplerThread::RemoveActiveSampler(this); |
| 2036 SetActive(false); | 2038 SetActive(false); |
| 2037 } | 2039 } |
| 2038 | 2040 |
| 2039 | 2041 |
| 2040 } } // namespace v8::internal | 2042 } } // namespace v8::internal |
| OLD | NEW |