Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(789)

Unified Diff: runtime/vm/object.cc

Issue 1160963002: Use kSmiBits rather than #ifdef to define hash map constant. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Ready to submit. Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.cc
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index 2896d725180f662d382c2b980421d174e8c3de20..14145e174eac03865cd32547993a280831277f5e 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -19675,12 +19675,10 @@ RawLinkedHashMap* LinkedHashMap::NewDefault(Heap::Space space) {
const Array& data = Array::Handle(Array::New(kInitialIndexSize, space));
const TypedData& index = TypedData::Handle(TypedData::New(
kTypedDataUint32ArrayCid, kInitialIndexSize, space));
+ // On 32-bit, the top bits are wasted to avoid Mint allocation.
+ static const intptr_t kAvailableBits = (kSmiBits >= 32) ? 32 : kSmiBits;
static const intptr_t kInitialHashMask =
-#if defined(ARCH_IS_64_BIT)
- (1 << (32 - kInitialIndexBits)) - 1;
-#else
- (1 << (30 - kInitialIndexBits)) - 1;
-#endif
+ (1 << (kAvailableBits - kInitialIndexBits)) - 1;
return LinkedHashMap::New(data, index, kInitialHashMask, 0, 0, space);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698