| 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/arguments.h" | 8 #include "src/arguments.h" |
| 9 #include "src/base/once.h" | 9 #include "src/base/once.h" |
| 10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
| (...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 980 isolate->factory()->NewJSArray(elements_kind, | 980 isolate->factory()->NewJSArray(elements_kind, |
| 981 result_len, | 981 result_len, |
| 982 result_len, | 982 result_len, |
| 983 mode); | 983 mode); |
| 984 if (result_len == 0) return *result_array; | 984 if (result_len == 0) return *result_array; |
| 985 | 985 |
| 986 int j = 0; | 986 int j = 0; |
| 987 Handle<FixedArrayBase> storage(result_array->elements(), isolate); | 987 Handle<FixedArrayBase> storage(result_array->elements(), isolate); |
| 988 ElementsAccessor* accessor = ElementsAccessor::ForKind(elements_kind); | 988 ElementsAccessor* accessor = ElementsAccessor::ForKind(elements_kind); |
| 989 for (int i = 0; i < n_arguments; i++) { | 989 for (int i = 0; i < n_arguments; i++) { |
| 990 // TODO(ishell): It is crucial to keep |array| as a raw pointer to avoid | 990 // It is crucial to keep |array| in a raw pointer form to avoid performance |
| 991 // performance degradation. Revisit this later. | 991 // degradation. |
| 992 JSArray* array = JSArray::cast(args[i]); | 992 JSArray* array = JSArray::cast(args[i]); |
| 993 int len = Smi::cast(array->length())->value(); | 993 int len = Smi::cast(array->length())->value(); |
| 994 ElementsKind from_kind = array->GetElementsKind(); | |
| 995 if (len > 0) { | 994 if (len > 0) { |
| 995 ElementsKind from_kind = array->GetElementsKind(); |
| 996 accessor->CopyElements(array, 0, from_kind, storage, j, len); | 996 accessor->CopyElements(array, 0, from_kind, storage, j, len); |
| 997 j += len; | 997 j += len; |
| 998 } | 998 } |
| 999 } | 999 } |
| 1000 | 1000 |
| 1001 DCHECK(j == result_len); | 1001 DCHECK(j == result_len); |
| 1002 | 1002 |
| 1003 return *result_array; | 1003 return *result_array; |
| 1004 } | 1004 } |
| 1005 | 1005 |
| (...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1650 } | 1650 } |
| 1651 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) | 1651 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) |
| 1652 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) | 1652 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) |
| 1653 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) | 1653 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) |
| 1654 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 1654 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
| 1655 #undef DEFINE_BUILTIN_ACCESSOR_C | 1655 #undef DEFINE_BUILTIN_ACCESSOR_C |
| 1656 #undef DEFINE_BUILTIN_ACCESSOR_A | 1656 #undef DEFINE_BUILTIN_ACCESSOR_A |
| 1657 | 1657 |
| 1658 | 1658 |
| 1659 } } // namespace v8::internal | 1659 } } // namespace v8::internal |
| OLD | NEW |