| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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/freelist.h" | 5 #include "vm/freelist.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "vm/bit_set.h" | 10 #include "vm/bit_set.h" |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 VirtualMemory::kReadWrite /*Execute*/); | 116 VirtualMemory::kReadWrite /*Execute*/); |
| 117 ASSERT(status); | 117 ASSERT(status); |
| 118 } | 118 } |
| 119 if (previous == NULL) { | 119 if (previous == NULL) { |
| 120 free_lists_[kNumLists] = current->next(); | 120 free_lists_[kNumLists] = current->next(); |
| 121 } else { | 121 } else { |
| 122 // If the previous free list element's next field is protected, it | 122 // If the previous free list element's next field is protected, it |
| 123 // needs to be unprotected before storing to it and reprotected | 123 // needs to be unprotected before storing to it and reprotected |
| 124 // after. | 124 // after. |
| 125 bool target_is_protected = false; | 125 bool target_is_protected = false; |
| 126 uword target_address = NULL; | 126 uword target_address = 0L; |
| 127 if (is_protected) { | 127 if (is_protected) { |
| 128 uword writable_start = reinterpret_cast<uword>(current); | 128 uword writable_start = reinterpret_cast<uword>(current); |
| 129 uword writable_end = | 129 uword writable_end = |
| 130 writable_start + size + FreeListElement::kHeaderSize - 1; | 130 writable_start + size + FreeListElement::kHeaderSize - 1; |
| 131 target_address = previous->next_address(); | 131 target_address = previous->next_address(); |
| 132 target_is_protected = | 132 target_is_protected = |
| 133 !VirtualMemory::InSamePage(target_address, writable_start) && | 133 !VirtualMemory::InSamePage(target_address, writable_start) && |
| 134 !VirtualMemory::InSamePage(target_address, writable_end); | 134 !VirtualMemory::InSamePage(target_address, writable_end); |
| 135 } | 135 } |
| 136 if (target_is_protected) { | 136 if (target_is_protected) { |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 !VirtualMemory::InSamePage(remainder_address - 1, remainder_address)) { | 311 !VirtualMemory::InSamePage(remainder_address - 1, remainder_address)) { |
| 312 bool status = | 312 bool status = |
| 313 VirtualMemory::Protect(reinterpret_cast<void*>(remainder_address), | 313 VirtualMemory::Protect(reinterpret_cast<void*>(remainder_address), |
| 314 remainder_size, | 314 remainder_size, |
| 315 VirtualMemory::kReadExecute); | 315 VirtualMemory::kReadExecute); |
| 316 ASSERT(status); | 316 ASSERT(status); |
| 317 } | 317 } |
| 318 } | 318 } |
| 319 | 319 |
| 320 } // namespace dart | 320 } // namespace dart |
| OLD | NEW |