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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/api.h" | 7 #include "src/api.h" |
8 #include "src/api-natives.h" | 8 #include "src/api-natives.h" |
9 #include "src/arguments.h" | 9 #include "src/arguments.h" |
10 #include "src/base/once.h" | 10 #include "src/base/once.h" |
(...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
985 } | 985 } |
986 if (is_holey) elements_kind = GetHoleyElementsKind(elements_kind); | 986 if (is_holey) elements_kind = GetHoleyElementsKind(elements_kind); |
987 } | 987 } |
988 | 988 |
989 // If a double array is concatted into a fast elements array, the fast | 989 // If a double array is concatted into a fast elements array, the fast |
990 // elements array needs to be initialized to contain proper holes, since | 990 // elements array needs to be initialized to contain proper holes, since |
991 // boxing doubles may cause incremental marking. | 991 // boxing doubles may cause incremental marking. |
992 ArrayStorageAllocationMode mode = | 992 ArrayStorageAllocationMode mode = |
993 has_double && IsFastObjectElementsKind(elements_kind) | 993 has_double && IsFastObjectElementsKind(elements_kind) |
994 ? INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE : DONT_INITIALIZE_ARRAY_ELEMENTS; | 994 ? INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE : DONT_INITIALIZE_ARRAY_ELEMENTS; |
995 Handle<JSArray> result_array = | 995 Handle<JSArray> result_array = isolate->factory()->NewJSArray( |
996 isolate->factory()->NewJSArray(elements_kind, | 996 elements_kind, result_len, result_len, WEAK, mode); |
997 result_len, | |
998 result_len, | |
999 mode); | |
1000 if (result_len == 0) return *result_array; | 997 if (result_len == 0) return *result_array; |
1001 | 998 |
1002 int j = 0; | 999 int j = 0; |
1003 Handle<FixedArrayBase> storage(result_array->elements(), isolate); | 1000 Handle<FixedArrayBase> storage(result_array->elements(), isolate); |
1004 ElementsAccessor* accessor = ElementsAccessor::ForKind(elements_kind); | 1001 ElementsAccessor* accessor = ElementsAccessor::ForKind(elements_kind); |
1005 for (int i = 0; i < n_arguments; i++) { | 1002 for (int i = 0; i < n_arguments; i++) { |
1006 // It is crucial to keep |array| in a raw pointer form to avoid performance | 1003 // It is crucial to keep |array| in a raw pointer form to avoid performance |
1007 // degradation. | 1004 // degradation. |
1008 JSArray* array = JSArray::cast(args[i]); | 1005 JSArray* array = JSArray::cast(args[i]); |
1009 int len = Smi::cast(array->length())->value(); | 1006 int len = Smi::cast(array->length())->value(); |
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1665 } | 1662 } |
1666 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) | 1663 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) |
1667 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) | 1664 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) |
1668 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) | 1665 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) |
1669 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 1666 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
1670 #undef DEFINE_BUILTIN_ACCESSOR_C | 1667 #undef DEFINE_BUILTIN_ACCESSOR_C |
1671 #undef DEFINE_BUILTIN_ACCESSOR_A | 1668 #undef DEFINE_BUILTIN_ACCESSOR_A |
1672 | 1669 |
1673 | 1670 |
1674 } } // namespace v8::internal | 1671 } } // namespace v8::internal |
OLD | NEW |