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

Side by Side Diff: runtime/vm/object.cc

Issue 2669183004: Revert a change to an integer size (Closed)
Patch Set: Add a tricky comment Created 3 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/become.h" 10 #include "vm/become.h"
(...skipping 4526 matching lines...) Expand 10 before | Expand all | Expand 10 after
4537 hash += hash << 10; 4537 hash += hash << 10;
4538 hash ^= hash >> 6; // Logical shift, unsigned hash. 4538 hash ^= hash >> 6; // Logical shift, unsigned hash.
4539 return hash; 4539 return hash;
4540 } 4540 }
4541 4541
4542 4542
4543 static uint32_t FinalizeHash(uint32_t hash, intptr_t hashbits) { 4543 static uint32_t FinalizeHash(uint32_t hash, intptr_t hashbits) {
4544 hash += hash << 3; 4544 hash += hash << 3;
4545 hash ^= hash >> 11; // Logical shift, unsigned hash. 4545 hash ^= hash >> 11; // Logical shift, unsigned hash.
4546 hash += hash << 15; 4546 hash += hash << 15;
4547 hash &= (static_cast<uint32_t>(1) << hashbits) - 1; 4547 // FinalizeHash gets called with values for hashbits that are bigger than 31
4548 // (like kBitsPerWord - 1). Therefore we are careful to use a type
4549 // (uintptr_t) big enough to avoid undefined behavior with the left shift.
4550 hash &= (static_cast<uintptr_t>(1) << hashbits) - 1;
4548 return (hash == 0) ? 1 : hash; 4551 return (hash == 0) ? 1 : hash;
4549 } 4552 }
4550 4553
4551 4554
4552 intptr_t TypeArguments::ComputeHash() const { 4555 intptr_t TypeArguments::ComputeHash() const {
4553 if (IsNull()) return 0; 4556 if (IsNull()) return 0;
4554 const intptr_t num_types = Length(); 4557 const intptr_t num_types = Length();
4555 if (IsRaw(0, num_types)) return 0; 4558 if (IsRaw(0, num_types)) return 0;
4556 uint32_t result = 0; 4559 uint32_t result = 0;
4557 AbstractType& type = AbstractType::Handle(); 4560 AbstractType& type = AbstractType::Handle();
(...skipping 18527 matching lines...) Expand 10 before | Expand all | Expand 10 after
23085 return UserTag::null(); 23088 return UserTag::null();
23086 } 23089 }
23087 23090
23088 23091
23089 const char* UserTag::ToCString() const { 23092 const char* UserTag::ToCString() const {
23090 const String& tag_label = String::Handle(label()); 23093 const String& tag_label = String::Handle(label());
23091 return tag_label.ToCString(); 23094 return tag_label.ToCString();
23092 } 23095 }
23093 23096
23094 } // namespace dart 23097 } // namespace dart
OLDNEW
« 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