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

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

Issue 2953753002: Revert "Inline instance object hash code into object header on 64 bit." (Closed)
Patch Set: Created 3 years, 6 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 | « runtime/vm/freelist.h ('k') | runtime/vm/heap.h » ('j') | 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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/freelist.h" 5 #include "vm/freelist.h"
6 6
7 #include "vm/bit_set.h" 7 #include "vm/bit_set.h"
8 #include "vm/hash_map.h" 8 #include "vm/hash_map.h"
9 #include "vm/lockers.h" 9 #include "vm/lockers.h"
10 #include "vm/object.h" 10 #include "vm/object.h"
11 #include "vm/os_thread.h" 11 #include "vm/os_thread.h"
12 #include "vm/raw_object.h" 12 #include "vm/raw_object.h"
13 13
14 namespace dart { 14 namespace dart {
15 15
16 16
17 FreeListElement* FreeListElement::AsElement(uword addr, intptr_t size) { 17 FreeListElement* FreeListElement::AsElement(uword addr, intptr_t size) {
18 // Precondition: the (page containing the) header of the element is 18 // Precondition: the (page containing the) header of the element is
19 // writable. 19 // writable.
20 ASSERT(size >= kObjectAlignment); 20 ASSERT(size >= kObjectAlignment);
21 ASSERT(Utils::IsAligned(size, kObjectAlignment)); 21 ASSERT(Utils::IsAligned(size, kObjectAlignment));
22 22
23 FreeListElement* result = reinterpret_cast<FreeListElement*>(addr); 23 FreeListElement* result = reinterpret_cast<FreeListElement*>(addr);
24 24
25 uint32_t tags = 0; 25 uword tags = 0;
26 tags = RawObject::SizeTag::update(size, tags); 26 tags = RawObject::SizeTag::update(size, tags);
27 tags = RawObject::ClassIdTag::update(kFreeListElement, tags); 27 tags = RawObject::ClassIdTag::update(kFreeListElement, tags);
28 // All words in a freelist element header should look like Smis. 28 // All words in a freelist element header should look like Smis.
29 ASSERT(!reinterpret_cast<RawObject*>(tags)->IsHeapObject()); 29 ASSERT(!reinterpret_cast<RawObject*>(tags)->IsHeapObject());
30 30
31 result->tags_ = tags; 31 result->tags_ = tags;
32 #if defined(HASH_IN_OBJECT_HEADER)
33 // Clearing this is mostly for neatness. The identityHashCode
34 // of free list entries is not used.
35 result->hash_ = 0;
36 #endif
37 if (size > RawObject::SizeTag::kMaxSizeTag) { 32 if (size > RawObject::SizeTag::kMaxSizeTag) {
38 *result->SizeAddress() = size; 33 *result->SizeAddress() = size;
39 } 34 }
40 result->set_next(NULL); 35 result->set_next(NULL);
41 return result; 36 return result;
42 // Postcondition: the (page containing the) header of the element is 37 // Postcondition: the (page containing the) header of the element is
43 // writable. 38 // writable.
44 } 39 }
45 40
46 41
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 if (next_index != -1) { 438 if (next_index != -1) {
444 FreeListElement* element = DequeueElement(next_index); 439 FreeListElement* element = DequeueElement(next_index);
445 SplitElementAfterAndEnqueue(element, size, false); 440 SplitElementAfterAndEnqueue(element, size, false);
446 return reinterpret_cast<uword>(element); 441 return reinterpret_cast<uword>(element);
447 } 442 }
448 } 443 }
449 return 0; 444 return 0;
450 } 445 }
451 446
452 } // namespace dart 447 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/freelist.h ('k') | runtime/vm/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698