// For use during bootup.
void RepairFreeListsAfterBoot();
- // Allocates an internalized string in old space based on the character
- // stream. Returns Failure::RetryAfterGC(requested_bytes, space) if the
- // allocation failed.
- // Please note this function does not perform a garbage collection.
- MUST_USE_RESULT inline MaybeObject* AllocateInternalizedStringFromUtf8(
- Vector<const char> str,
- int chars,
- uint32_t hash_field);
-
- MUST_USE_RESULT inline MaybeObject* AllocateOneByteInternalizedString(
- Vector<const uint8_t> str,
- uint32_t hash_field);
-
- MUST_USE_RESULT inline MaybeObject* AllocateTwoByteInternalizedString(
- Vector<const uc16> str,
- uint32_t hash_field);
-
template<typename T>
static inline bool IsOneByte(T t, int chars);
- template<typename T>
- MUST_USE_RESULT inline MaybeObject* AllocateInternalizedStringImpl(
- T t, int chars, uint32_t hash_field);
-
- // Allocates a fixed array initialized with undefined values
- // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
- // failed.
- // Please note this does not perform a garbage collection.
- MUST_USE_RESULT MaybeObject* AllocateFixedArray(
- int length,
- PretenureFlag pretenure = NOT_TENURED);
-
- // Allocates an uninitialized fixed array. It must be filled by the caller.
- //
- // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
- // failed.
- // Please note this does not perform a garbage collection.
- MUST_USE_RESULT MaybeObject* AllocateUninitializedFixedArray(int length);
-
// Move len elements within a given array from src_index index to dst_index
// index.
void MoveElements(FixedArray* array, int dst_index, int src_index, int len);
- // Make a copy of src and return it. Returns
- // Failure::RetryAfterGC(requested_bytes, space) if the allocation failed.
- MUST_USE_RESULT inline MaybeObject* CopyFixedArray(FixedArray* src);
-
- // Make a copy of src, set the map, and return the copy. Returns
- // Failure::RetryAfterGC(requested_bytes, space) if the allocation failed.
- MUST_USE_RESULT MaybeObject* CopyFixedArrayWithMap(FixedArray* src, Map* map);
-
- // Make a copy of src and return it. Returns
- // Failure::RetryAfterGC(requested_bytes, space) if the allocation failed.
- MUST_USE_RESULT inline MaybeObject* CopyFixedDoubleArray(
- FixedDoubleArray* src);
-
- // Make a copy of src and return it. Returns
- // Failure::RetryAfterGC(requested_bytes, space) if the allocation failed.
- MUST_USE_RESULT inline MaybeObject* CopyConstantPoolArray(
- ConstantPoolArray* src);
-
- // AllocateHashTable is identical to AllocateFixedArray except
- // that the resulting object has hash_table_map as map.
- MUST_USE_RESULT MaybeObject* AllocateHashTable(
- int length, PretenureFlag pretenure = NOT_TENURED);
-
// Sloppy mode arguments object size.
static const int kSloppyArgumentsObjectSize =
JSObject::kHeaderSize + 2 * kPointerSize;
void AdjustLiveBytes(Address address, int by, InvocationMode mode);
bool InternalizeStringIfExists(String* str, String** result);
- bool InternalizeTwoCharsStringIfExists(String* str, String** result);
// Converts the given boolean condition to JavaScript boolean value.
inline Object* ToBoolean(bool condition);
MUST_USE_RESULT MaybeObject* CopyCode(Code* code);
+ // Allocates a fixed array initialized with undefined values
+ MUST_USE_RESULT MaybeObject* AllocateFixedArray(
+ int length,
+ PretenureFlag pretenure = NOT_TENURED);
+
private:
Heap();
bool CreateInitialMaps();
void CreateInitialObjects();
+ // Allocates an internalized string in old space based on the character
+ // stream.
+ MUST_USE_RESULT inline MaybeObject* AllocateInternalizedStringFromUtf8(
+ Vector<const char> str,
+ int chars,
+ uint32_t hash_field);
+
+ MUST_USE_RESULT inline MaybeObject* AllocateOneByteInternalizedString(
+ Vector<const uint8_t> str,
+ uint32_t hash_field);
+
+ MUST_USE_RESULT inline MaybeObject* AllocateTwoByteInternalizedString(
+ Vector<const uc16> str,
+ uint32_t hash_field);
+
template<bool is_one_byte, typename T>
MUST_USE_RESULT MaybeObject* AllocateInternalizedStringImpl(
T t, int chars, uint32_t hash_field);
+ template<typename T>
+ MUST_USE_RESULT inline MaybeObject* AllocateInternalizedStringImpl(
+ T t, int chars, uint32_t hash_field);
+
+ // Allocates an uninitialized fixed array. It must be filled by the caller.
+ MUST_USE_RESULT MaybeObject* AllocateUninitializedFixedArray(int length);
+
+ // Make a copy of src and return it. Returns
+ // Failure::RetryAfterGC(requested_bytes, space) if the allocation failed.
+ MUST_USE_RESULT inline MaybeObject* CopyFixedArray(FixedArray* src);
+
+ // Make a copy of src, set the map, and return the copy. Returns
+ // Failure::RetryAfterGC(requested_bytes, space) if the allocation failed.
+ MUST_USE_RESULT MaybeObject* CopyFixedArrayWithMap(FixedArray* src, Map* map);
+
+ // Make a copy of src and return it. Returns
+ // Failure::RetryAfterGC(requested_bytes, space) if the allocation failed.
+ MUST_USE_RESULT inline MaybeObject* CopyFixedDoubleArray(
+ FixedDoubleArray* src);
+
+ // Make a copy of src and return it. Returns
+ // Failure::RetryAfterGC(requested_bytes, space) if the allocation failed.
+ MUST_USE_RESULT inline MaybeObject* CopyConstantPoolArray(
+ ConstantPoolArray* src);
+
+
// Computes a single character string where the character has code.
// A cache is used for ASCII codes.
MUST_USE_RESULT MaybeObject* LookupSingleCharacterStringFromCode(
TEST(Promotion) {
CcTest::InitializeVM();
- Heap* heap = CcTest::heap();
+ TestHeap* heap = CcTest::test_heap();
heap->ConfigureHeap(2*256*KB, 1*MB, 1*MB, 0);
v8::HandleScope sc(CcTest::isolate());
TEST(NoPromotion) {
CcTest::InitializeVM();
- Heap* heap = CcTest::heap();
+ TestHeap* heap = CcTest::test_heap();
heap->ConfigureHeap(2*256*KB, 1*MB, 1*MB, 0);
v8::HandleScope sc(CcTest::isolate());
FLAG_incremental_marking = false;
CcTest::InitializeVM();
GlobalHandles* global_handles = CcTest::i_isolate()->global_handles();
- Heap* heap = CcTest::heap();
+ TestHeap* heap = CcTest::test_heap();
NumberOfWeakCalls = 0;
v8::HandleScope handle_scope(CcTest::isolate());
v8::HandleScope handle_scope(CcTest::isolate());
Handle<Object> object = global_handles->Create(
- CcTest::heap()->AllocateFixedArray(1)->ToObjectChecked());
+ CcTest::test_heap()->AllocateFixedArray(1)->ToObjectChecked());
TestRetainedObjectInfo info;
global_handles->AddObjectGroup(NULL, 0, &info);