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

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

Issue 2912863006: Inline instance object hash code into object header on 64 bit. (Closed)
Patch Set: Add assembler tests and other feedback from Ryan 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/assembler_x64.h ('k') | runtime/vm/assembler_x64_test.cc » ('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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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/globals.h" // NOLINT 5 #include "vm/globals.h" // NOLINT
6 #if defined(TARGET_ARCH_X64) 6 #if defined(TARGET_ARCH_X64)
7 7
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/cpu.h" 9 #include "vm/cpu.h"
10 #include "vm/heap.h" 10 #include "vm/heap.h"
(...skipping 3412 matching lines...) Expand 10 before | Expand all | Expand 10 after
3423 addq(instance_reg, Immediate(instance_size)); 3423 addq(instance_reg, Immediate(instance_size));
3424 // instance_reg: potential next object start. 3424 // instance_reg: potential next object start.
3425 cmpq(instance_reg, Address(temp, Heap::EndOffset(space))); 3425 cmpq(instance_reg, Address(temp, Heap::EndOffset(space)));
3426 j(ABOVE_EQUAL, failure, near_jump); 3426 j(ABOVE_EQUAL, failure, near_jump);
3427 // Successfully allocated the object, now update top to point to 3427 // Successfully allocated the object, now update top to point to
3428 // next object start and store the class in the class field of object. 3428 // next object start and store the class in the class field of object.
3429 movq(Address(temp, Heap::TopOffset(space)), instance_reg); 3429 movq(Address(temp, Heap::TopOffset(space)), instance_reg);
3430 NOT_IN_PRODUCT(UpdateAllocationStats(cls.id(), space)); 3430 NOT_IN_PRODUCT(UpdateAllocationStats(cls.id(), space));
3431 ASSERT(instance_size >= kHeapObjectTag); 3431 ASSERT(instance_size >= kHeapObjectTag);
3432 AddImmediate(instance_reg, Immediate(kHeapObjectTag - instance_size)); 3432 AddImmediate(instance_reg, Immediate(kHeapObjectTag - instance_size));
3433 uword tags = 0; 3433 uint32_t tags = 0;
3434 tags = RawObject::SizeTag::update(instance_size, tags); 3434 tags = RawObject::SizeTag::update(instance_size, tags);
3435 ASSERT(cls.id() != kIllegalCid); 3435 ASSERT(cls.id() != kIllegalCid);
3436 tags = RawObject::ClassIdTag::update(cls.id(), tags); 3436 tags = RawObject::ClassIdTag::update(cls.id(), tags);
3437 // Extends the 32 bit tags with zeros, which is the uninitialized
3438 // hash code.
3437 MoveImmediate(FieldAddress(instance_reg, Object::tags_offset()), 3439 MoveImmediate(FieldAddress(instance_reg, Object::tags_offset()),
3438 Immediate(tags)); 3440 Immediate(tags));
3439 } else { 3441 } else {
3440 jmp(failure); 3442 jmp(failure);
3441 } 3443 }
3442 } 3444 }
3443 3445
3444 3446
3445 void Assembler::TryAllocateArray(intptr_t cid, 3447 void Assembler::TryAllocateArray(intptr_t cid,
3446 intptr_t instance_size, 3448 intptr_t instance_size,
(...skipping 23 matching lines...) Expand all
3470 j(ABOVE_EQUAL, failure); 3472 j(ABOVE_EQUAL, failure);
3471 3473
3472 // Successfully allocated the object(s), now update top to point to 3474 // Successfully allocated the object(s), now update top to point to
3473 // next object start and initialize the object. 3475 // next object start and initialize the object.
3474 movq(Address(temp, Heap::TopOffset(space)), end_address); 3476 movq(Address(temp, Heap::TopOffset(space)), end_address);
3475 addq(instance, Immediate(kHeapObjectTag)); 3477 addq(instance, Immediate(kHeapObjectTag));
3476 NOT_IN_PRODUCT(UpdateAllocationStatsWithSize(cid, instance_size, space)); 3478 NOT_IN_PRODUCT(UpdateAllocationStatsWithSize(cid, instance_size, space));
3477 3479
3478 // Initialize the tags. 3480 // Initialize the tags.
3479 // instance: new object start as a tagged pointer. 3481 // instance: new object start as a tagged pointer.
3480 uword tags = 0; 3482 uint32_t tags = 0;
3481 tags = RawObject::ClassIdTag::update(cid, tags); 3483 tags = RawObject::ClassIdTag::update(cid, tags);
3482 tags = RawObject::SizeTag::update(instance_size, tags); 3484 tags = RawObject::SizeTag::update(instance_size, tags);
3485 // Extends the 32 bit tags with zeros, which is the uninitialized
3486 // hash code.
3483 movq(FieldAddress(instance, Array::tags_offset()), Immediate(tags)); 3487 movq(FieldAddress(instance, Array::tags_offset()), Immediate(tags));
3484 } else { 3488 } else {
3485 jmp(failure); 3489 jmp(failure);
3486 } 3490 }
3487 } 3491 }
3488 3492
3489 void Assembler::Align(int alignment, intptr_t offset) { 3493 void Assembler::Align(int alignment, intptr_t offset) {
3490 ASSERT(Utils::IsPowerOfTwo(alignment)); 3494 ASSERT(Utils::IsPowerOfTwo(alignment));
3491 intptr_t pos = offset + buffer_.GetPosition(); 3495 intptr_t pos = offset + buffer_.GetPosition();
3492 int mod = pos & (alignment - 1); 3496 int mod = pos & (alignment - 1);
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
3798 3802
3799 3803
3800 const char* Assembler::FpuRegisterName(FpuRegister reg) { 3804 const char* Assembler::FpuRegisterName(FpuRegister reg) {
3801 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); 3805 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters));
3802 return xmm_reg_names[reg]; 3806 return xmm_reg_names[reg];
3803 } 3807 }
3804 3808
3805 } // namespace dart 3809 } // namespace dart
3806 3810
3807 #endif // defined TARGET_ARCH_X64 3811 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/assembler_x64.h ('k') | runtime/vm/assembler_x64_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698