Index: src/heap.cc |
diff --git a/src/heap.cc b/src/heap.cc |
index b9f7dc32a0d6cd93eb9329300ce5725c9bb6dd3d..ea3cef8c4a5983bea9166278c82662cf95cfd724 100644 |
--- a/src/heap.cc |
+++ b/src/heap.cc |
@@ -2778,136 +2778,291 @@ bool Heap::CreateInitialMaps() { |
constant_pool_array_map()->set_prototype(null_value()); |
constant_pool_array_map()->set_constructor(null_value()); |
- { // Map allocation |
-#define ALLOCATE_MAP(instance_type, size, field_name) \ |
- { Map* map; \ |
- if (!AllocateMap((instance_type), size)->To(&map)) return false; \ |
- set_##field_name##_map(map); \ |
- } |
+ { MaybeObject* maybe_obj = |
+ AllocateMap(FIXED_ARRAY_TYPE, kVariableSizeSentinel); |
+ if (!maybe_obj->ToObject(&obj)) return false; |
+ } |
+ set_fixed_cow_array_map(Map::cast(obj)); |
+ ASSERT(fixed_array_map() != fixed_cow_array_map()); |
-#define ALLOCATE_VARSIZE_MAP(instance_type, field_name) \ |
- ALLOCATE_MAP(instance_type, kVariableSizeSentinel, field_name) |
+ { MaybeObject* maybe_obj = |
+ AllocateMap(FIXED_ARRAY_TYPE, kVariableSizeSentinel); |
+ if (!maybe_obj->ToObject(&obj)) return false; |
+ } |
+ set_scope_info_map(Map::cast(obj)); |
- ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, fixed_cow_array) |
- ASSERT(fixed_array_map() != fixed_cow_array_map()); |
+ { MaybeObject* maybe_obj = AllocateMap(HEAP_NUMBER_TYPE, HeapNumber::kSize); |
+ if (!maybe_obj->ToObject(&obj)) return false; |
+ } |
+ set_heap_number_map(Map::cast(obj)); |
- ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, scope_info) |
- ALLOCATE_MAP(HEAP_NUMBER_TYPE, HeapNumber::kSize, heap_number) |
- ALLOCATE_MAP(SYMBOL_TYPE, Symbol::kSize, symbol) |
- ALLOCATE_MAP(FOREIGN_TYPE, Foreign::kSize, foreign) |
+ { MaybeObject* maybe_obj = AllocateMap(SYMBOL_TYPE, Symbol::kSize); |
+ if (!maybe_obj->ToObject(&obj)) return false; |
+ } |
+ set_symbol_map(Map::cast(obj)); |
- for (unsigned i = 0; i < ARRAY_SIZE(string_type_table); i++) { |
- const StringTypeTable& entry = string_type_table[i]; |
- { MaybeObject* maybe_obj = AllocateMap(entry.type, entry.size); |
- if (!maybe_obj->ToObject(&obj)) return false; |
- } |
- roots_[entry.index] = Map::cast(obj); |
- } |
+ { MaybeObject* maybe_obj = AllocateMap(FOREIGN_TYPE, Foreign::kSize); |
+ if (!maybe_obj->ToObject(&obj)) return false; |
+ } |
+ set_foreign_map(Map::cast(obj)); |
- ALLOCATE_VARSIZE_MAP(STRING_TYPE, undetectable_string) |
- undetectable_string_map()->set_is_undetectable(); |
- |
- ALLOCATE_VARSIZE_MAP(ASCII_STRING_TYPE, undetectable_ascii_string); |
- undetectable_ascii_string_map()->set_is_undetectable(); |
- |
- ALLOCATE_VARSIZE_MAP(FIXED_DOUBLE_ARRAY_TYPE, fixed_double_array) |
- ALLOCATE_VARSIZE_MAP(BYTE_ARRAY_TYPE, byte_array) |
- ALLOCATE_VARSIZE_MAP(FREE_SPACE_TYPE, free_space) |
- |
-#define ALLOCATE_EXTERNAL_ARRAY_MAP(TYPE, type) \ |
- ALLOCATE_MAP(EXTERNAL_##TYPE##_ARRAY_TYPE, ExternalArray::kAlignedSize, \ |
- external_##type##_array) |
- |
- ALLOCATE_EXTERNAL_ARRAY_MAP(PIXEL, pixel) |
- ALLOCATE_EXTERNAL_ARRAY_MAP(BYTE, byte) |
- ALLOCATE_EXTERNAL_ARRAY_MAP(UNSIGNED_BYTE, unsigned_byte) |
- ALLOCATE_EXTERNAL_ARRAY_MAP(SHORT, short) // NOLINT |
- ALLOCATE_EXTERNAL_ARRAY_MAP(UNSIGNED_SHORT, unsigned_short) |
- ALLOCATE_EXTERNAL_ARRAY_MAP(INT, int) |
- ALLOCATE_EXTERNAL_ARRAY_MAP(UNSIGNED_INT, unsigned_int) |
- ALLOCATE_EXTERNAL_ARRAY_MAP(FLOAT, float) |
- ALLOCATE_EXTERNAL_ARRAY_MAP(DOUBLE, double) |
-#undef ALLOCATE_EXTERNAL_ARRAY_MAP |
- |
- ALLOCATE_VARSIZE_MAP(FIXED_UINT8_ARRAY_TYPE, fixed_uint8_array) |
- ALLOCATE_VARSIZE_MAP(FIXED_UINT8_CLAMPED_ARRAY_TYPE, |
- fixed_uint8_clamped_array) |
- ALLOCATE_VARSIZE_MAP(FIXED_INT8_ARRAY_TYPE, fixed_int8_array) |
- ALLOCATE_VARSIZE_MAP(FIXED_UINT16_ARRAY_TYPE, fixed_uint16_array) |
- ALLOCATE_VARSIZE_MAP(FIXED_INT16_ARRAY_TYPE, fixed_int16_array) |
- ALLOCATE_VARSIZE_MAP(FIXED_UINT32_ARRAY_TYPE, fixed_uint32_array) |
- ALLOCATE_VARSIZE_MAP(FIXED_INT32_ARRAY_TYPE, fixed_int32_array) |
- ALLOCATE_VARSIZE_MAP(FIXED_FLOAT32_ARRAY_TYPE, fixed_float32_array) |
- ALLOCATE_VARSIZE_MAP(FIXED_FLOAT64_ARRAY_TYPE, fixed_float64_array) |
- |
- ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, non_strict_arguments_elements) |
- |
- ALLOCATE_VARSIZE_MAP(CODE_TYPE, code) |
- |
- ALLOCATE_MAP(CELL_TYPE, Cell::kSize, cell) |
- ALLOCATE_MAP(PROPERTY_CELL_TYPE, PropertyCell::kSize, global_property_cell) |
- ALLOCATE_MAP(FILLER_TYPE, kPointerSize, one_pointer_filler) |
- ALLOCATE_MAP(FILLER_TYPE, 2 * kPointerSize, two_pointer_filler) |
- |
- |
- for (unsigned i = 0; i < ARRAY_SIZE(struct_table); i++) { |
- const StructTable& entry = struct_table[i]; |
- Map* map; |
- if (!AllocateMap(entry.type, entry.size)->To(&map)) |
- return false; |
- roots_[entry.index] = map; |
+ for (unsigned i = 0; i < ARRAY_SIZE(string_type_table); i++) { |
+ const StringTypeTable& entry = string_type_table[i]; |
+ { MaybeObject* maybe_obj = AllocateMap(entry.type, entry.size); |
+ if (!maybe_obj->ToObject(&obj)) return false; |
} |
+ roots_[entry.index] = Map::cast(obj); |
+ } |
- ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, hash_table) |
+ { MaybeObject* maybe_obj = AllocateMap(STRING_TYPE, kVariableSizeSentinel); |
+ if (!maybe_obj->ToObject(&obj)) return false; |
+ } |
+ set_undetectable_string_map(Map::cast(obj)); |
+ Map::cast(obj)->set_is_undetectable(); |
- ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, function_context) |
- ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, catch_context) |
- ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, with_context) |
- ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, block_context) |
- ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, module_context) |
- ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, global_context) |
+ { MaybeObject* maybe_obj = |
+ AllocateMap(ASCII_STRING_TYPE, kVariableSizeSentinel); |
+ if (!maybe_obj->ToObject(&obj)) return false; |
+ } |
+ set_undetectable_ascii_string_map(Map::cast(obj)); |
+ Map::cast(obj)->set_is_undetectable(); |
- ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, native_context) |
- native_context_map()->set_dictionary_map(true); |
- native_context_map()->set_visitor_id( |
- StaticVisitorBase::kVisitNativeContext); |
+ { MaybeObject* maybe_obj = |
+ AllocateMap(FIXED_DOUBLE_ARRAY_TYPE, kVariableSizeSentinel); |
+ if (!maybe_obj->ToObject(&obj)) return false; |
+ } |
+ set_fixed_double_array_map(Map::cast(obj)); |
- ALLOCATE_MAP(SHARED_FUNCTION_INFO_TYPE, SharedFunctionInfo::kAlignedSize, |
- shared_function_info) |
+ { MaybeObject* maybe_obj = |
+ AllocateMap(BYTE_ARRAY_TYPE, kVariableSizeSentinel); |
+ if (!maybe_obj->ToObject(&obj)) return false; |
+ } |
+ set_byte_array_map(Map::cast(obj)); |
- ALLOCATE_MAP(JS_MESSAGE_OBJECT_TYPE, JSMessageObject::kSize, |
- message_object) |
- ALLOCATE_MAP(JS_OBJECT_TYPE, JSObject::kHeaderSize + kPointerSize, |
- external) |
- external_map()->set_is_extensible(false); |
-#undef ALLOCATE_VARSIZE_MAP |
-#undef ALLOCATE_MAP |
+ { MaybeObject* maybe_obj = |
+ AllocateMap(FREE_SPACE_TYPE, kVariableSizeSentinel); |
+ if (!maybe_obj->ToObject(&obj)) return false; |
} |
+ set_free_space_map(Map::cast(obj)); |
- { // Empty arrays |
- { ByteArray* byte_array; |
- if (!AllocateByteArray(0, TENURED)->To(&byte_array)) return false; |
- set_empty_byte_array(byte_array); |
- } |
+ { MaybeObject* maybe_obj = AllocateByteArray(0, TENURED); |
+ if (!maybe_obj->ToObject(&obj)) return false; |
+ } |
+ set_empty_byte_array(ByteArray::cast(obj)); |
+ |
+ { MaybeObject* maybe_obj = |
+ AllocateMap(EXTERNAL_PIXEL_ARRAY_TYPE, ExternalArray::kAlignedSize); |
+ if (!maybe_obj->ToObject(&obj)) return false; |
+ } |
+ set_external_pixel_array_map(Map::cast(obj)); |
+ |
+ { MaybeObject* maybe_obj = AllocateMap(EXTERNAL_BYTE_ARRAY_TYPE, |
+ ExternalArray::kAlignedSize); |
+ if (!maybe_obj->ToObject(&obj)) return false; |
+ } |
+ set_external_byte_array_map(Map::cast(obj)); |
+ |
+ { MaybeObject* maybe_obj = AllocateMap(EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE, |
+ ExternalArray::kAlignedSize); |
+ if (!maybe_obj->ToObject(&obj)) return false; |
+ } |
+ set_external_unsigned_byte_array_map(Map::cast(obj)); |
+ |
+ { MaybeObject* maybe_obj = AllocateMap(EXTERNAL_SHORT_ARRAY_TYPE, |
+ ExternalArray::kAlignedSize); |
+ if (!maybe_obj->ToObject(&obj)) return false; |
+ } |
+ set_external_short_array_map(Map::cast(obj)); |
+ |
+ { MaybeObject* maybe_obj = AllocateMap(EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE, |
+ ExternalArray::kAlignedSize); |
+ if (!maybe_obj->ToObject(&obj)) return false; |
+ } |
+ set_external_unsigned_short_array_map(Map::cast(obj)); |
+ |
+ { MaybeObject* maybe_obj = AllocateMap(EXTERNAL_INT_ARRAY_TYPE, |
+ ExternalArray::kAlignedSize); |
+ if (!maybe_obj->ToObject(&obj)) return false; |
+ } |
+ set_external_int_array_map(Map::cast(obj)); |
+ |
+ { MaybeObject* maybe_obj = AllocateMap(EXTERNAL_UNSIGNED_INT_ARRAY_TYPE, |
+ ExternalArray::kAlignedSize); |
+ if (!maybe_obj->ToObject(&obj)) return false; |
+ } |
+ set_external_unsigned_int_array_map(Map::cast(obj)); |
+ |
+ { MaybeObject* maybe_obj = AllocateMap(EXTERNAL_FLOAT_ARRAY_TYPE, |
+ ExternalArray::kAlignedSize); |
+ if (!maybe_obj->ToObject(&obj)) return false; |
+ } |
+ set_external_float_array_map(Map::cast(obj)); |
+ |
+ { MaybeObject* maybe_obj = |
+ AllocateMap(FIXED_ARRAY_TYPE, kVariableSizeSentinel); |
+ if (!maybe_obj->ToObject(&obj)) return false; |
+ } |
+ set_non_strict_arguments_elements_map(Map::cast(obj)); |
+ |
+ { MaybeObject* maybe_obj = AllocateMap(EXTERNAL_DOUBLE_ARRAY_TYPE, |
+ ExternalArray::kAlignedSize); |
+ if (!maybe_obj->ToObject(&obj)) return false; |
+ } |
+ set_external_double_array_map(Map::cast(obj)); |
+ |
+ { MaybeObject* maybe_obj = AllocateEmptyExternalArray(kExternalByteArray); |
+ if (!maybe_obj->ToObject(&obj)) return false; |
+ } |
+ set_empty_external_byte_array(ExternalArray::cast(obj)); |
+ |
+ { MaybeObject* maybe_obj = |
+ AllocateEmptyExternalArray(kExternalUnsignedByteArray); |
+ if (!maybe_obj->ToObject(&obj)) return false; |
+ } |
+ set_empty_external_unsigned_byte_array(ExternalArray::cast(obj)); |
+ |
+ { MaybeObject* maybe_obj = AllocateEmptyExternalArray(kExternalShortArray); |
+ if (!maybe_obj->ToObject(&obj)) return false; |
+ } |
+ set_empty_external_short_array(ExternalArray::cast(obj)); |
+ |
+ { MaybeObject* maybe_obj = AllocateEmptyExternalArray( |
+ kExternalUnsignedShortArray); |
+ if (!maybe_obj->ToObject(&obj)) return false; |
+ } |
+ set_empty_external_unsigned_short_array(ExternalArray::cast(obj)); |
+ |
+ { MaybeObject* maybe_obj = AllocateEmptyExternalArray(kExternalIntArray); |
+ if (!maybe_obj->ToObject(&obj)) return false; |
+ } |
+ set_empty_external_int_array(ExternalArray::cast(obj)); |
+ |
+ { MaybeObject* maybe_obj = |
+ AllocateEmptyExternalArray(kExternalUnsignedIntArray); |
+ if (!maybe_obj->ToObject(&obj)) return false; |
+ } |
+ set_empty_external_unsigned_int_array(ExternalArray::cast(obj)); |
+ |
+ { MaybeObject* maybe_obj = AllocateEmptyExternalArray(kExternalFloatArray); |
+ if (!maybe_obj->ToObject(&obj)) return false; |
+ } |
+ set_empty_external_float_array(ExternalArray::cast(obj)); |
+ |
+ { MaybeObject* maybe_obj = AllocateEmptyExternalArray(kExternalDoubleArray); |
+ if (!maybe_obj->ToObject(&obj)) return false; |
+ } |
+ set_empty_external_double_array(ExternalArray::cast(obj)); |
+ |
+ { MaybeObject* maybe_obj = AllocateEmptyExternalArray(kExternalPixelArray); |
+ if (!maybe_obj->ToObject(&obj)) return false; |
+ } |
+ set_empty_external_pixel_array(ExternalArray::cast(obj)); |
+ |
+ { MaybeObject* maybe_obj = AllocateMap(CODE_TYPE, kVariableSizeSentinel); |
+ if (!maybe_obj->ToObject(&obj)) return false; |
+ } |
+ set_code_map(Map::cast(obj)); |
+ |
+ { MaybeObject* maybe_obj = AllocateMap(CELL_TYPE, Cell::kSize); |
+ if (!maybe_obj->ToObject(&obj)) return false; |
+ } |
+ set_cell_map(Map::cast(obj)); |
+ |
+ { MaybeObject* maybe_obj = AllocateMap(PROPERTY_CELL_TYPE, |
+ PropertyCell::kSize); |
+ if (!maybe_obj->ToObject(&obj)) return false; |
+ } |
+ set_global_property_cell_map(Map::cast(obj)); |
+ |
+ { MaybeObject* maybe_obj = AllocateMap(FILLER_TYPE, kPointerSize); |
+ if (!maybe_obj->ToObject(&obj)) return false; |
+ } |
+ set_one_pointer_filler_map(Map::cast(obj)); |
-#define ALLOCATE_EMPTY_EXTERNAL_ARRAY(Type, type) \ |
- { ExternalArray* obj; \ |
- if (!AllocateEmptyExternalArray(kExternal##Type##Array)->To(&obj)) \ |
- return false; \ |
- set_empty_external_##type##_array(obj); \ |
+ { MaybeObject* maybe_obj = AllocateMap(FILLER_TYPE, 2 * kPointerSize); |
+ if (!maybe_obj->ToObject(&obj)) return false; |
+ } |
+ set_two_pointer_filler_map(Map::cast(obj)); |
+ |
+ for (unsigned i = 0; i < ARRAY_SIZE(struct_table); i++) { |
+ const StructTable& entry = struct_table[i]; |
+ { MaybeObject* maybe_obj = AllocateMap(entry.type, entry.size); |
+ if (!maybe_obj->ToObject(&obj)) return false; |
} |
+ roots_[entry.index] = Map::cast(obj); |
+ } |
+ |
+ { MaybeObject* maybe_obj = |
+ AllocateMap(FIXED_ARRAY_TYPE, kVariableSizeSentinel); |
+ if (!maybe_obj->ToObject(&obj)) return false; |
+ } |
+ set_hash_table_map(Map::cast(obj)); |
- ALLOCATE_EMPTY_EXTERNAL_ARRAY(Byte, byte) |
- ALLOCATE_EMPTY_EXTERNAL_ARRAY(UnsignedByte, unsigned_byte) |
- ALLOCATE_EMPTY_EXTERNAL_ARRAY(Short, short) // NOLINT |
- ALLOCATE_EMPTY_EXTERNAL_ARRAY(UnsignedShort, unsigned_short) |
- ALLOCATE_EMPTY_EXTERNAL_ARRAY(Int, int) |
- ALLOCATE_EMPTY_EXTERNAL_ARRAY(UnsignedInt, unsigned_int) |
- ALLOCATE_EMPTY_EXTERNAL_ARRAY(Float, float) |
- ALLOCATE_EMPTY_EXTERNAL_ARRAY(Double, double) |
- ALLOCATE_EMPTY_EXTERNAL_ARRAY(Pixel, pixel) |
-#undef ALLOCATE_EMPTY_EXTERNAL_ARRAY |
+ { MaybeObject* maybe_obj = |
+ AllocateMap(FIXED_ARRAY_TYPE, kVariableSizeSentinel); |
+ if (!maybe_obj->ToObject(&obj)) return false; |
+ } |
+ set_function_context_map(Map::cast(obj)); |
+ |
+ { MaybeObject* maybe_obj = |
+ AllocateMap(FIXED_ARRAY_TYPE, kVariableSizeSentinel); |
+ if (!maybe_obj->ToObject(&obj)) return false; |
+ } |
+ set_catch_context_map(Map::cast(obj)); |
+ |
+ { MaybeObject* maybe_obj = |
+ AllocateMap(FIXED_ARRAY_TYPE, kVariableSizeSentinel); |
+ if (!maybe_obj->ToObject(&obj)) return false; |
+ } |
+ set_with_context_map(Map::cast(obj)); |
+ |
+ { MaybeObject* maybe_obj = |
+ AllocateMap(FIXED_ARRAY_TYPE, kVariableSizeSentinel); |
+ if (!maybe_obj->ToObject(&obj)) return false; |
+ } |
+ set_block_context_map(Map::cast(obj)); |
+ |
+ { MaybeObject* maybe_obj = |
+ AllocateMap(FIXED_ARRAY_TYPE, kVariableSizeSentinel); |
+ if (!maybe_obj->ToObject(&obj)) return false; |
} |
+ set_module_context_map(Map::cast(obj)); |
+ |
+ { MaybeObject* maybe_obj = |
+ AllocateMap(FIXED_ARRAY_TYPE, kVariableSizeSentinel); |
+ if (!maybe_obj->ToObject(&obj)) return false; |
+ } |
+ set_global_context_map(Map::cast(obj)); |
+ |
+ { MaybeObject* maybe_obj = |
+ AllocateMap(FIXED_ARRAY_TYPE, kVariableSizeSentinel); |
+ if (!maybe_obj->ToObject(&obj)) return false; |
+ } |
+ Map* native_context_map = Map::cast(obj); |
+ native_context_map->set_dictionary_map(true); |
+ native_context_map->set_visitor_id(StaticVisitorBase::kVisitNativeContext); |
+ set_native_context_map(native_context_map); |
+ |
+ { MaybeObject* maybe_obj = AllocateMap(SHARED_FUNCTION_INFO_TYPE, |
+ SharedFunctionInfo::kAlignedSize); |
+ if (!maybe_obj->ToObject(&obj)) return false; |
+ } |
+ set_shared_function_info_map(Map::cast(obj)); |
+ |
+ { MaybeObject* maybe_obj = AllocateMap(JS_MESSAGE_OBJECT_TYPE, |
+ JSMessageObject::kSize); |
+ if (!maybe_obj->ToObject(&obj)) return false; |
+ } |
+ set_message_object_map(Map::cast(obj)); |
+ |
+ Map* external_map; |
+ { MaybeObject* maybe_obj = |
+ AllocateMap(JS_OBJECT_TYPE, JSObject::kHeaderSize + kPointerSize); |
+ if (!maybe_obj->To(&external_map)) return false; |
+ } |
+ external_map->set_is_extensible(false); |
+ set_external_map(external_map); |
+ |
ASSERT(!InNewSpace(empty_fixed_array())); |
return true; |
} |
@@ -3616,39 +3771,6 @@ Heap::RootListIndex Heap::RootIndexForExternalArrayType( |
} |
-Map* Heap::MapForFixedTypedArray(ExternalArrayType array_type) { |
- return Map::cast(roots_[RootIndexForFixedTypedArray(array_type)]); |
-} |
- |
- |
-Heap::RootListIndex Heap::RootIndexForFixedTypedArray( |
- ExternalArrayType array_type) { |
- switch (array_type) { |
- case kExternalByteArray: |
- return kFixedInt8ArrayMapRootIndex; |
- case kExternalUnsignedByteArray: |
- return kFixedUint8ArrayMapRootIndex; |
- case kExternalShortArray: |
- return kFixedInt16ArrayMapRootIndex; |
- case kExternalUnsignedShortArray: |
- return kFixedUint16ArrayMapRootIndex; |
- case kExternalIntArray: |
- return kFixedInt32ArrayMapRootIndex; |
- case kExternalUnsignedIntArray: |
- return kFixedUint32ArrayMapRootIndex; |
- case kExternalFloatArray: |
- return kFixedFloat32ArrayMapRootIndex; |
- case kExternalDoubleArray: |
- return kFixedFloat64ArrayMapRootIndex; |
- case kExternalPixelArray: |
- return kFixedUint8ClampedArrayMapRootIndex; |
- default: |
- UNREACHABLE(); |
- return kUndefinedValueRootIndex; |
- } |
-} |
- |
- |
Heap::RootListIndex Heap::RootIndexForEmptyExternalArray( |
ElementsKind elementsKind) { |
switch (elementsKind) { |
@@ -3907,84 +4029,6 @@ MaybeObject* Heap::AllocateExternalArray(int length, |
return result; |
} |
-static void ForFixedTypedArray(ExternalArrayType array_type, |
- int* element_size, |
- ElementsKind* element_kind) { |
- switch (array_type) { |
- case kExternalUnsignedByteArray: |
- *element_size = 1; |
- *element_kind = UINT8_ELEMENTS; |
- return; |
- case kExternalByteArray: |
- *element_size = 1; |
- *element_kind = INT8_ELEMENTS; |
- return; |
- case kExternalUnsignedShortArray: |
- *element_size = 2; |
- *element_kind = UINT16_ELEMENTS; |
- return; |
- case kExternalShortArray: |
- *element_size = 2; |
- *element_kind = INT16_ELEMENTS; |
- return; |
- case kExternalUnsignedIntArray: |
- *element_size = 4; |
- *element_kind = UINT32_ELEMENTS; |
- return; |
- case kExternalIntArray: |
- *element_size = 4; |
- *element_kind = INT32_ELEMENTS; |
- return; |
- case kExternalFloatArray: |
- *element_size = 4; |
- *element_kind = FLOAT32_ELEMENTS; |
- return; |
- case kExternalDoubleArray: |
- *element_size = 8; |
- *element_kind = FLOAT64_ELEMENTS; |
- return; |
- case kExternalPixelArray: |
- *element_size = 1; |
- *element_kind = UINT8_CLAMPED_ELEMENTS; |
- return; |
- default: |
- *element_size = 0; // Bogus |
- *element_kind = UINT8_ELEMENTS; // Bogus |
- UNREACHABLE(); |
- } |
-} |
- |
- |
-MaybeObject* Heap::AllocateFixedTypedArray(int length, |
- ExternalArrayType array_type, |
- PretenureFlag pretenure) { |
- int element_size; |
- ElementsKind elements_kind; |
- ForFixedTypedArray(array_type, &element_size, &elements_kind); |
- int size = OBJECT_POINTER_ALIGN( |
- length * element_size + FixedTypedArrayBase::kDataOffset); |
-#ifndef V8_HOST_ARCH_64_BIT |
- if (array_type == kExternalDoubleArray) { |
- size += kPointerSize; |
- } |
-#endif |
- AllocationSpace space = SelectSpace(size, OLD_DATA_SPACE, pretenure); |
- |
- HeapObject* object; |
- MaybeObject* maybe_object = AllocateRaw(size, space, OLD_DATA_SPACE); |
- if (!maybe_object->To(&object)) return maybe_object; |
- |
- if (array_type == kExternalDoubleArray) { |
- object = EnsureDoubleAligned(this, object, size); |
- } |
- |
- FixedTypedArrayBase* elements = |
- reinterpret_cast<FixedTypedArrayBase*>(object); |
- elements->set_map(MapForFixedTypedArray(array_type)); |
- elements->set_length(length); |
- return elements; |
-} |
- |
MaybeObject* Heap::CreateCode(const CodeDesc& desc, |
Code::Flags flags, |
@@ -6778,10 +6822,6 @@ void Heap::EnsureWeakObjectToCodeTable() { |
} |
-void Heap::FatalProcessOutOfMemory(const char* location, bool take_snapshot) { |
- v8::internal::V8::FatalProcessOutOfMemory(location, take_snapshot); |
-} |
- |
#ifdef DEBUG |
class PrintHandleVisitor: public ObjectVisitor { |