OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
261 // Allocate an appropriately typed elements array. | 261 // Allocate an appropriately typed elements array. |
262 MaybeObject* maybe_elms; | 262 MaybeObject* maybe_elms; |
263 ElementsKind elements_kind = array->GetElementsKind(); | 263 ElementsKind elements_kind = array->GetElementsKind(); |
264 if (IsFastDoubleElementsKind(elements_kind)) { | 264 if (IsFastDoubleElementsKind(elements_kind)) { |
265 maybe_elms = heap->AllocateUninitializedFixedDoubleArray( | 265 maybe_elms = heap->AllocateUninitializedFixedDoubleArray( |
266 number_of_elements); | 266 number_of_elements); |
267 } else { | 267 } else { |
268 maybe_elms = heap->AllocateFixedArrayWithHoles(number_of_elements); | 268 maybe_elms = heap->AllocateFixedArrayWithHoles(number_of_elements); |
269 } | 269 } |
270 FixedArrayBase* elms; | 270 FixedArrayBase* elms; |
271 if (!maybe_elms->To<FixedArrayBase>(&elms)) return maybe_elms; | 271 if (!maybe_elms->To(&elms)) return maybe_elms; |
272 | 272 |
273 // Fill in the content | 273 // Fill in the content |
274 switch (array->GetElementsKind()) { | 274 switch (array->GetElementsKind()) { |
275 case FAST_HOLEY_SMI_ELEMENTS: | 275 case FAST_HOLEY_SMI_ELEMENTS: |
276 case FAST_SMI_ELEMENTS: { | 276 case FAST_SMI_ELEMENTS: { |
277 FixedArray* smi_elms = FixedArray::cast(elms); | 277 FixedArray* smi_elms = FixedArray::cast(elms); |
278 for (int index = 0; index < number_of_elements; index++) { | 278 for (int index = 0; index < number_of_elements; index++) { |
279 smi_elms->set(index, (*args)[index+1], SKIP_WRITE_BARRIER); | 279 smi_elms->set(index, (*args)[index+1], SKIP_WRITE_BARRIER); |
280 } | 280 } |
281 break; | 281 break; |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
387 ASSERT(!HEAP->lo_space()->Contains(elms)); | 387 ASSERT(!HEAP->lo_space()->Contains(elms)); |
388 | 388 |
389 STATIC_ASSERT(FixedArrayBase::kMapOffset == 0); | 389 STATIC_ASSERT(FixedArrayBase::kMapOffset == 0); |
390 STATIC_ASSERT(FixedArrayBase::kLengthOffset == kPointerSize); | 390 STATIC_ASSERT(FixedArrayBase::kLengthOffset == kPointerSize); |
391 STATIC_ASSERT(FixedArrayBase::kHeaderSize == 2 * kPointerSize); | 391 STATIC_ASSERT(FixedArrayBase::kHeaderSize == 2 * kPointerSize); |
392 | 392 |
393 Object** former_start = HeapObject::RawField(elms, 0); | 393 Object** former_start = HeapObject::RawField(elms, 0); |
394 | 394 |
395 const int len = elms->length(); | 395 const int len = elms->length(); |
396 | 396 |
397 if (to_trim > FixedArrayBase::kHeaderSize / entry_size && | 397 if (to_trim * entry_size > FixedArrayBase::kHeaderSize && |
398 elms->IsFixedArray() && | 398 elms->IsFixedArray() && |
399 !heap->new_space()->Contains(elms)) { | 399 !heap->new_space()->Contains(elms)) { |
400 // If we are doing a big trim in old space then we zap the space that was | 400 // If we are doing a big trim in old space then we zap the space that was |
401 // formerly part of the array so that the GC (aided by the card-based | 401 // formerly part of the array so that the GC (aided by the card-based |
402 // remembered set) won't find pointers to new-space there. | 402 // remembered set) won't find pointers to new-space there. |
403 Object** zap = reinterpret_cast<Object**>(elms->address()); | 403 Object** zap = reinterpret_cast<Object**>(elms->address()); |
404 zap++; // Header of filler must be at least one word so skip that. | 404 zap++; // Header of filler must be at least one word so skip that. |
405 for (int i = 1; i < to_trim; i++) { | 405 for (int i = 1; i < to_trim; i++) { |
406 *zap++ = Smi::FromInt(0); | 406 *zap++ = Smi::FromInt(0); |
407 } | 407 } |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
570 if (new_length > elms->length()) { | 570 if (new_length > elms->length()) { |
571 // New backing storage is needed. | 571 // New backing storage is needed. |
572 int capacity = new_length + (new_length >> 1) + 16; | 572 int capacity = new_length + (new_length >> 1) + 16; |
573 FixedArray* new_elms; | 573 FixedArray* new_elms; |
574 MaybeObject* maybe_obj = heap->AllocateUninitializedFixedArray(capacity); | 574 MaybeObject* maybe_obj = heap->AllocateUninitializedFixedArray(capacity); |
575 if (!maybe_obj->To(&new_elms)) return maybe_obj; | 575 if (!maybe_obj->To(&new_elms)) return maybe_obj; |
576 | 576 |
577 if (len > 0) { | 577 if (len > 0) { |
578 ElementsAccessor* accessor = array->GetElementsAccessor(); | 578 ElementsAccessor* accessor = array->GetElementsAccessor(); |
579 MaybeObject* maybe_failure = | 579 MaybeObject* maybe_failure = |
580 accessor->CopyElements(array, 0, new_elms, kind, 0, len, elms_obj); | 580 accessor->CopyElements(NULL, 0, new_elms, kind, 0, len, elms_obj); |
581 ASSERT(!maybe_failure->IsFailure()); | 581 ASSERT(!maybe_failure->IsFailure()); |
582 USE(maybe_failure); | 582 USE(maybe_failure); |
583 } | 583 } |
584 FillWithHoles(heap, new_elms, new_length, capacity); | 584 FillWithHoles(heap, new_elms, new_length, capacity); |
585 | 585 |
586 elms = new_elms; | 586 elms = new_elms; |
587 } | 587 } |
588 | 588 |
589 // Add the provided values. | 589 // Add the provided values. |
590 AssertNoAllocation no_gc; | 590 AssertNoAllocation no_gc; |
(...skipping 28 matching lines...) Expand all Loading... | |
619 if (new_length > elms_len) { | 619 if (new_length > elms_len) { |
620 // New backing storage is needed. | 620 // New backing storage is needed. |
621 int capacity = new_length + (new_length >> 1) + 16; | 621 int capacity = new_length + (new_length >> 1) + 16; |
622 MaybeObject* maybe_obj = | 622 MaybeObject* maybe_obj = |
623 heap->AllocateUninitializedFixedDoubleArray(capacity); | 623 heap->AllocateUninitializedFixedDoubleArray(capacity); |
624 if (!maybe_obj->To(&new_elms)) return maybe_obj; | 624 if (!maybe_obj->To(&new_elms)) return maybe_obj; |
625 | 625 |
626 if (len > 0) { | 626 if (len > 0) { |
627 ElementsAccessor* accessor = array->GetElementsAccessor(); | 627 ElementsAccessor* accessor = array->GetElementsAccessor(); |
628 MaybeObject* maybe_failure = | 628 MaybeObject* maybe_failure = |
629 accessor->CopyElements(array, 0, new_elms, kind, 0, len, elms_obj); | 629 accessor->CopyElements(NULL, 0, new_elms, kind, 0, len, elms_obj); |
630 ASSERT(!maybe_failure->IsFailure()); | 630 ASSERT(!maybe_failure->IsFailure()); |
631 USE(maybe_failure); | 631 USE(maybe_failure); |
632 } | 632 } |
633 | 633 |
634 FillWithHoles(new_elms, len + to_add, new_elms->length()); | 634 FillWithHoles(new_elms, len + to_add, new_elms->length()); |
635 } else { | 635 } else { |
636 // to_add is > 0 and new_length <= elms_len, so elms_obj cannot be the | 636 // to_add is > 0 and new_length <= elms_len, so elms_obj cannot be the |
637 // empty_fixed_array. | 637 // empty_fixed_array. |
638 new_elms = FixedDoubleArray::cast(elms_obj); | 638 new_elms = FixedDoubleArray::cast(elms_obj); |
639 } | 639 } |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
784 // New backing storage is needed. | 784 // New backing storage is needed. |
785 int capacity = new_length + (new_length >> 1) + 16; | 785 int capacity = new_length + (new_length >> 1) + 16; |
786 FixedArray* new_elms; | 786 FixedArray* new_elms; |
787 MaybeObject* maybe_elms = heap->AllocateUninitializedFixedArray(capacity); | 787 MaybeObject* maybe_elms = heap->AllocateUninitializedFixedArray(capacity); |
788 if (!maybe_elms->To(&new_elms)) return maybe_elms; | 788 if (!maybe_elms->To(&new_elms)) return maybe_elms; |
789 | 789 |
790 if (len > 0) { | 790 if (len > 0) { |
791 ElementsKind kind = array->GetElementsKind(); | 791 ElementsKind kind = array->GetElementsKind(); |
792 ElementsAccessor* accessor = array->GetElementsAccessor(); | 792 ElementsAccessor* accessor = array->GetElementsAccessor(); |
793 MaybeObject* maybe_failure = | 793 MaybeObject* maybe_failure = |
794 accessor->CopyElements(array, 0, new_elms, kind, to_add, len, elms); | 794 accessor->CopyElements(NULL, 0, new_elms, kind, to_add, len, elms); |
795 ASSERT(!maybe_failure->IsFailure()); | 795 ASSERT(!maybe_failure->IsFailure()); |
796 USE(maybe_failure); | 796 USE(maybe_failure); |
797 } | 797 } |
798 | 798 |
799 FillWithHoles(heap, new_elms, new_length, capacity); | 799 FillWithHoles(heap, new_elms, new_length, capacity); |
800 elms = new_elms; | 800 elms = new_elms; |
801 array->set_elements(elms); | 801 array->set_elements(elms); |
802 } else { | 802 } else { |
803 AssertNoAllocation no_gc; | 803 AssertNoAllocation no_gc; |
804 MoveElements(heap, &no_gc, elms, to_add, elms, 0, len); | 804 MoveElements(heap, &no_gc, elms, to_add, elms, 0, len); |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
929 : Min(relative_end, len); | 929 : Min(relative_end, len); |
930 | 930 |
931 // Calculate the length of result array. | 931 // Calculate the length of result array. |
932 int result_len = Max(final - k, 0); | 932 int result_len = Max(final - k, 0); |
933 | 933 |
934 JSArray* result_array; | 934 JSArray* result_array; |
935 MaybeObject* maybe_array = heap->AllocateJSArrayAndStorage(kind, | 935 MaybeObject* maybe_array = heap->AllocateJSArrayAndStorage(kind, |
936 result_len, | 936 result_len, |
937 result_len); | 937 result_len); |
938 | 938 |
939 AssertNoAllocation no_gc; | |
939 if (result_len == 0) return maybe_array; | 940 if (result_len == 0) return maybe_array; |
940 if (!maybe_array->To(&result_array)) return maybe_array; | 941 if (!maybe_array->To(&result_array)) return maybe_array; |
941 | 942 |
942 ElementsAccessor* accessor = object->GetElementsAccessor(); | 943 ElementsAccessor* accessor = object->GetElementsAccessor(); |
943 MaybeObject* maybe_failure = | 944 MaybeObject* maybe_failure = |
944 accessor->CopyElements(object, k, result_array->elements(), | 945 accessor->CopyElements(NULL, k, result_array->elements(), |
945 kind, 0, result_len, elms); | 946 kind, 0, result_len, elms); |
946 ASSERT(!maybe_failure->IsFailure()); | 947 ASSERT(!maybe_failure->IsFailure()); |
947 USE(maybe_failure); | 948 USE(maybe_failure); |
948 | 949 |
949 return result_array; | 950 return result_array; |
950 } | 951 } |
951 | 952 |
952 | 953 |
953 BUILTIN(ArraySplice) { | 954 BUILTIN(ArraySplice) { |
954 Heap* heap = isolate->heap(); | 955 Heap* heap = isolate->heap(); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1033 return maybe_array; | 1034 return maybe_array; |
1034 } | 1035 } |
1035 | 1036 |
1036 JSArray* result_array = NULL; | 1037 JSArray* result_array = NULL; |
1037 MaybeObject* maybe_array = | 1038 MaybeObject* maybe_array = |
1038 heap->AllocateJSArrayAndStorage(elements_kind, | 1039 heap->AllocateJSArrayAndStorage(elements_kind, |
1039 actual_delete_count, | 1040 actual_delete_count, |
1040 actual_delete_count); | 1041 actual_delete_count); |
1041 if (!maybe_array->To(&result_array)) return maybe_array; | 1042 if (!maybe_array->To(&result_array)) return maybe_array; |
1042 | 1043 |
1043 if (actual_delete_count > 0) { | 1044 { |
1044 ElementsAccessor* accessor = array->GetElementsAccessor(); | 1045 AssertNoAllocation no_gc; |
mvstanton
2012/11/22 15:55:41
Here you have a scoping brace, for the AssertNoAll
Toon Verwaest
2012/11/22 16:23:13
Done.
| |
1045 MaybeObject* maybe_failure = | 1046 |
1046 accessor->CopyElements(array, actual_start, result_array->elements(), | 1047 if (actual_delete_count > 0) { |
1047 elements_kind, 0, actual_delete_count, elms_obj); | 1048 ElementsAccessor* accessor = array->GetElementsAccessor(); |
1048 // Cannot fail since the origin and target array are of the same elements | 1049 MaybeObject* maybe_failure = |
1049 // kind. | 1050 accessor->CopyElements(NULL, actual_start, result_array->elements(), |
1050 ASSERT(!maybe_failure->IsFailure()); | 1051 elements_kind, 0, actual_delete_count, elms_obj ); |
1051 USE(maybe_failure); | 1052 // Cannot fail since the origin and target array are of the same elements |
1053 // kind. | |
1054 ASSERT(!maybe_failure->IsFailure()); | |
1055 USE(maybe_failure); | |
1056 } | |
1052 } | 1057 } |
1053 | 1058 |
1054 bool elms_changed = false; | 1059 bool elms_changed = false; |
1055 if (item_count < actual_delete_count) { | 1060 if (item_count < actual_delete_count) { |
1056 // Shrink the array. | 1061 // Shrink the array. |
1057 const bool trim_array = !heap->lo_space()->Contains(elms_obj) && | 1062 const bool trim_array = !heap->lo_space()->Contains(elms_obj) && |
1058 ((actual_start + item_count) < | 1063 ((actual_start + item_count) < |
1059 (len - actual_delete_count - actual_start)); | 1064 (len - actual_delete_count - actual_start)); |
1060 if (trim_array) { | 1065 if (trim_array) { |
1061 const int delta = actual_delete_count - item_count; | 1066 const int delta = actual_delete_count - item_count; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1096 ASSERT((item_count - actual_delete_count) <= (Smi::kMaxValue - len)); | 1101 ASSERT((item_count - actual_delete_count) <= (Smi::kMaxValue - len)); |
1097 | 1102 |
1098 // Check if array need to grow. | 1103 // Check if array need to grow. |
1099 if (new_length > elms->length()) { | 1104 if (new_length > elms->length()) { |
1100 // New backing storage is needed. | 1105 // New backing storage is needed. |
1101 int capacity = new_length + (new_length >> 1) + 16; | 1106 int capacity = new_length + (new_length >> 1) + 16; |
1102 FixedArray* new_elms; | 1107 FixedArray* new_elms; |
1103 MaybeObject* maybe_obj = heap->AllocateUninitializedFixedArray(capacity); | 1108 MaybeObject* maybe_obj = heap->AllocateUninitializedFixedArray(capacity); |
1104 if (!maybe_obj->To(&new_elms)) return maybe_obj; | 1109 if (!maybe_obj->To(&new_elms)) return maybe_obj; |
1105 | 1110 |
1111 AssertNoAllocation no_gc; | |
1112 | |
1106 ElementsKind kind = array->GetElementsKind(); | 1113 ElementsKind kind = array->GetElementsKind(); |
1107 ElementsAccessor* accessor = array->GetElementsAccessor(); | 1114 ElementsAccessor* accessor = array->GetElementsAccessor(); |
1108 if (actual_start > 0) { | 1115 if (actual_start > 0) { |
1109 // Copy the part before actual_start as is. | 1116 // Copy the part before actual_start as is. |
1110 MaybeObject* maybe_failure = accessor->CopyElements( | 1117 MaybeObject* maybe_failure = accessor->CopyElements( |
1111 array, 0, new_elms, kind, 0, actual_start, elms); | 1118 NULL, 0, new_elms, kind, 0, actual_start, elms); |
1112 ASSERT(!maybe_failure->IsFailure()); | 1119 ASSERT(!maybe_failure->IsFailure()); |
1113 USE(maybe_failure); | 1120 USE(maybe_failure); |
1114 } | 1121 } |
1115 const int to_copy = len - actual_delete_count - actual_start; | 1122 const int to_copy = len - actual_delete_count - actual_start; |
1116 if (to_copy > 0) { | 1123 if (to_copy > 0) { |
1117 MaybeObject* maybe_failure = accessor->CopyElements( | 1124 MaybeObject* maybe_failure = accessor->CopyElements( |
1118 array, actual_start + actual_delete_count, new_elms, kind, | 1125 NULL, actual_start + actual_delete_count, new_elms, kind, |
1119 actual_start + item_count, to_copy, elms); | 1126 actual_start + item_count, to_copy, elms); |
1120 ASSERT(!maybe_failure->IsFailure()); | 1127 ASSERT(!maybe_failure->IsFailure()); |
1121 USE(maybe_failure); | 1128 USE(maybe_failure); |
1122 } | 1129 } |
1123 | 1130 |
1124 FillWithHoles(heap, new_elms, new_length, capacity); | 1131 FillWithHoles(heap, new_elms, new_length, capacity); |
1125 | 1132 |
1126 elms_obj = new_elms; | 1133 elms_obj = new_elms; |
1127 elms_changed = true; | 1134 elms_changed = true; |
1128 } else { | 1135 } else { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1170 JSObject::cast(native_context->array_function()->prototype()); | 1177 JSObject::cast(native_context->array_function()->prototype()); |
1171 if (!ArrayPrototypeHasNoElements(heap, native_context, array_proto)) { | 1178 if (!ArrayPrototypeHasNoElements(heap, native_context, array_proto)) { |
1172 return CallJsBuiltin(isolate, "ArrayConcat", args); | 1179 return CallJsBuiltin(isolate, "ArrayConcat", args); |
1173 } | 1180 } |
1174 | 1181 |
1175 // Iterate through all the arguments performing checks | 1182 // Iterate through all the arguments performing checks |
1176 // and calculating total length. | 1183 // and calculating total length. |
1177 int n_arguments = args.length(); | 1184 int n_arguments = args.length(); |
1178 int result_len = 0; | 1185 int result_len = 0; |
1179 ElementsKind elements_kind = GetInitialFastElementsKind(); | 1186 ElementsKind elements_kind = GetInitialFastElementsKind(); |
1187 bool has_double = false; | |
1188 bool is_holey = false; | |
1180 for (int i = 0; i < n_arguments; i++) { | 1189 for (int i = 0; i < n_arguments; i++) { |
1181 Object* arg = args[i]; | 1190 Object* arg = args[i]; |
1182 if (!arg->IsJSArray() || | 1191 if (!arg->IsJSArray() || |
1183 !JSArray::cast(arg)->HasFastElements() || | 1192 !JSArray::cast(arg)->HasFastElements() || |
1184 JSArray::cast(arg)->GetPrototype() != array_proto) { | 1193 JSArray::cast(arg)->GetPrototype() != array_proto) { |
1185 return CallJsBuiltin(isolate, "ArrayConcat", args); | 1194 return CallJsBuiltin(isolate, "ArrayConcat", args); |
1186 } | 1195 } |
1187 int len = Smi::cast(JSArray::cast(arg)->length())->value(); | 1196 int len = Smi::cast(JSArray::cast(arg)->length())->value(); |
1188 | 1197 |
1189 // We shouldn't overflow when adding another len. | 1198 // We shouldn't overflow when adding another len. |
1190 const int kHalfOfMaxInt = 1 << (kBitsPerInt - 2); | 1199 const int kHalfOfMaxInt = 1 << (kBitsPerInt - 2); |
1191 STATIC_ASSERT(FixedArray::kMaxLength < kHalfOfMaxInt); | 1200 STATIC_ASSERT(FixedArray::kMaxLength < kHalfOfMaxInt); |
1192 USE(kHalfOfMaxInt); | 1201 USE(kHalfOfMaxInt); |
1193 result_len += len; | 1202 result_len += len; |
1194 ASSERT(result_len >= 0); | 1203 ASSERT(result_len >= 0); |
1195 | 1204 |
1196 if (result_len > FixedDoubleArray::kMaxLength) { | 1205 if (result_len > FixedDoubleArray::kMaxLength) { |
1197 return CallJsBuiltin(isolate, "ArrayConcat", args); | 1206 return CallJsBuiltin(isolate, "ArrayConcat", args); |
1198 } | 1207 } |
1199 | 1208 |
1200 ElementsKind arg_kind = JSArray::cast(arg)->map()->elements_kind(); | 1209 ElementsKind arg_kind = JSArray::cast(arg)->map()->elements_kind(); |
1210 has_double = has_double || IsFastDoubleElementsKind(arg_kind); | |
mvstanton
2012/11/22 15:55:41
This works, but you might like something that I ha
Toon Verwaest
2012/11/22 16:23:13
Seems like what I have is faster. You can replace
| |
1211 is_holey = is_holey || IsFastHoleyElementsKind(arg_kind); | |
1201 if (IsMoreGeneralElementsKindTransition(elements_kind, arg_kind)) { | 1212 if (IsMoreGeneralElementsKindTransition(elements_kind, arg_kind)) { |
1202 elements_kind = IsFastHoleyElementsKind(elements_kind) | 1213 elements_kind = arg_kind; |
1203 ? GetHoleyElementsKind(arg_kind) : arg_kind; | |
1204 } | 1214 } |
1205 } | 1215 } |
1206 | 1216 |
1217 if (is_holey) elements_kind = GetHoleyElementsKind(elements_kind); | |
1218 | |
1219 // If a double array is concatted into a fast elements array, the fast | |
1220 // elements array needs to be initialized to contain proper holes, since | |
1221 // boxing doubles may cause incremental marking. | |
1222 ArrayStorageAllocationMode mode = | |
1223 has_double && IsFastObjectElementsKind(elements_kind) | |
1224 ? INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE : DONT_INITIALIZE_ARRAY_ELEMENTS; | |
1207 JSArray* result_array; | 1225 JSArray* result_array; |
1208 // Allocate result. | 1226 // Allocate result. |
1209 MaybeObject* maybe_array = | 1227 MaybeObject* maybe_array = |
1210 heap->AllocateJSArrayAndStorage(elements_kind, | 1228 heap->AllocateJSArrayAndStorage(elements_kind, |
1211 result_len, | 1229 result_len, |
1212 result_len); | 1230 result_len, |
1231 mode); | |
1213 if (!maybe_array->To(&result_array)) return maybe_array; | 1232 if (!maybe_array->To(&result_array)) return maybe_array; |
1214 if (result_len == 0) return result_array; | 1233 if (result_len == 0) return result_array; |
1215 | 1234 |
1216 int j = 0; | 1235 int j = 0; |
1217 FixedArrayBase* storage = result_array->elements(); | 1236 FixedArrayBase* storage = result_array->elements(); |
1218 for (int i = 0; i < n_arguments; i++) { | 1237 for (int i = 0; i < n_arguments; i++) { |
1219 JSArray* array = JSArray::cast(args[i]); | 1238 JSArray* array = JSArray::cast(args[i]); |
1220 int len = Smi::cast(array->length())->value(); | 1239 int len = Smi::cast(array->length())->value(); |
1221 if (len > 0) { | 1240 if (len > 0) { |
1222 ElementsAccessor* accessor = array->GetElementsAccessor(); | 1241 ElementsAccessor* accessor = array->GetElementsAccessor(); |
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1930 return Handle<Code>(code_address); \ | 1949 return Handle<Code>(code_address); \ |
1931 } | 1950 } |
1932 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) | 1951 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) |
1933 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) | 1952 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) |
1934 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 1953 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
1935 #undef DEFINE_BUILTIN_ACCESSOR_C | 1954 #undef DEFINE_BUILTIN_ACCESSOR_C |
1936 #undef DEFINE_BUILTIN_ACCESSOR_A | 1955 #undef DEFINE_BUILTIN_ACCESSOR_A |
1937 | 1956 |
1938 | 1957 |
1939 } } // namespace v8::internal | 1958 } } // namespace v8::internal |
OLD | NEW |