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 19651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
19662 Integer::Cast(hash_code).AsTruncatedUint32Value()); | 19662 Integer::Cast(hash_code).AsTruncatedUint32Value()); |
19663 } else { | 19663 } else { |
19664 return 0; | 19664 return 0; |
19665 } | 19665 } |
19666 } | 19666 } |
19667 }; | 19667 }; |
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). | |
19673 static const intptr_t kInitialIndexBits = 3; | |
19674 static const intptr_t kInitialIndexSize = 1 << (kInitialIndexBits + 1); | |
19675 const Array& data = Array::Handle(Array::New(kInitialIndexSize, space)); | 19672 const Array& data = Array::Handle(Array::New(kInitialIndexSize, space)); |
19676 const TypedData& index = TypedData::Handle(TypedData::New( | 19673 const TypedData& index = TypedData::Handle(TypedData::New( |
19677 kTypedDataUint32ArrayCid, kInitialIndexSize, space)); | 19674 kTypedDataUint32ArrayCid, kInitialIndexSize, space)); |
19678 // On 32-bit, the top bits are wasted to avoid Mint allocation. | 19675 // On 32-bit, the top bits are wasted to avoid Mint allocation. |
19679 static const intptr_t kAvailableBits = (kSmiBits >= 32) ? 32 : kSmiBits; | 19676 static const intptr_t kAvailableBits = (kSmiBits >= 32) ? 32 : kSmiBits; |
19680 static const intptr_t kInitialHashMask = | 19677 static const intptr_t kInitialHashMask = |
19681 (1 << (kAvailableBits - kInitialIndexBits)) - 1; | 19678 (1 << (kAvailableBits - kInitialIndexBits)) - 1; |
19682 return LinkedHashMap::New(data, index, kInitialHashMask, 0, 0, space); | 19679 return LinkedHashMap::New(data, index, kInitialHashMask, 0, 0, space); |
19683 } | 19680 } |
19684 | 19681 |
(...skipping 1133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
20818 return tag_label.ToCString(); | 20815 return tag_label.ToCString(); |
20819 } | 20816 } |
20820 | 20817 |
20821 | 20818 |
20822 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 20819 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
20823 Instance::PrintJSONImpl(stream, ref); | 20820 Instance::PrintJSONImpl(stream, ref); |
20824 } | 20821 } |
20825 | 20822 |
20826 | 20823 |
20827 } // namespace dart | 20824 } // namespace dart |
OLD | NEW |