| OLD | NEW | 
|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 #include "src/builtins.h" | 5 #include "src/builtins.h" | 
| 6 | 6 | 
| 7 #include "src/api.h" | 7 #include "src/api.h" | 
| 8 #include "src/api-arguments.h" | 8 #include "src/api-arguments.h" | 
| 9 #include "src/api-natives.h" | 9 #include "src/api-natives.h" | 
| 10 #include "src/base/once.h" | 10 #include "src/base/once.h" | 
| (...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 797   } | 797   } | 
| 798 | 798 | 
| 799  private: | 799  private: | 
| 800   // Convert storage to dictionary mode. | 800   // Convert storage to dictionary mode. | 
| 801   void SetDictionaryMode() { | 801   void SetDictionaryMode() { | 
| 802     DCHECK(fast_elements() && is_fixed_array()); | 802     DCHECK(fast_elements() && is_fixed_array()); | 
| 803     Handle<FixedArray> current_storage = storage_fixed_array(); | 803     Handle<FixedArray> current_storage = storage_fixed_array(); | 
| 804     Handle<SeededNumberDictionary> slow_storage( | 804     Handle<SeededNumberDictionary> slow_storage( | 
| 805         SeededNumberDictionary::New(isolate_, current_storage->length())); | 805         SeededNumberDictionary::New(isolate_, current_storage->length())); | 
| 806     uint32_t current_length = static_cast<uint32_t>(current_storage->length()); | 806     uint32_t current_length = static_cast<uint32_t>(current_storage->length()); | 
| 807     for (uint32_t i = 0; i < current_length; i++) { | 807     FOR_WITH_HANDLE_SCOPE( | 
| 808       HandleScope loop_scope(isolate_); | 808         isolate_, uint32_t, i = 0, i, i < current_length, i++, { | 
| 809       Handle<Object> element(current_storage->get(i), isolate_); | 809           Handle<Object> element(current_storage->get(i), isolate_); | 
| 810       if (!element->IsTheHole()) { | 810           if (!element->IsTheHole()) { | 
| 811         // The object holding this backing store has just been allocated, so | 811             // The object holding this backing store has just been allocated, so | 
| 812         // it cannot yet be used as a prototype. | 812             // it cannot yet be used as a prototype. | 
| 813         Handle<SeededNumberDictionary> new_storage = | 813             Handle<SeededNumberDictionary> new_storage = | 
| 814             SeededNumberDictionary::AtNumberPut(slow_storage, i, element, | 814                 SeededNumberDictionary::AtNumberPut(slow_storage, i, element, | 
| 815                                                 false); | 815                                                     false); | 
| 816         if (!new_storage.is_identical_to(slow_storage)) { | 816             if (!new_storage.is_identical_to(slow_storage)) { | 
| 817           slow_storage = loop_scope.CloseAndEscape(new_storage); | 817               slow_storage = loop_scope.CloseAndEscape(new_storage); | 
| 818         } | 818             } | 
| 819       } | 819           } | 
| 820     } | 820         }); | 
| 821     clear_storage(); | 821     clear_storage(); | 
| 822     set_storage(*slow_storage); | 822     set_storage(*slow_storage); | 
| 823     set_fast_elements(false); | 823     set_fast_elements(false); | 
| 824   } | 824   } | 
| 825 | 825 | 
| 826   inline void clear_storage() { | 826   inline void clear_storage() { | 
| 827     GlobalHandles::Destroy(Handle<Object>::cast(storage_).location()); | 827     GlobalHandles::Destroy(Handle<Object>::cast(storage_).location()); | 
| 828   } | 828   } | 
| 829 | 829 | 
| 830   inline void set_storage(FixedArray* storage) { | 830   inline void set_storage(FixedArray* storage) { | 
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 963         if (!elements->is_the_hole(i)) { | 963         if (!elements->is_the_hole(i)) { | 
| 964           indices->Add(i); | 964           indices->Add(i); | 
| 965         } | 965         } | 
| 966       } | 966       } | 
| 967       break; | 967       break; | 
| 968     } | 968     } | 
| 969     case DICTIONARY_ELEMENTS: { | 969     case DICTIONARY_ELEMENTS: { | 
| 970       Handle<SeededNumberDictionary> dict( | 970       Handle<SeededNumberDictionary> dict( | 
| 971           SeededNumberDictionary::cast(object->elements())); | 971           SeededNumberDictionary::cast(object->elements())); | 
| 972       uint32_t capacity = dict->Capacity(); | 972       uint32_t capacity = dict->Capacity(); | 
| 973       for (uint32_t j = 0; j < capacity; j++) { | 973       FOR_WITH_HANDLE_SCOPE(isolate, uint32_t, j = 0, j, j < capacity, j++, { | 
| 974         HandleScope loop_scope(isolate); |  | 
| 975         Handle<Object> k(dict->KeyAt(j), isolate); | 974         Handle<Object> k(dict->KeyAt(j), isolate); | 
| 976         if (dict->IsKey(*k)) { | 975         if (dict->IsKey(*k)) { | 
| 977           DCHECK(k->IsNumber()); | 976           DCHECK(k->IsNumber()); | 
| 978           uint32_t index = static_cast<uint32_t>(k->Number()); | 977           uint32_t index = static_cast<uint32_t>(k->Number()); | 
| 979           if (index < range) { | 978           if (index < range) { | 
| 980             indices->Add(index); | 979             indices->Add(index); | 
| 981           } | 980           } | 
| 982         } | 981         } | 
| 983       } | 982       }); | 
| 984       break; | 983       break; | 
| 985     } | 984     } | 
| 986 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) case TYPE##_ELEMENTS: | 985 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) case TYPE##_ELEMENTS: | 
| 987 | 986 | 
| 988       TYPED_ARRAYS(TYPED_ARRAY_CASE) | 987       TYPED_ARRAYS(TYPED_ARRAY_CASE) | 
| 989 #undef TYPED_ARRAY_CASE | 988 #undef TYPED_ARRAY_CASE | 
| 990       { | 989       { | 
| 991         uint32_t length = static_cast<uint32_t>( | 990         uint32_t length = static_cast<uint32_t>( | 
| 992             FixedArrayBase::cast(object->elements())->length()); | 991             FixedArrayBase::cast(object->elements())->length()); | 
| 993         if (range <= length) { | 992         if (range <= length) { | 
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1041     // The prototype will usually have no inherited element indices, | 1040     // The prototype will usually have no inherited element indices, | 
| 1042     // but we have to check. | 1041     // but we have to check. | 
| 1043     CollectElementIndices(PrototypeIterator::GetCurrent<JSObject>(iter), range, | 1042     CollectElementIndices(PrototypeIterator::GetCurrent<JSObject>(iter), range, | 
| 1044                           indices); | 1043                           indices); | 
| 1045   } | 1044   } | 
| 1046 } | 1045 } | 
| 1047 | 1046 | 
| 1048 | 1047 | 
| 1049 bool IterateElementsSlow(Isolate* isolate, Handle<JSReceiver> receiver, | 1048 bool IterateElementsSlow(Isolate* isolate, Handle<JSReceiver> receiver, | 
| 1050                          uint32_t length, ArrayConcatVisitor* visitor) { | 1049                          uint32_t length, ArrayConcatVisitor* visitor) { | 
| 1051   for (uint32_t i = 0; i < length; ++i) { | 1050   FOR_WITH_HANDLE_SCOPE(isolate, uint32_t, i = 0, i, i < length, ++i, { | 
| 1052     HandleScope loop_scope(isolate); |  | 
| 1053     Maybe<bool> maybe = JSReceiver::HasElement(receiver, i); | 1051     Maybe<bool> maybe = JSReceiver::HasElement(receiver, i); | 
| 1054     if (!maybe.IsJust()) return false; | 1052     if (!maybe.IsJust()) return false; | 
| 1055     if (maybe.FromJust()) { | 1053     if (maybe.FromJust()) { | 
| 1056       Handle<Object> element_value; | 1054       Handle<Object> element_value; | 
| 1057       ASSIGN_RETURN_ON_EXCEPTION_VALUE( | 1055       ASSIGN_RETURN_ON_EXCEPTION_VALUE( | 
| 1058           isolate, element_value, JSReceiver::GetElement(isolate, receiver, i), | 1056           isolate, element_value, JSReceiver::GetElement(isolate, receiver, i), | 
| 1059           false); | 1057           false); | 
| 1060       if (!visitor->visit(i, element_value)) return false; | 1058       if (!visitor->visit(i, element_value)) return false; | 
| 1061     } | 1059     } | 
| 1062   } | 1060   }); | 
| 1063   visitor->increase_index_offset(length); | 1061   visitor->increase_index_offset(length); | 
| 1064   return true; | 1062   return true; | 
| 1065 } | 1063 } | 
| 1066 | 1064 | 
| 1067 | 1065 | 
| 1068 /** | 1066 /** | 
| 1069  * A helper function that visits "array" elements of a JSReceiver in numerical | 1067  * A helper function that visits "array" elements of a JSReceiver in numerical | 
| 1070  * order. | 1068  * order. | 
| 1071  * | 1069  * | 
| 1072  * The visitor argument called for each existing element in the array | 1070  * The visitor argument called for each existing element in the array | 
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1105 | 1103 | 
| 1106   switch (array->GetElementsKind()) { | 1104   switch (array->GetElementsKind()) { | 
| 1107     case FAST_SMI_ELEMENTS: | 1105     case FAST_SMI_ELEMENTS: | 
| 1108     case FAST_ELEMENTS: | 1106     case FAST_ELEMENTS: | 
| 1109     case FAST_HOLEY_SMI_ELEMENTS: | 1107     case FAST_HOLEY_SMI_ELEMENTS: | 
| 1110     case FAST_HOLEY_ELEMENTS: { | 1108     case FAST_HOLEY_ELEMENTS: { | 
| 1111       // Run through the elements FixedArray and use HasElement and GetElement | 1109       // Run through the elements FixedArray and use HasElement and GetElement | 
| 1112       // to check the prototype for missing elements. | 1110       // to check the prototype for missing elements. | 
| 1113       Handle<FixedArray> elements(FixedArray::cast(array->elements())); | 1111       Handle<FixedArray> elements(FixedArray::cast(array->elements())); | 
| 1114       int fast_length = static_cast<int>(length); | 1112       int fast_length = static_cast<int>(length); | 
| 1115       DCHECK_LE(fast_length, elements->length()); | 1113       DCHECK(fast_length <= elements->length()); | 
| 1116       for (int j = 0; j < fast_length; j++) { | 1114       FOR_WITH_HANDLE_SCOPE(isolate, int, j = 0, j, j < fast_length, j++, { | 
| 1117         HandleScope loop_scope(isolate); |  | 
| 1118         Handle<Object> element_value(elements->get(j), isolate); | 1115         Handle<Object> element_value(elements->get(j), isolate); | 
| 1119         if (!element_value->IsTheHole()) { | 1116         if (!element_value->IsTheHole()) { | 
| 1120           if (!visitor->visit(j, element_value)) return false; | 1117           if (!visitor->visit(j, element_value)) return false; | 
| 1121         } else { | 1118         } else { | 
| 1122           Maybe<bool> maybe = JSReceiver::HasElement(array, j); | 1119           Maybe<bool> maybe = JSReceiver::HasElement(array, j); | 
| 1123           if (!maybe.IsJust()) return false; | 1120           if (!maybe.IsJust()) return false; | 
| 1124           if (maybe.FromJust()) { | 1121           if (maybe.FromJust()) { | 
| 1125             // Call GetElement on array, not its prototype, or getters won't | 1122             // Call GetElement on array, not its prototype, or getters won't | 
| 1126             // have the correct receiver. | 1123             // have the correct receiver. | 
| 1127             ASSIGN_RETURN_ON_EXCEPTION_VALUE( | 1124             ASSIGN_RETURN_ON_EXCEPTION_VALUE( | 
| 1128                 isolate, element_value, | 1125                 isolate, element_value, | 
| 1129                 JSReceiver::GetElement(isolate, array, j), false); | 1126                 JSReceiver::GetElement(isolate, array, j), false); | 
| 1130             if (!visitor->visit(j, element_value)) return false; | 1127             if (!visitor->visit(j, element_value)) return false; | 
| 1131           } | 1128           } | 
| 1132         } | 1129         } | 
| 1133       } | 1130       }); | 
| 1134       break; | 1131       break; | 
| 1135     } | 1132     } | 
| 1136     case FAST_HOLEY_DOUBLE_ELEMENTS: | 1133     case FAST_HOLEY_DOUBLE_ELEMENTS: | 
| 1137     case FAST_DOUBLE_ELEMENTS: { | 1134     case FAST_DOUBLE_ELEMENTS: { | 
| 1138       // Empty array is FixedArray but not FixedDoubleArray. | 1135       // Empty array is FixedArray but not FixedDoubleArray. | 
| 1139       if (length == 0) break; | 1136       if (length == 0) break; | 
| 1140       // Run through the elements FixedArray and use HasElement and GetElement | 1137       // Run through the elements FixedArray and use HasElement and GetElement | 
| 1141       // to check the prototype for missing elements. | 1138       // to check the prototype for missing elements. | 
| 1142       if (array->elements()->IsFixedArray()) { | 1139       if (array->elements()->IsFixedArray()) { | 
| 1143         DCHECK(array->elements()->length() == 0); | 1140         DCHECK(array->elements()->length() == 0); | 
| 1144         break; | 1141         break; | 
| 1145       } | 1142       } | 
| 1146       Handle<FixedDoubleArray> elements( | 1143       Handle<FixedDoubleArray> elements( | 
| 1147           FixedDoubleArray::cast(array->elements())); | 1144           FixedDoubleArray::cast(array->elements())); | 
| 1148       int fast_length = static_cast<int>(length); | 1145       int fast_length = static_cast<int>(length); | 
| 1149       DCHECK(fast_length <= elements->length()); | 1146       DCHECK(fast_length <= elements->length()); | 
| 1150       for (int j = 0; j < fast_length; j++) { | 1147       FOR_WITH_HANDLE_SCOPE(isolate, int, j = 0, j, j < fast_length, j++, { | 
| 1151         HandleScope loop_scope(isolate); |  | 
| 1152         if (!elements->is_the_hole(j)) { | 1148         if (!elements->is_the_hole(j)) { | 
| 1153           double double_value = elements->get_scalar(j); | 1149           double double_value = elements->get_scalar(j); | 
| 1154           Handle<Object> element_value = | 1150           Handle<Object> element_value = | 
| 1155               isolate->factory()->NewNumber(double_value); | 1151               isolate->factory()->NewNumber(double_value); | 
| 1156           if (!visitor->visit(j, element_value)) return false; | 1152           if (!visitor->visit(j, element_value)) return false; | 
| 1157         } else { | 1153         } else { | 
| 1158           Maybe<bool> maybe = JSReceiver::HasElement(array, j); | 1154           Maybe<bool> maybe = JSReceiver::HasElement(array, j); | 
| 1159           if (!maybe.IsJust()) return false; | 1155           if (!maybe.IsJust()) return false; | 
| 1160           if (maybe.FromJust()) { | 1156           if (maybe.FromJust()) { | 
| 1161             // Call GetElement on array, not its prototype, or getters won't | 1157             // Call GetElement on array, not its prototype, or getters won't | 
| 1162             // have the correct receiver. | 1158             // have the correct receiver. | 
| 1163             Handle<Object> element_value; | 1159             Handle<Object> element_value; | 
| 1164             ASSIGN_RETURN_ON_EXCEPTION_VALUE( | 1160             ASSIGN_RETURN_ON_EXCEPTION_VALUE( | 
| 1165                 isolate, element_value, | 1161                 isolate, element_value, | 
| 1166                 JSReceiver::GetElement(isolate, array, j), false); | 1162                 JSReceiver::GetElement(isolate, array, j), false); | 
| 1167             if (!visitor->visit(j, element_value)) return false; | 1163             if (!visitor->visit(j, element_value)) return false; | 
| 1168           } | 1164           } | 
| 1169         } | 1165         } | 
| 1170       } | 1166       }); | 
| 1171       break; | 1167       break; | 
| 1172     } | 1168     } | 
| 1173 | 1169 | 
| 1174     case DICTIONARY_ELEMENTS: { | 1170     case DICTIONARY_ELEMENTS: { | 
| 1175       Handle<SeededNumberDictionary> dict(array->element_dictionary()); | 1171       Handle<SeededNumberDictionary> dict(array->element_dictionary()); | 
| 1176       List<uint32_t> indices(dict->Capacity() / 2); | 1172       List<uint32_t> indices(dict->Capacity() / 2); | 
| 1177       // Collect all indices in the object and the prototypes less | 1173       // Collect all indices in the object and the prototypes less | 
| 1178       // than length. This might introduce duplicates in the indices list. | 1174       // than length. This might introduce duplicates in the indices list. | 
| 1179       CollectElementIndices(array, length, &indices); | 1175       CollectElementIndices(array, length, &indices); | 
| 1180       indices.Sort(&compareUInt32); | 1176       indices.Sort(&compareUInt32); | 
| 1181       int j = 0; | 1177       int j = 0; | 
| 1182       int n = indices.length(); | 1178       int n = indices.length(); | 
| 1183       while (j < n) { | 1179       FOR_WITH_HANDLE_SCOPE(isolate, int, j = 0, j, j < n, (void)0, { | 
| 1184         HandleScope loop_scope(isolate); |  | 
| 1185         uint32_t index = indices[j]; | 1180         uint32_t index = indices[j]; | 
| 1186         Handle<Object> element; | 1181         Handle<Object> element; | 
| 1187         ASSIGN_RETURN_ON_EXCEPTION_VALUE( | 1182         ASSIGN_RETURN_ON_EXCEPTION_VALUE( | 
| 1188             isolate, element, JSReceiver::GetElement(isolate, array, index), | 1183             isolate, element, JSReceiver::GetElement(isolate, array, index), | 
| 1189             false); | 1184             false); | 
| 1190         if (!visitor->visit(index, element)) return false; | 1185         if (!visitor->visit(index, element)) return false; | 
| 1191         // Skip to next different index (i.e., omit duplicates). | 1186         // Skip to next different index (i.e., omit duplicates). | 
| 1192         do { | 1187         do { | 
| 1193           j++; | 1188           j++; | 
| 1194         } while (j < n && indices[j] == index); | 1189         } while (j < n && indices[j] == index); | 
| 1195       } | 1190       }); | 
| 1196       break; | 1191       break; | 
| 1197     } | 1192     } | 
| 1198     case FAST_SLOPPY_ARGUMENTS_ELEMENTS: | 1193     case FAST_SLOPPY_ARGUMENTS_ELEMENTS: | 
| 1199     case SLOW_SLOPPY_ARGUMENTS_ELEMENTS: { | 1194     case SLOW_SLOPPY_ARGUMENTS_ELEMENTS: { | 
| 1200       for (uint32_t index = 0; index < length; index++) { | 1195       FOR_WITH_HANDLE_SCOPE( | 
| 1201         HandleScope loop_scope(isolate); | 1196           isolate, uint32_t, index = 0, index, index < length, index++, { | 
| 1202         Handle<Object> element; | 1197             Handle<Object> element; | 
| 1203         ASSIGN_RETURN_ON_EXCEPTION_VALUE( | 1198             ASSIGN_RETURN_ON_EXCEPTION_VALUE( | 
| 1204             isolate, element, JSReceiver::GetElement(isolate, array, index), | 1199                 isolate, element, JSReceiver::GetElement(isolate, array, index), | 
| 1205             false); | 1200                 false); | 
| 1206         if (!visitor->visit(index, element)) return false; | 1201             if (!visitor->visit(index, element)) return false; | 
| 1207       } | 1202           }); | 
| 1208       break; | 1203       break; | 
| 1209     } | 1204     } | 
| 1210     case NO_ELEMENTS: | 1205     case NO_ELEMENTS: | 
| 1211       break; | 1206       break; | 
| 1212 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) case TYPE##_ELEMENTS: | 1207 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) case TYPE##_ELEMENTS: | 
| 1213       TYPED_ARRAYS(TYPED_ARRAY_CASE) | 1208       TYPED_ARRAYS(TYPED_ARRAY_CASE) | 
| 1214 #undef TYPED_ARRAY_CASE | 1209 #undef TYPED_ARRAY_CASE | 
| 1215       return IterateElementsSlow(isolate, receiver, length, visitor); | 1210       return IterateElementsSlow(isolate, receiver, length, visitor); | 
| 1216     case FAST_STRING_WRAPPER_ELEMENTS: | 1211     case FAST_STRING_WRAPPER_ELEMENTS: | 
| 1217     case SLOW_STRING_WRAPPER_ELEMENTS: | 1212     case SLOW_STRING_WRAPPER_ELEMENTS: | 
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1252 | 1247 | 
| 1253   // Pass 1: estimate the length and number of elements of the result. | 1248   // Pass 1: estimate the length and number of elements of the result. | 
| 1254   // The actual length can be larger if any of the arguments have getters | 1249   // The actual length can be larger if any of the arguments have getters | 
| 1255   // that mutate other arguments (but will otherwise be precise). | 1250   // that mutate other arguments (but will otherwise be precise). | 
| 1256   // The number of elements is precise if there are no inherited elements. | 1251   // The number of elements is precise if there are no inherited elements. | 
| 1257 | 1252 | 
| 1258   ElementsKind kind = FAST_SMI_ELEMENTS; | 1253   ElementsKind kind = FAST_SMI_ELEMENTS; | 
| 1259 | 1254 | 
| 1260   uint32_t estimate_result_length = 0; | 1255   uint32_t estimate_result_length = 0; | 
| 1261   uint32_t estimate_nof_elements = 0; | 1256   uint32_t estimate_nof_elements = 0; | 
| 1262   for (int i = 0; i < argument_count; i++) { | 1257   FOR_WITH_HANDLE_SCOPE(isolate, int, i = 0, i, i < argument_count, i++, { | 
| 1263     HandleScope loop_scope(isolate); |  | 
| 1264     Handle<Object> obj((*args)[i], isolate); | 1258     Handle<Object> obj((*args)[i], isolate); | 
| 1265     uint32_t length_estimate; | 1259     uint32_t length_estimate; | 
| 1266     uint32_t element_estimate; | 1260     uint32_t element_estimate; | 
| 1267     if (obj->IsJSArray()) { | 1261     if (obj->IsJSArray()) { | 
| 1268       Handle<JSArray> array(Handle<JSArray>::cast(obj)); | 1262       Handle<JSArray> array(Handle<JSArray>::cast(obj)); | 
| 1269       length_estimate = static_cast<uint32_t>(array->length()->Number()); | 1263       length_estimate = static_cast<uint32_t>(array->length()->Number()); | 
| 1270       if (length_estimate != 0) { | 1264       if (length_estimate != 0) { | 
| 1271         ElementsKind array_kind = | 1265         ElementsKind array_kind = | 
| 1272             GetPackedElementsKind(array->GetElementsKind()); | 1266             GetPackedElementsKind(array->GetElementsKind()); | 
| 1273         kind = GetMoreGeneralElementsKind(kind, array_kind); | 1267         kind = GetMoreGeneralElementsKind(kind, array_kind); | 
| (...skipping 11 matching lines...) Expand all  Loading... | 
| 1285     if (JSObject::kMaxElementCount - estimate_result_length < length_estimate) { | 1279     if (JSObject::kMaxElementCount - estimate_result_length < length_estimate) { | 
| 1286       estimate_result_length = JSObject::kMaxElementCount; | 1280       estimate_result_length = JSObject::kMaxElementCount; | 
| 1287     } else { | 1281     } else { | 
| 1288       estimate_result_length += length_estimate; | 1282       estimate_result_length += length_estimate; | 
| 1289     } | 1283     } | 
| 1290     if (JSObject::kMaxElementCount - estimate_nof_elements < element_estimate) { | 1284     if (JSObject::kMaxElementCount - estimate_nof_elements < element_estimate) { | 
| 1291       estimate_nof_elements = JSObject::kMaxElementCount; | 1285       estimate_nof_elements = JSObject::kMaxElementCount; | 
| 1292     } else { | 1286     } else { | 
| 1293       estimate_nof_elements += element_estimate; | 1287       estimate_nof_elements += element_estimate; | 
| 1294     } | 1288     } | 
| 1295   } | 1289   }); | 
| 1296 | 1290 | 
| 1297   // If estimated number of elements is more than half of length, a | 1291   // If estimated number of elements is more than half of length, a | 
| 1298   // fixed array (fast case) is more time and space-efficient than a | 1292   // fixed array (fast case) is more time and space-efficient than a | 
| 1299   // dictionary. | 1293   // dictionary. | 
| 1300   bool fast_case = | 1294   bool fast_case = | 
| 1301       is_array_species && (estimate_nof_elements * 2) >= estimate_result_length; | 1295       is_array_species && (estimate_nof_elements * 2) >= estimate_result_length; | 
| 1302 | 1296 | 
| 1303   if (fast_case && kind == FAST_DOUBLE_ELEMENTS) { | 1297   if (fast_case && kind == FAST_DOUBLE_ELEMENTS) { | 
| 1304     Handle<FixedArrayBase> storage = | 1298     Handle<FixedArrayBase> storage = | 
| 1305         isolate->factory()->NewFixedDoubleArray(estimate_result_length); | 1299         isolate->factory()->NewFixedDoubleArray(estimate_result_length); | 
| (...skipping 3240 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 4546 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) | 4540 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) | 
| 4547 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) | 4541 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) | 
| 4548 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) | 4542 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) | 
| 4549 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 4543 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 
| 4550 #undef DEFINE_BUILTIN_ACCESSOR_C | 4544 #undef DEFINE_BUILTIN_ACCESSOR_C | 
| 4551 #undef DEFINE_BUILTIN_ACCESSOR_A | 4545 #undef DEFINE_BUILTIN_ACCESSOR_A | 
| 4552 | 4546 | 
| 4553 | 4547 | 
| 4554 }  // namespace internal | 4548 }  // namespace internal | 
| 4555 }  // namespace v8 | 4549 }  // namespace v8 | 
| OLD | NEW | 
|---|