@@ -650,11 +650,14 @@ class ArrayConcatVisitor {
650
650
index_offset_(0u ),
651
651
bit_field_(FastElementsField::encode(fast_elements) |
652
652
ExceedsLimitField::encode(false ) |
653
- IsFixedArrayField::encode(storage->IsFixedArray ()) |
653
+ IsFixedArrayField::encode(storage->IsFixedArray (isolate )) |
654
654
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 ());
658
661
}
659
662
660
663
~ArrayConcatVisitor () { clear_storage (); }
@@ -1065,8 +1068,8 @@ bool IterateElements(Isolate* isolate, Handle<JSReceiver> receiver,
1065
1068
return IterateElementsSlow (isolate, receiver, length, visitor);
1066
1069
}
1067
1070
1068
- if (!HasOnlySimpleElements (isolate, *receiver ) ||
1069
- !visitor-> has_simple_elements ( )) {
1071
+ if (!visitor-> has_simple_elements ( ) ||
1072
+ !HasOnlySimpleElements (isolate, *receiver )) {
1070
1073
return IterateElementsSlow (isolate, receiver, length, visitor);
1071
1074
}
1072
1075
Handle <JSObject> array = Handle <JSObject>::cast (receiver);
@@ -1082,6 +1085,9 @@ bool IterateElements(Isolate* isolate, Handle<JSReceiver> receiver,
1082
1085
case HOLEY_SEALED_ELEMENTS:
1083
1086
case HOLEY_NONEXTENSIBLE_ELEMENTS:
1084
1087
case HOLEY_ELEMENTS: {
1088
+ // Disallow execution so the cached elements won't change mid execution.
1089
+ DisallowJavascriptExecution no_js (isolate);
1090
+
1085
1091
// Run through the elements FixedArray and use HasElement and GetElement
1086
1092
// to check the prototype for missing elements.
1087
1093
Handle <FixedArray> elements (FixedArray::cast (array->elements ()), isolate);
@@ -1108,6 +1114,9 @@ bool IterateElements(Isolate* isolate, Handle<JSReceiver> receiver,
1108
1114
}
1109
1115
case HOLEY_DOUBLE_ELEMENTS:
1110
1116
case PACKED_DOUBLE_ELEMENTS: {
1117
+ // Disallow execution so the cached elements won't change mid execution.
1118
+ DisallowJavascriptExecution no_js (isolate);
1119
+
1111
1120
// Empty array is FixedArray but not FixedDoubleArray.
1112
1121
if (length == 0 ) break ;
1113
1122
// Run through the elements FixedArray and use HasElement and GetElement
@@ -1144,6 +1153,9 @@ bool IterateElements(Isolate* isolate, Handle<JSReceiver> receiver,
1144
1153
}
1145
1154
1146
1155
case DICTIONARY_ELEMENTS: {
1156
+ // Disallow execution so the cached dictionary won't change mid execution.
1157
+ DisallowJavascriptExecution no_js (isolate);
1158
+
1147
1159
Handle <NumberDictionary> dict (array->element_dictionary (), isolate);
1148
1160
std::vector<uint32_t > indices;
1149
1161
indices.reserve (dict->Capacity () / 2 );
0 commit comments