OLD | NEW |
1 // Copyright (c) 2014, the Dartino project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dartino 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 11 matching lines...) Expand all Loading... |
22 // needed and causes a fatal error if a GC cannot free up enough memory | 22 // needed and causes a fatal error if a GC cannot free up enough memory |
23 // for the object. | 23 // for the object. |
24 Object* Allocate(uword size); | 24 Object* Allocate(uword size); |
25 | 25 |
26 // Called when an allocation fails in the semispace. Usually returns a | 26 // Called when an allocation fails in the semispace. Usually returns a |
27 // retry-after-GC failure, but may divert large allocations to an old space. | 27 // retry-after-GC failure, but may divert large allocations to an old space. |
28 virtual Object* HandleAllocationFailure(uword size) = 0; | 28 virtual Object* HandleAllocationFailure(uword size) = 0; |
29 | 29 |
30 // Allocate heap object. | 30 // Allocate heap object. |
31 Object* CreateInstance(Class* the_class, Object* init_value, bool immutable); | 31 Object* CreateInstance(Class* the_class, Object* init_value, bool immutable); |
| 32 Object* CreateBooleanObject(uword address, Class* the_class, |
| 33 Object* init_value); |
32 | 34 |
33 // Allocate array. | 35 // Allocate array. |
34 Object* CreateArray(Class* the_class, int length, Object* init_value); | 36 Object* CreateArray(Class* the_class, int length, Object* init_value); |
35 | 37 |
36 // Allocate byte array. | 38 // Allocate byte array. |
37 Object* CreateByteArray(Class* the_class, int length); | 39 Object* CreateByteArray(Class* the_class, int length); |
38 | 40 |
39 // Allocate heap integer. | 41 // Allocate heap integer. |
40 Object* CreateLargeInteger(Class* the_class, int64 value); | 42 Object* CreateLargeInteger(Class* the_class, int64 value); |
41 | 43 |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 // | 351 // |
350 // [object] must be either a Smi or a LargeInteger. | 352 // [object] must be either a Smi or a LargeInteger. |
351 inline int64 AsForeignInt64(Object* object) { | 353 inline int64 AsForeignInt64(Object* object) { |
352 return object->IsSmi() ? Smi::cast(object)->value() | 354 return object->IsSmi() ? Smi::cast(object)->value() |
353 : LargeInteger::cast(object)->value(); | 355 : LargeInteger::cast(object)->value(); |
354 } | 356 } |
355 | 357 |
356 } // namespace dartino | 358 } // namespace dartino |
357 | 359 |
358 #endif // SRC_VM_HEAP_H_ | 360 #endif // SRC_VM_HEAP_H_ |
OLD | NEW |