| Index: src/objects.cc
|
| diff --git a/src/objects.cc b/src/objects.cc
|
| index c77a432ba83ebed071904eddda8a78e072fd2044..93e1f5a022f000e817a483296b7607ea56636a7c 100644
|
| --- a/src/objects.cc
|
| +++ b/src/objects.cc
|
| @@ -591,7 +591,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;
|
| @@ -1435,13 +1435,12 @@ MaybeObject* JSObject::AddFastProperty(String* name,
|
| // it's unrelated to properties.
|
| int descriptor_index = old_descriptors->Search(name);
|
|
|
| - // External array transitions are stored in the descriptor for property "",
|
| - // which is not a identifier and should have forced a switch to slow
|
| - // properties above.
|
| + // Element transitions are stored in the descriptor for property "", 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());
|
| @@ -1989,61 +1988,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);
|
| }
|
|
|
| @@ -2051,8 +2014,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;
|
| @@ -2060,28 +2023,29 @@ MaybeObject* Map::GetExternalArrayElementsMap(ExternalArrayType array_type,
|
| }
|
| }
|
|
|
| - // No transition to an existing external array map. Make a new one.
|
| + // No transition to an existing map for the given ElementsKind. Make a new
|
| + // one.
|
| Object* obj;
|
| { MaybeObject* maybe_map = CopyDropTransitions();
|
| if (!maybe_map->ToObject(&obj)) return maybe_map;
|
| }
|
| 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
|
| // global object_function's map and there is not an already existing
|
| - // non-matching external array transition.
|
| + // non-matching element transition.
|
| bool allow_map_transition =
|
| safe_to_add_transition &&
|
| (GetIsolate()->context()->global_context()->object_function()->map() !=
|
| 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,
|
| @@ -2498,7 +2462,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();
|
| @@ -2586,7 +2550,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();
|
| @@ -2867,7 +2831,7 @@ MaybeObject* JSObject::NormalizeProperties(PropertyNormalizationMode mode,
|
| case CONSTANT_TRANSITION:
|
| case NULL_DESCRIPTOR:
|
| case INTERCEPTOR:
|
| - case EXTERNAL_ARRAY_TRANSITION:
|
| + case ELEMENTS_TRANSITION:
|
| break;
|
| default:
|
| UNREACHABLE();
|
| @@ -6212,7 +6176,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));
|
| @@ -6255,7 +6219,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());
|
| @@ -7144,7 +7108,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";
|
| }
|
|
|