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 926 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
937 if (!ArrayPrototypeHasNoElements(&iter)) { | 937 if (!ArrayPrototypeHasNoElements(&iter)) { |
938 AllowHeapAllocation allow_allocation; | 938 AllowHeapAllocation allow_allocation; |
939 return CallJsBuiltin(isolate, "$arrayConcat", args); | 939 return CallJsBuiltin(isolate, "$arrayConcat", args); |
940 } | 940 } |
941 | 941 |
942 // Iterate through all the arguments performing checks | 942 // Iterate through all the arguments performing checks |
943 // and calculating total length. | 943 // and calculating total length. |
944 bool is_holey = false; | 944 bool is_holey = false; |
945 for (int i = 0; i < n_arguments; i++) { | 945 for (int i = 0; i < n_arguments; i++) { |
946 Object* arg = args[i]; | 946 Object* arg = args[i]; |
947 bool fallback = false; | |
947 PrototypeIterator iter(isolate, arg); | 948 PrototypeIterator iter(isolate, arg); |
949 if (FLAG_harmony_concat_spreadable) { | |
950 Handle<Object> obj(arg, isolate); | |
951 fallback = !IsConcatSpreadable(isolate, obj); | |
adamk
2015/08/19 19:50:35
As the test failures show, you can't make this cal
| |
952 } | |
948 if (!arg->IsJSArray() || !JSArray::cast(arg)->HasFastElements() || | 953 if (!arg->IsJSArray() || !JSArray::cast(arg)->HasFastElements() || |
949 iter.GetCurrent() != array_proto) { | 954 iter.GetCurrent() != array_proto || fallback) { |
950 AllowHeapAllocation allow_allocation; | 955 AllowHeapAllocation allow_allocation; |
951 return CallJsBuiltin(isolate, "$arrayConcat", args); | 956 return CallJsBuiltin(isolate, "$arrayConcat", args); |
952 } | 957 } |
953 int len = Smi::cast(JSArray::cast(arg)->length())->value(); | 958 int len = Smi::cast(JSArray::cast(arg)->length())->value(); |
954 | 959 |
955 // We shouldn't overflow when adding another len. | 960 // We shouldn't overflow when adding another len. |
956 const int kHalfOfMaxInt = 1 << (kBitsPerInt - 2); | 961 const int kHalfOfMaxInt = 1 << (kBitsPerInt - 2); |
957 STATIC_ASSERT(FixedArray::kMaxLength < kHalfOfMaxInt); | 962 STATIC_ASSERT(FixedArray::kMaxLength < kHalfOfMaxInt); |
958 USE(kHalfOfMaxInt); | 963 USE(kHalfOfMaxInt); |
959 result_len += len; | 964 result_len += len; |
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1615 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) | 1620 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) |
1616 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) | 1621 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) |
1617 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) | 1622 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) |
1618 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 1623 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
1619 #undef DEFINE_BUILTIN_ACCESSOR_C | 1624 #undef DEFINE_BUILTIN_ACCESSOR_C |
1620 #undef DEFINE_BUILTIN_ACCESSOR_A | 1625 #undef DEFINE_BUILTIN_ACCESSOR_A |
1621 | 1626 |
1622 | 1627 |
1623 } // namespace internal | 1628 } // namespace internal |
1624 } // namespace v8 | 1629 } // namespace v8 |
OLD | NEW |