@@ -650,11 +650,14 @@ class ArrayConcatVisitor {
650650 index_offset_(0u ),
651651 bit_field_(FastElementsField::encode(fast_elements) |
652652 ExceedsLimitField::encode(false ) |
653- IsFixedArrayField::encode(storage->IsFixedArray ()) |
653+ IsFixedArrayField::encode(storage->IsFixedArray (isolate )) |
654654 HasSimpleElementsField::encode(
655- storage->IsFixedArray () ||
656- !storage->map().IsCustomElementsReceiverMap())) {
657- DCHECK (!(this ->fast_elements () && !is_fixed_array ()));
655+ storage->IsFixedArray (isolate) ||
656+ // Don't take fast path for storages that might have
657+ // side effects when storing to them.
658+ (!storage->map (isolate).IsCustomElementsReceiverMap() &&
659+ !storage->IsJSTypedArray(isolate)))) {
660+ DCHECK_IMPLIES (this ->fast_elements (), is_fixed_array ());
658661 }
659662
660663 ~ArrayConcatVisitor () { clear_storage (); }
@@ -1065,8 +1068,8 @@ bool IterateElements(Isolate* isolate, Handle<JSReceiver> receiver,
10651068 return IterateElementsSlow (isolate, receiver, length, visitor);
10661069 }
10671070
1068- if (!HasOnlySimpleElements (isolate, *receiver ) ||
1069- !visitor-> has_simple_elements ( )) {
1071+ if (!visitor-> has_simple_elements ( ) ||
1072+ !HasOnlySimpleElements (isolate, *receiver )) {
10701073 return IterateElementsSlow (isolate, receiver, length, visitor);
10711074 }
10721075 Handle<JSObject> array = Handle<JSObject>::cast (receiver);
@@ -1082,6 +1085,9 @@ bool IterateElements(Isolate* isolate, Handle<JSReceiver> receiver,
10821085 case HOLEY_SEALED_ELEMENTS:
10831086 case HOLEY_NONEXTENSIBLE_ELEMENTS:
10841087 case HOLEY_ELEMENTS: {
1088+ // Disallow execution so the cached elements won't change mid execution.
1089+ DisallowJavascriptExecution no_js (isolate);
1090+
10851091 // Run through the elements FixedArray and use HasElement and GetElement
10861092 // to check the prototype for missing elements.
10871093 Handle<FixedArray> elements (FixedArray::cast (array->elements ()), isolate);
@@ -1108,6 +1114,9 @@ bool IterateElements(Isolate* isolate, Handle<JSReceiver> receiver,
11081114 }
11091115 case HOLEY_DOUBLE_ELEMENTS:
11101116 case PACKED_DOUBLE_ELEMENTS: {
1117+ // Disallow execution so the cached elements won't change mid execution.
1118+ DisallowJavascriptExecution no_js (isolate);
1119+
11111120 // Empty array is FixedArray but not FixedDoubleArray.
11121121 if (length == 0 ) break ;
11131122 // Run through the elements FixedArray and use HasElement and GetElement
@@ -1144,6 +1153,9 @@ bool IterateElements(Isolate* isolate, Handle<JSReceiver> receiver,
11441153 }
11451154
11461155 case DICTIONARY_ELEMENTS: {
1156+ // Disallow execution so the cached dictionary won't change mid execution.
1157+ DisallowJavascriptExecution no_js (isolate);
1158+
11471159 Handle<NumberDictionary> dict (array->element_dictionary (), isolate);
11481160 std::vector<uint32_t > indices;
11491161 indices.reserve (dict->Capacity () / 2 );
0 commit comments