| 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 if (actual_delete_count > 0) { |
| 1045 AssertNoAllocation no_gc; |
| 1044 ElementsAccessor* accessor = array->GetElementsAccessor(); | 1046 ElementsAccessor* accessor = array->GetElementsAccessor(); |
| 1045 MaybeObject* maybe_failure = | 1047 MaybeObject* maybe_failure = |
| 1046 accessor->CopyElements(array, actual_start, result_array->elements(), | 1048 accessor->CopyElements(NULL, actual_start, result_array->elements(), |
| 1047 elements_kind, 0, actual_delete_count, elms_obj); | 1049 elements_kind, 0, actual_delete_count, elms_obj); |
| 1048 // Cannot fail since the origin and target array are of the same elements | 1050 // Cannot fail since the origin and target array are of the same elements |
| 1049 // kind. | 1051 // kind. |
| 1050 ASSERT(!maybe_failure->IsFailure()); | 1052 ASSERT(!maybe_failure->IsFailure()); |
| 1051 USE(maybe_failure); | 1053 USE(maybe_failure); |
| 1052 } | 1054 } |
| 1053 | 1055 |
| 1054 bool elms_changed = false; | 1056 bool elms_changed = false; |
| 1055 if (item_count < actual_delete_count) { | 1057 if (item_count < actual_delete_count) { |
| 1056 // Shrink the array. | 1058 // Shrink the array. |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1096 ASSERT((item_count - actual_delete_count) <= (Smi::kMaxValue - len)); | 1098 ASSERT((item_count - actual_delete_count) <= (Smi::kMaxValue - len)); |
| 1097 | 1099 |
| 1098 // Check if array need to grow. | 1100 // Check if array need to grow. |
| 1099 if (new_length > elms->length()) { | 1101 if (new_length > elms->length()) { |
| 1100 // New backing storage is needed. | 1102 // New backing storage is needed. |
| 1101 int capacity = new_length + (new_length >> 1) + 16; | 1103 int capacity = new_length + (new_length >> 1) + 16; |
| 1102 FixedArray* new_elms; | 1104 FixedArray* new_elms; |
| 1103 MaybeObject* maybe_obj = heap->AllocateUninitializedFixedArray(capacity); | 1105 MaybeObject* maybe_obj = heap->AllocateUninitializedFixedArray(capacity); |
| 1104 if (!maybe_obj->To(&new_elms)) return maybe_obj; | 1106 if (!maybe_obj->To(&new_elms)) return maybe_obj; |
| 1105 | 1107 |
| 1108 AssertNoAllocation no_gc; |
| 1109 |
| 1106 ElementsKind kind = array->GetElementsKind(); | 1110 ElementsKind kind = array->GetElementsKind(); |
| 1107 ElementsAccessor* accessor = array->GetElementsAccessor(); | 1111 ElementsAccessor* accessor = array->GetElementsAccessor(); |
| 1108 if (actual_start > 0) { | 1112 if (actual_start > 0) { |
| 1109 // Copy the part before actual_start as is. | 1113 // Copy the part before actual_start as is. |
| 1110 MaybeObject* maybe_failure = accessor->CopyElements( | 1114 MaybeObject* maybe_failure = accessor->CopyElements( |
| 1111 array, 0, new_elms, kind, 0, actual_start, elms); | 1115 NULL, 0, new_elms, kind, 0, actual_start, elms); |
| 1112 ASSERT(!maybe_failure->IsFailure()); | 1116 ASSERT(!maybe_failure->IsFailure()); |
| 1113 USE(maybe_failure); | 1117 USE(maybe_failure); |
| 1114 } | 1118 } |
| 1115 const int to_copy = len - actual_delete_count - actual_start; | 1119 const int to_copy = len - actual_delete_count - actual_start; |
| 1116 if (to_copy > 0) { | 1120 if (to_copy > 0) { |
| 1117 MaybeObject* maybe_failure = accessor->CopyElements( | 1121 MaybeObject* maybe_failure = accessor->CopyElements( |
| 1118 array, actual_start + actual_delete_count, new_elms, kind, | 1122 NULL, actual_start + actual_delete_count, new_elms, kind, |
| 1119 actual_start + item_count, to_copy, elms); | 1123 actual_start + item_count, to_copy, elms); |
| 1120 ASSERT(!maybe_failure->IsFailure()); | 1124 ASSERT(!maybe_failure->IsFailure()); |
| 1121 USE(maybe_failure); | 1125 USE(maybe_failure); |
| 1122 } | 1126 } |
| 1123 | 1127 |
| 1124 FillWithHoles(heap, new_elms, new_length, capacity); | 1128 FillWithHoles(heap, new_elms, new_length, capacity); |
| 1125 | 1129 |
| 1126 elms_obj = new_elms; | 1130 elms_obj = new_elms; |
| 1127 elms_changed = true; | 1131 elms_changed = true; |
| 1128 } else { | 1132 } else { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1170 JSObject::cast(native_context->array_function()->prototype()); | 1174 JSObject::cast(native_context->array_function()->prototype()); |
| 1171 if (!ArrayPrototypeHasNoElements(heap, native_context, array_proto)) { | 1175 if (!ArrayPrototypeHasNoElements(heap, native_context, array_proto)) { |
| 1172 return CallJsBuiltin(isolate, "ArrayConcat", args); | 1176 return CallJsBuiltin(isolate, "ArrayConcat", args); |
| 1173 } | 1177 } |
| 1174 | 1178 |
| 1175 // Iterate through all the arguments performing checks | 1179 // Iterate through all the arguments performing checks |
| 1176 // and calculating total length. | 1180 // and calculating total length. |
| 1177 int n_arguments = args.length(); | 1181 int n_arguments = args.length(); |
| 1178 int result_len = 0; | 1182 int result_len = 0; |
| 1179 ElementsKind elements_kind = GetInitialFastElementsKind(); | 1183 ElementsKind elements_kind = GetInitialFastElementsKind(); |
| 1184 bool has_double = false; |
| 1185 bool is_holey = false; |
| 1180 for (int i = 0; i < n_arguments; i++) { | 1186 for (int i = 0; i < n_arguments; i++) { |
| 1181 Object* arg = args[i]; | 1187 Object* arg = args[i]; |
| 1182 if (!arg->IsJSArray() || | 1188 if (!arg->IsJSArray() || |
| 1183 !JSArray::cast(arg)->HasFastElements() || | 1189 !JSArray::cast(arg)->HasFastElements() || |
| 1184 JSArray::cast(arg)->GetPrototype() != array_proto) { | 1190 JSArray::cast(arg)->GetPrototype() != array_proto) { |
| 1185 return CallJsBuiltin(isolate, "ArrayConcat", args); | 1191 return CallJsBuiltin(isolate, "ArrayConcat", args); |
| 1186 } | 1192 } |
| 1187 int len = Smi::cast(JSArray::cast(arg)->length())->value(); | 1193 int len = Smi::cast(JSArray::cast(arg)->length())->value(); |
| 1188 | 1194 |
| 1189 // We shouldn't overflow when adding another len. | 1195 // We shouldn't overflow when adding another len. |
| 1190 const int kHalfOfMaxInt = 1 << (kBitsPerInt - 2); | 1196 const int kHalfOfMaxInt = 1 << (kBitsPerInt - 2); |
| 1191 STATIC_ASSERT(FixedArray::kMaxLength < kHalfOfMaxInt); | 1197 STATIC_ASSERT(FixedArray::kMaxLength < kHalfOfMaxInt); |
| 1192 USE(kHalfOfMaxInt); | 1198 USE(kHalfOfMaxInt); |
| 1193 result_len += len; | 1199 result_len += len; |
| 1194 ASSERT(result_len >= 0); | 1200 ASSERT(result_len >= 0); |
| 1195 | 1201 |
| 1196 if (result_len > FixedDoubleArray::kMaxLength) { | 1202 if (result_len > FixedDoubleArray::kMaxLength) { |
| 1197 return CallJsBuiltin(isolate, "ArrayConcat", args); | 1203 return CallJsBuiltin(isolate, "ArrayConcat", args); |
| 1198 } | 1204 } |
| 1199 | 1205 |
| 1200 ElementsKind arg_kind = JSArray::cast(arg)->map()->elements_kind(); | 1206 ElementsKind arg_kind = JSArray::cast(arg)->map()->elements_kind(); |
| 1207 has_double = has_double || IsFastDoubleElementsKind(arg_kind); |
| 1208 is_holey = is_holey || IsFastHoleyElementsKind(arg_kind); |
| 1201 if (IsMoreGeneralElementsKindTransition(elements_kind, arg_kind)) { | 1209 if (IsMoreGeneralElementsKindTransition(elements_kind, arg_kind)) { |
| 1202 elements_kind = IsFastHoleyElementsKind(elements_kind) | 1210 elements_kind = arg_kind; |
| 1203 ? GetHoleyElementsKind(arg_kind) : arg_kind; | |
| 1204 } | 1211 } |
| 1205 } | 1212 } |
| 1206 | 1213 |
| 1214 if (is_holey) elements_kind = GetHoleyElementsKind(elements_kind); |
| 1215 |
| 1216 // If a double array is concatted into a fast elements array, the fast |
| 1217 // elements array needs to be initialized to contain proper holes, since |
| 1218 // boxing doubles may cause incremental marking. |
| 1219 ArrayStorageAllocationMode mode = |
| 1220 has_double && IsFastObjectElementsKind(elements_kind) |
| 1221 ? INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE : DONT_INITIALIZE_ARRAY_ELEMENTS; |
| 1207 JSArray* result_array; | 1222 JSArray* result_array; |
| 1208 // Allocate result. | 1223 // Allocate result. |
| 1209 MaybeObject* maybe_array = | 1224 MaybeObject* maybe_array = |
| 1210 heap->AllocateJSArrayAndStorage(elements_kind, | 1225 heap->AllocateJSArrayAndStorage(elements_kind, |
| 1211 result_len, | 1226 result_len, |
| 1212 result_len); | 1227 result_len, |
| 1228 mode); |
| 1213 if (!maybe_array->To(&result_array)) return maybe_array; | 1229 if (!maybe_array->To(&result_array)) return maybe_array; |
| 1214 if (result_len == 0) return result_array; | 1230 if (result_len == 0) return result_array; |
| 1215 | 1231 |
| 1216 int j = 0; | 1232 int j = 0; |
| 1217 FixedArrayBase* storage = result_array->elements(); | 1233 FixedArrayBase* storage = result_array->elements(); |
| 1218 for (int i = 0; i < n_arguments; i++) { | 1234 for (int i = 0; i < n_arguments; i++) { |
| 1219 JSArray* array = JSArray::cast(args[i]); | 1235 JSArray* array = JSArray::cast(args[i]); |
| 1220 int len = Smi::cast(array->length())->value(); | 1236 int len = Smi::cast(array->length())->value(); |
| 1221 if (len > 0) { | 1237 if (len > 0) { |
| 1222 ElementsAccessor* accessor = array->GetElementsAccessor(); | 1238 ElementsAccessor* accessor = array->GetElementsAccessor(); |
| (...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1930 return Handle<Code>(code_address); \ | 1946 return Handle<Code>(code_address); \ |
| 1931 } | 1947 } |
| 1932 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) | 1948 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) |
| 1933 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) | 1949 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) |
| 1934 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 1950 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
| 1935 #undef DEFINE_BUILTIN_ACCESSOR_C | 1951 #undef DEFINE_BUILTIN_ACCESSOR_C |
| 1936 #undef DEFINE_BUILTIN_ACCESSOR_A | 1952 #undef DEFINE_BUILTIN_ACCESSOR_A |
| 1937 | 1953 |
| 1938 | 1954 |
| 1939 } } // namespace v8::internal | 1955 } } // namespace v8::internal |
| OLD | NEW |