| 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 #ifndef SRC_VM_HEAP_H_ | 5 #ifndef SRC_VM_HEAP_H_ |
| 6 #define SRC_VM_HEAP_H_ | 6 #define SRC_VM_HEAP_H_ |
| 7 | 7 |
| 8 #include "src/shared/globals.h" | 8 #include "src/shared/globals.h" |
| 9 #include "src/shared/random.h" | 9 #include "src/shared/random.h" |
| 10 #include "src/vm/object.h" | 10 #include "src/vm/object.h" |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 Object* object = *p; | 167 Object* object = *p; |
| 168 if (!object->IsHeapObject()) return; | 168 if (!object->IsHeapObject()) return; |
| 169 if (!from_->Includes(reinterpret_cast<uword>(object))) return; | 169 if (!from_->Includes(reinterpret_cast<uword>(object))) return; |
| 170 *p = reinterpret_cast<HeapObject*>(object)->CloneInToSpace(to_); | 170 *p = reinterpret_cast<HeapObject*>(object)->CloneInToSpace(to_); |
| 171 } | 171 } |
| 172 | 172 |
| 173 Space* from_; | 173 Space* from_; |
| 174 Space* to_; | 174 Space* to_; |
| 175 }; | 175 }; |
| 176 | 176 |
| 177 // Extract a raw void* pointer from [object]. | 177 // Read [object] as an integer word value. |
| 178 // | 178 // |
| 179 // [object] must be either a Smi or a LargeInteger. | 179 // [object] must be either a Smi or a LargeInteger. |
| 180 inline word AsForeignWord(Object* object) { | 180 inline word AsForeignWord(Object* object) { |
| 181 return object->IsSmi() | 181 return object->IsSmi() |
| 182 ? Smi::cast(object)->value() | 182 ? Smi::cast(object)->value() |
| 183 : LargeInteger::cast(object)->value(); | 183 : LargeInteger::cast(object)->value(); |
| 184 } | 184 } |
| 185 | 185 |
| 186 // Read [object] as an integer int64 value. |
| 187 // |
| 188 // [object] must be either a Smi or a LargeInteger. |
| 189 inline int64 AsForeignInt64(Object* object) { |
| 190 return object->IsSmi() |
| 191 ? Smi::cast(object)->value() |
| 192 : LargeInteger::cast(object)->value(); |
| 193 } |
| 194 |
| 186 | 195 |
| 187 } // namespace fletch | 196 } // namespace fletch |
| 188 | 197 |
| 189 | 198 |
| 190 #endif // SRC_VM_HEAP_H_ | 199 #endif // SRC_VM_HEAP_H_ |
| OLD | NEW |