| OLD | NEW |
| 1 // Copyright (c) 2014, the Fletch project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Fletch 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.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
| 4 | 4 |
| 5 #include "src/vm/object_memory.h" | 5 #include "src/vm/object_memory.h" |
| 6 | 6 |
| 7 #include <stdlib.h> | 7 #include <stdlib.h> |
| 8 #include <stdio.h> | 8 #include <stdio.h> |
| 9 | 9 |
| 10 #include "src/shared/assert.h" | 10 #include "src/shared/assert.h" |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 } | 115 } |
| 116 | 116 |
| 117 void Space::TryDealloc(uword location, int size) { | 117 void Space::TryDealloc(uword location, int size) { |
| 118 if (top_ == location) top_ -= size; | 118 if (top_ == location) top_ -= size; |
| 119 } | 119 } |
| 120 | 120 |
| 121 void Space::AdjustAllocationBudget() { | 121 void Space::AdjustAllocationBudget() { |
| 122 allocation_budget_ = Utils::Maximum(512 * KB, Used()); | 122 allocation_budget_ = Utils::Maximum(512 * KB, Used()); |
| 123 } | 123 } |
| 124 | 124 |
| 125 void Space::SetAllocationBudget(int new_budget) { |
| 126 allocation_budget_ = new_budget; |
| 127 } |
| 128 |
| 125 void Space::PrependSpace(Space* space) { | 129 void Space::PrependSpace(Space* space) { |
| 126 bool was_empty = is_empty(); | 130 bool was_empty = is_empty(); |
| 127 | 131 |
| 128 if (space->is_empty()) return; | 132 if (space->is_empty()) return; |
| 129 | 133 |
| 130 space->Flush(); | 134 space->Flush(); |
| 131 | 135 |
| 132 Chunk* first = space->first(); | 136 Chunk* first = space->first(); |
| 133 Chunk* chunk = first; | 137 Chunk* chunk = first; |
| 134 while (chunk != NULL) { | 138 while (chunk != NULL) { |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 table = GetPageTable(address); | 391 table = GetPageTable(address); |
| 388 if (table == NULL) { | 392 if (table == NULL) { |
| 389 SetPageTable(address, table = new PageTable(address & ~0x3fffff)); | 393 SetPageTable(address, table = new PageTable(address & ~0x3fffff)); |
| 390 } | 394 } |
| 391 } | 395 } |
| 392 table->Set((address >> 12) & 0x3ff, space); | 396 table->Set((address >> 12) & 0x3ff, space); |
| 393 } | 397 } |
| 394 } | 398 } |
| 395 | 399 |
| 396 } // namespace fletch | 400 } // namespace fletch |
| OLD | NEW |