| Index: src/objects.cc
|
| diff --git a/src/objects.cc b/src/objects.cc
|
| index 92364e3cd7cf00f7f04806cfefba0f984c974eb3..493590dcb52de99e2f5149b56b272bc53d522b6e 100644
|
| --- a/src/objects.cc
|
| +++ b/src/objects.cc
|
| @@ -592,7 +592,7 @@ MaybeObject* Object::GetProperty(Object* receiver,
|
| return holder->GetPropertyWithInterceptor(recvr, name, attributes);
|
| }
|
| case MAP_TRANSITION:
|
| - case EXTERNAL_ARRAY_TRANSITION:
|
| + case ELEMENTS_TRANSITION:
|
| case CONSTANT_TRANSITION:
|
| case NULL_DESCRIPTOR:
|
| break;
|
| @@ -1440,9 +1440,9 @@ MaybeObject* JSObject::AddFastProperty(String* name,
|
| // which is not a identifier and should have forced a switch to slow
|
| // properties above.
|
| ASSERT(descriptor_index == DescriptorArray::kNotFound ||
|
| - old_descriptors->GetType(descriptor_index) != EXTERNAL_ARRAY_TRANSITION);
|
| + old_descriptors->GetType(descriptor_index) != ELEMENTS_TRANSITION);
|
| bool can_insert_transition = descriptor_index == DescriptorArray::kNotFound ||
|
| - old_descriptors->GetType(descriptor_index) == EXTERNAL_ARRAY_TRANSITION;
|
| + old_descriptors->GetType(descriptor_index) == ELEMENTS_TRANSITION;
|
| bool allow_map_transition =
|
| can_insert_transition &&
|
| (isolate->context()->global_context()->object_function()->map() != map());
|
| @@ -1990,61 +1990,25 @@ void Map::LookupInDescriptors(JSObject* holder,
|
| }
|
|
|
|
|
| -static ElementsKind GetElementsKindFromExternalArrayType(
|
| - ExternalArrayType array_type) {
|
| - switch (array_type) {
|
| - case kExternalByteArray:
|
| - return EXTERNAL_BYTE_ELEMENTS;
|
| - break;
|
| - case kExternalUnsignedByteArray:
|
| - return EXTERNAL_UNSIGNED_BYTE_ELEMENTS;
|
| - break;
|
| - case kExternalShortArray:
|
| - return EXTERNAL_SHORT_ELEMENTS;
|
| - break;
|
| - case kExternalUnsignedShortArray:
|
| - return EXTERNAL_UNSIGNED_SHORT_ELEMENTS;
|
| - break;
|
| - case kExternalIntArray:
|
| - return EXTERNAL_INT_ELEMENTS;
|
| - break;
|
| - case kExternalUnsignedIntArray:
|
| - return EXTERNAL_UNSIGNED_INT_ELEMENTS;
|
| - break;
|
| - case kExternalFloatArray:
|
| - return EXTERNAL_FLOAT_ELEMENTS;
|
| - break;
|
| - case kExternalDoubleArray:
|
| - return EXTERNAL_DOUBLE_ELEMENTS;
|
| - break;
|
| - case kExternalPixelArray:
|
| - return EXTERNAL_PIXEL_ELEMENTS;
|
| - break;
|
| - }
|
| - UNREACHABLE();
|
| - return DICTIONARY_ELEMENTS;
|
| -}
|
| -
|
| -
|
| -MaybeObject* Map::GetExternalArrayElementsMap(ExternalArrayType array_type,
|
| - bool safe_to_add_transition) {
|
| +MaybeObject* Map::GetElementsTransitionMap(ElementsKind elements_kind,
|
| + bool safe_to_add_transition) {
|
| Heap* current_heap = heap();
|
| DescriptorArray* descriptors = instance_descriptors();
|
| - String* external_array_sentinel_name = current_heap->empty_symbol();
|
| + String* elements_transition_sentinel_name = current_heap->empty_symbol();
|
|
|
| if (safe_to_add_transition) {
|
| // It's only safe to manipulate the descriptor array if it would be
|
| // safe to add a transition.
|
|
|
| ASSERT(!is_shared()); // no transitions can be added to shared maps.
|
| - // Check if the external array transition already exists.
|
| + // Check if the elements transition already exists.
|
| DescriptorLookupCache* cache =
|
| current_heap->isolate()->descriptor_lookup_cache();
|
| - int index = cache->Lookup(descriptors, external_array_sentinel_name);
|
| + int index = cache->Lookup(descriptors, elements_transition_sentinel_name);
|
| if (index == DescriptorLookupCache::kAbsent) {
|
| - index = descriptors->Search(external_array_sentinel_name);
|
| + index = descriptors->Search(elements_transition_sentinel_name);
|
| cache->Update(descriptors,
|
| - external_array_sentinel_name,
|
| + elements_transition_sentinel_name,
|
| index);
|
| }
|
|
|
| @@ -2052,8 +2016,8 @@ MaybeObject* Map::GetExternalArrayElementsMap(ExternalArrayType array_type,
|
| // return it.
|
| if (index != DescriptorArray::kNotFound) {
|
| PropertyDetails details(PropertyDetails(descriptors->GetDetails(index)));
|
| - if (details.type() == EXTERNAL_ARRAY_TRANSITION &&
|
| - details.array_type() == array_type) {
|
| + if (details.type() == ELEMENTS_TRANSITION &&
|
| + details.elements_kind() == elements_kind) {
|
| return descriptors->GetValue(index);
|
| } else {
|
| safe_to_add_transition = false;
|
| @@ -2068,7 +2032,7 @@ MaybeObject* Map::GetExternalArrayElementsMap(ExternalArrayType array_type,
|
| }
|
| Map* new_map = Map::cast(obj);
|
|
|
| - new_map->set_elements_kind(GetElementsKindFromExternalArrayType(array_type));
|
| + new_map->set_elements_kind(elements_kind);
|
| GetIsolate()->counters()->map_to_external_array_elements()->Increment();
|
|
|
| // Only remember the map transition if the object's map is NOT equal to the
|
| @@ -2080,9 +2044,9 @@ MaybeObject* Map::GetExternalArrayElementsMap(ExternalArrayType array_type,
|
| map());
|
| if (allow_map_transition) {
|
| // Allocate new instance descriptors for the old map with map transition.
|
| - ExternalArrayTransitionDescriptor desc(external_array_sentinel_name,
|
| - Map::cast(new_map),
|
| - array_type);
|
| + ElementsTransitionDescriptor desc(elements_transition_sentinel_name,
|
| + Map::cast(new_map),
|
| + elements_kind);
|
| Object* new_descriptors;
|
| MaybeObject* maybe_new_descriptors = descriptors->CopyInsert(
|
| &desc,
|
| @@ -2499,7 +2463,7 @@ MaybeObject* JSObject::SetPropertyForResult(LookupResult* result,
|
| return ConvertDescriptorToFieldAndMapTransition(name, value, attributes);
|
| }
|
| case NULL_DESCRIPTOR:
|
| - case EXTERNAL_ARRAY_TRANSITION:
|
| + case ELEMENTS_TRANSITION:
|
| return ConvertDescriptorToFieldAndMapTransition(name, value, attributes);
|
| default:
|
| UNREACHABLE();
|
| @@ -2587,7 +2551,7 @@ MaybeObject* JSObject::SetLocalPropertyIgnoreAttributes(
|
| // if the value is a function.
|
| return ConvertDescriptorToFieldAndMapTransition(name, value, attributes);
|
| case NULL_DESCRIPTOR:
|
| - case EXTERNAL_ARRAY_TRANSITION:
|
| + case ELEMENTS_TRANSITION:
|
| return ConvertDescriptorToFieldAndMapTransition(name, value, attributes);
|
| default:
|
| UNREACHABLE();
|
| @@ -2868,7 +2832,7 @@ MaybeObject* JSObject::NormalizeProperties(PropertyNormalizationMode mode,
|
| case CONSTANT_TRANSITION:
|
| case NULL_DESCRIPTOR:
|
| case INTERCEPTOR:
|
| - case EXTERNAL_ARRAY_TRANSITION:
|
| + case ELEMENTS_TRANSITION:
|
| break;
|
| default:
|
| UNREACHABLE();
|
| @@ -6202,7 +6166,7 @@ void Map::CreateBackPointers() {
|
| DescriptorArray* descriptors = instance_descriptors();
|
| for (int i = 0; i < descriptors->number_of_descriptors(); i++) {
|
| if (descriptors->GetType(i) == MAP_TRANSITION ||
|
| - descriptors->GetType(i) == EXTERNAL_ARRAY_TRANSITION ||
|
| + descriptors->GetType(i) == ELEMENTS_TRANSITION ||
|
| descriptors->GetType(i) == CONSTANT_TRANSITION) {
|
| // Get target.
|
| Map* target = Map::cast(descriptors->GetValue(i));
|
| @@ -6245,7 +6209,7 @@ void Map::ClearNonLiveTransitions(Heap* heap, Object* real_prototype) {
|
| // non-live object.
|
| PropertyDetails details(Smi::cast(contents->get(i + 1)));
|
| if (details.type() == MAP_TRANSITION ||
|
| - details.type() == EXTERNAL_ARRAY_TRANSITION ||
|
| + details.type() == ELEMENTS_TRANSITION ||
|
| details.type() == CONSTANT_TRANSITION) {
|
| Map* target = reinterpret_cast<Map*>(contents->get(i));
|
| ASSERT(target->IsHeapObject());
|
| @@ -7134,7 +7098,7 @@ const char* Code::PropertyType2String(PropertyType type) {
|
| case HANDLER: return "HANDLER";
|
| case INTERCEPTOR: return "INTERCEPTOR";
|
| case MAP_TRANSITION: return "MAP_TRANSITION";
|
| - case EXTERNAL_ARRAY_TRANSITION: return "EXTERNAL_ARRAY_TRANSITION";
|
| + case ELEMENTS_TRANSITION: return "ELEMENTS_TRANSITION";
|
| case CONSTANT_TRANSITION: return "CONSTANT_TRANSITION";
|
| case NULL_DESCRIPTOR: return "NULL_DESCRIPTOR";
|
| }
|
|
|