OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include <setjmp.h> // NOLINT | 5 #include <setjmp.h> // NOLINT |
6 #include <stdlib.h> | 6 #include <stdlib.h> |
7 | 7 |
8 #include "vm/globals.h" | 8 #include "vm/globals.h" |
9 #if defined(TARGET_ARCH_DBC) | 9 #if defined(TARGET_ARCH_DBC) |
10 | 10 |
(...skipping 2947 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2958 const intptr_t length = Smi::Value(RAW_CAST(Smi, FP[rB])); | 2958 const intptr_t length = Smi::Value(RAW_CAST(Smi, FP[rB])); |
2959 if (LIKELY(static_cast<uintptr_t>(length) <= Array::kMaxElements)) { | 2959 if (LIKELY(static_cast<uintptr_t>(length) <= Array::kMaxElements)) { |
2960 const intptr_t fixed_size = sizeof(RawArray) + kObjectAlignment - 1; | 2960 const intptr_t fixed_size = sizeof(RawArray) + kObjectAlignment - 1; |
2961 const intptr_t instance_size = | 2961 const intptr_t instance_size = |
2962 (fixed_size + length * kWordSize) & ~(kObjectAlignment - 1); | 2962 (fixed_size + length * kWordSize) & ~(kObjectAlignment - 1); |
2963 const uword start = | 2963 const uword start = |
2964 thread->heap()->new_space()->TryAllocate(instance_size); | 2964 thread->heap()->new_space()->TryAllocate(instance_size); |
2965 if (LIKELY(start != 0)) { | 2965 if (LIKELY(start != 0)) { |
2966 const intptr_t cid = kArrayCid; | 2966 const intptr_t cid = kArrayCid; |
2967 uword tags = 0; | 2967 uword tags = 0; |
2968 if (LIKELY(instance_size < RawObject::SizeTag::kMaxSizeTag)) { | 2968 if (LIKELY(instance_size <= RawObject::SizeTag::kMaxSizeTag)) { |
2969 tags = RawObject::SizeTag::update(instance_size, tags); | 2969 tags = RawObject::SizeTag::update(instance_size, tags); |
2970 } | 2970 } |
2971 tags = RawObject::ClassIdTag::update(cid, tags); | 2971 tags = RawObject::ClassIdTag::update(cid, tags); |
2972 *reinterpret_cast<uword*>(start + Instance::tags_offset()) = tags; | 2972 *reinterpret_cast<uword*>(start + Instance::tags_offset()) = tags; |
2973 *reinterpret_cast<RawObject**>(start + Array::length_offset()) = FP[rB]; | 2973 *reinterpret_cast<RawObject**>(start + Array::length_offset()) = FP[rB]; |
2974 *reinterpret_cast<RawObject**>(start + Array::type_arguments_offset()) = | 2974 *reinterpret_cast<RawObject**>(start + Array::type_arguments_offset()) = |
2975 FP[rC]; | 2975 FP[rC]; |
2976 RawObject** data = | 2976 RawObject** data = |
2977 reinterpret_cast<RawObject**>(start + Array::data_offset()); | 2977 reinterpret_cast<RawObject**>(start + Array::data_offset()); |
2978 for (intptr_t i = 0; i < length; i++) { | 2978 for (intptr_t i = 0; i < length; i++) { |
(...skipping 904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3883 pc_ = pc; | 3883 pc_ = pc; |
3884 } | 3884 } |
3885 | 3885 |
3886 buf->Longjmp(); | 3886 buf->Longjmp(); |
3887 UNREACHABLE(); | 3887 UNREACHABLE(); |
3888 } | 3888 } |
3889 | 3889 |
3890 } // namespace dart | 3890 } // namespace dart |
3891 | 3891 |
3892 #endif // defined TARGET_ARCH_DBC | 3892 #endif // defined TARGET_ARCH_DBC |
OLD | NEW |