| 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 975 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 = |
| 996 isolate->factory()->NewJSArray(elements_kind, | 996 isolate->factory()->NewJSArray(elements_kind, result_len, result_len, |
| 997 result_len, | 997 WEAK, mode); |
| 998 result_len, | |
| 999 mode); | |
| 1000 if (result_len == 0) return *result_array; | 998 if (result_len == 0) return *result_array; |
| 1001 | 999 |
| 1002 int j = 0; | 1000 int j = 0; |
| 1003 Handle<FixedArrayBase> storage(result_array->elements(), isolate); | 1001 Handle<FixedArrayBase> storage(result_array->elements(), isolate); |
| 1004 ElementsAccessor* accessor = ElementsAccessor::ForKind(elements_kind); | 1002 ElementsAccessor* accessor = ElementsAccessor::ForKind(elements_kind); |
| 1005 for (int i = 0; i < n_arguments; i++) { | 1003 for (int i = 0; i < n_arguments; i++) { |
| 1006 // It is crucial to keep |array| in a raw pointer form to avoid performance | 1004 // It is crucial to keep |array| in a raw pointer form to avoid performance |
| 1007 // degradation. | 1005 // degradation. |
| 1008 JSArray* array = JSArray::cast(args[i]); | 1006 JSArray* array = JSArray::cast(args[i]); |
| 1009 int len = Smi::cast(array->length())->value(); | 1007 int len = Smi::cast(array->length())->value(); |
| (...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1665 } | 1663 } |
| 1666 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) | 1664 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) |
| 1667 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) | 1665 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) |
| 1668 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) | 1666 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) |
| 1669 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 1667 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
| 1670 #undef DEFINE_BUILTIN_ACCESSOR_C | 1668 #undef DEFINE_BUILTIN_ACCESSOR_C |
| 1671 #undef DEFINE_BUILTIN_ACCESSOR_A | 1669 #undef DEFINE_BUILTIN_ACCESSOR_A |
| 1672 | 1670 |
| 1673 | 1671 |
| 1674 } } // namespace v8::internal | 1672 } } // namespace v8::internal |
| OLD | NEW |