OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 "vm/object.h" | 5 #include "vm/object.h" |
6 | 6 |
7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
10 #include "vm/cpu.h" | 10 #include "vm/cpu.h" |
(...skipping 19657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
19668 typedef EnumIndexHashMap<DefaultHashTraits> EnumIndexDefaultMap; | 19668 typedef EnumIndexHashMap<DefaultHashTraits> EnumIndexDefaultMap; |
19669 | 19669 |
19670 | 19670 |
19671 RawLinkedHashMap* LinkedHashMap::NewDefault(Heap::Space space) { | 19671 RawLinkedHashMap* LinkedHashMap::NewDefault(Heap::Space space) { |
19672 // Keep this in sync with Dart implementation (lib/compact_hash.dart). | 19672 // Keep this in sync with Dart implementation (lib/compact_hash.dart). |
19673 static const intptr_t kInitialIndexBits = 3; | 19673 static const intptr_t kInitialIndexBits = 3; |
19674 static const intptr_t kInitialIndexSize = 1 << (kInitialIndexBits + 1); | 19674 static const intptr_t kInitialIndexSize = 1 << (kInitialIndexBits + 1); |
19675 const Array& data = Array::Handle(Array::New(kInitialIndexSize, space)); | 19675 const Array& data = Array::Handle(Array::New(kInitialIndexSize, space)); |
19676 const TypedData& index = TypedData::Handle(TypedData::New( | 19676 const TypedData& index = TypedData::Handle(TypedData::New( |
19677 kTypedDataUint32ArrayCid, kInitialIndexSize, space)); | 19677 kTypedDataUint32ArrayCid, kInitialIndexSize, space)); |
| 19678 // On 32-bit, the top bits are wasted to avoid Mint allocation. |
| 19679 static const intptr_t kAvailableBits = (kSmiBits >= 32) ? 32 : kSmiBits; |
19678 static const intptr_t kInitialHashMask = | 19680 static const intptr_t kInitialHashMask = |
19679 #if defined(ARCH_IS_64_BIT) | 19681 (1 << (kAvailableBits - kInitialIndexBits)) - 1; |
19680 (1 << (32 - kInitialIndexBits)) - 1; | |
19681 #else | |
19682 (1 << (30 - kInitialIndexBits)) - 1; | |
19683 #endif | |
19684 return LinkedHashMap::New(data, index, kInitialHashMask, 0, 0, space); | 19682 return LinkedHashMap::New(data, index, kInitialHashMask, 0, 0, space); |
19685 } | 19683 } |
19686 | 19684 |
19687 | 19685 |
19688 RawLinkedHashMap* LinkedHashMap::New(const Array& data, | 19686 RawLinkedHashMap* LinkedHashMap::New(const Array& data, |
19689 const TypedData& index, | 19687 const TypedData& index, |
19690 intptr_t hash_mask, | 19688 intptr_t hash_mask, |
19691 intptr_t used_data, | 19689 intptr_t used_data, |
19692 intptr_t deleted_keys, | 19690 intptr_t deleted_keys, |
19693 Heap::Space space) { | 19691 Heap::Space space) { |
(...skipping 1126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
20820 return tag_label.ToCString(); | 20818 return tag_label.ToCString(); |
20821 } | 20819 } |
20822 | 20820 |
20823 | 20821 |
20824 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 20822 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
20825 Instance::PrintJSONImpl(stream, ref); | 20823 Instance::PrintJSONImpl(stream, ref); |
20826 } | 20824 } |
20827 | 20825 |
20828 | 20826 |
20829 } // namespace dart | 20827 } // namespace dart |
OLD | NEW |