OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/virtual_memory.h" | 5 #include "vm/virtual_memory.h" |
6 | 6 |
7 #include "platform/assert.h" | 7 #include "platform/assert.h" |
8 #include "platform/utils.h" | 8 #include "platform/utils.h" |
9 | 9 |
10 namespace dart { | 10 namespace dart { |
(...skipping 10 matching lines...) Expand all Loading... |
21 if (try_unmap && | 21 if (try_unmap && |
22 (reserved_size_ == size()) && /* Don't create holes in reservation. */ | 22 (reserved_size_ == size()) && /* Don't create holes in reservation. */ |
23 FreeSubSegment(handle(), reinterpret_cast<void*>(start() + new_size), | 23 FreeSubSegment(handle(), reinterpret_cast<void*>(start() + new_size), |
24 size() - new_size)) { | 24 size() - new_size)) { |
25 reserved_size_ = new_size; | 25 reserved_size_ = new_size; |
26 } | 26 } |
27 region_.Subregion(region_, 0, new_size); | 27 region_.Subregion(region_, 0, new_size); |
28 } | 28 } |
29 | 29 |
30 | 30 |
31 VirtualMemory* VirtualMemory::ForExternalPage(void* pointer, uword size) { | 31 VirtualMemory* VirtualMemory::ForImagePage(void* pointer, uword size) { |
32 // Memory for precompilated instructions was allocated by the embedder, so | 32 // Memory for precompilated instructions was allocated by the embedder, so |
33 // create a VirtualMemory without allocating. | 33 // create a VirtualMemory without allocating. |
34 MemoryRegion region(pointer, size); | 34 MemoryRegion region(pointer, size); |
35 VirtualMemory* memory = new VirtualMemory(region); | 35 VirtualMemory* memory = new VirtualMemory(region); |
36 memory->embedder_allocated_ = true; | 36 memory->vm_owns_region_ = false; |
37 return memory; | 37 return memory; |
38 } | 38 } |
39 | 39 |
40 } // namespace dart | 40 } // namespace dart |
OLD | NEW |