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/elements.h" | 5 #include "src/elements.h" |
6 | 6 |
7 #include "src/arguments.h" | 7 #include "src/arguments.h" |
8 #include "src/conversions.h" | 8 #include "src/conversions.h" |
9 #include "src/factory.h" | 9 #include "src/factory.h" |
10 #include "src/messages.h" | 10 #include "src/messages.h" |
(...skipping 2357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2368 const int kHalfOfMaxInt = 1 << (kBitsPerInt - 2); | 2368 const int kHalfOfMaxInt = 1 << (kBitsPerInt - 2); |
2369 STATIC_ASSERT(FixedArray::kMaxLength < kHalfOfMaxInt); | 2369 STATIC_ASSERT(FixedArray::kMaxLength < kHalfOfMaxInt); |
2370 USE(kHalfOfMaxInt); | 2370 USE(kHalfOfMaxInt); |
2371 result_len += len; | 2371 result_len += len; |
2372 DCHECK(0 <= result_len); | 2372 DCHECK(0 <= result_len); |
2373 DCHECK(result_len <= FixedDoubleArray::kMaxLength); | 2373 DCHECK(result_len <= FixedDoubleArray::kMaxLength); |
2374 | 2374 |
2375 ElementsKind arg_kind = JSArray::cast(arg)->map()->elements_kind(); | 2375 ElementsKind arg_kind = JSArray::cast(arg)->map()->elements_kind(); |
2376 has_double = has_double || IsFastDoubleElementsKind(arg_kind); | 2376 has_double = has_double || IsFastDoubleElementsKind(arg_kind); |
2377 is_holey = is_holey || IsFastHoleyElementsKind(arg_kind); | 2377 is_holey = is_holey || IsFastHoleyElementsKind(arg_kind); |
2378 if (IsMoreGeneralElementsKindTransition(elements_kind, arg_kind)) { | 2378 elements_kind = GetMoreGeneralElementsKind(elements_kind, arg_kind); |
2379 elements_kind = arg_kind; | |
2380 } | |
2381 } | 2379 } |
2382 if (is_holey) { | 2380 if (is_holey) { |
2383 elements_kind = GetHoleyElementsKind(elements_kind); | 2381 elements_kind = GetHoleyElementsKind(elements_kind); |
2384 } | 2382 } |
2385 } | 2383 } |
2386 | 2384 |
2387 // If a double array is concatted into a fast elements array, the fast | 2385 // If a double array is concatted into a fast elements array, the fast |
2388 // elements array needs to be initialized to contain proper holes, since | 2386 // elements array needs to be initialized to contain proper holes, since |
2389 // boxing doubles may cause incremental marking. | 2387 // boxing doubles may cause incremental marking. |
2390 ArrayStorageAllocationMode mode = | 2388 ArrayStorageAllocationMode mode = |
(...skipping 18 matching lines...) Expand all Loading... |
2409 } | 2407 } |
2410 } | 2408 } |
2411 | 2409 |
2412 DCHECK(j == result_len); | 2410 DCHECK(j == result_len); |
2413 return result_array; | 2411 return result_array; |
2414 } | 2412 } |
2415 | 2413 |
2416 ElementsAccessor** ElementsAccessor::elements_accessors_ = NULL; | 2414 ElementsAccessor** ElementsAccessor::elements_accessors_ = NULL; |
2417 } // namespace internal | 2415 } // namespace internal |
2418 } // namespace v8 | 2416 } // namespace v8 |
OLD | NEW |