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

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

Issue 2954453002: VM: Reland Inline instance object hash code into object header on 64bit. (Closed)
Patch Set: Incorporate last minute code review feedback 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 3415 matching lines...) Expand 10 before | Expand all | Expand 10 after
3426 addq(instance_reg, Immediate(instance_size)); 3426 addq(instance_reg, Immediate(instance_size));
3427 // instance_reg: potential next object start. 3427 // instance_reg: potential next object start.
3428 cmpq(instance_reg, Address(temp, Heap::EndOffset(space))); 3428 cmpq(instance_reg, Address(temp, Heap::EndOffset(space)));
3429 j(ABOVE_EQUAL, failure, near_jump); 3429 j(ABOVE_EQUAL, failure, near_jump);
3430 // Successfully allocated the object, now update top to point to 3430 // Successfully allocated the object, now update top to point to
3431 // next object start and store the class in the class field of object. 3431 // next object start and store the class in the class field of object.
3432 movq(Address(temp, Heap::TopOffset(space)), instance_reg); 3432 movq(Address(temp, Heap::TopOffset(space)), instance_reg);
3433 NOT_IN_PRODUCT(UpdateAllocationStats(cls.id(), space)); 3433 NOT_IN_PRODUCT(UpdateAllocationStats(cls.id(), space));
3434 ASSERT(instance_size >= kHeapObjectTag); 3434 ASSERT(instance_size >= kHeapObjectTag);
3435 AddImmediate(instance_reg, Immediate(kHeapObjectTag - instance_size)); 3435 AddImmediate(instance_reg, Immediate(kHeapObjectTag - instance_size));
3436 uword tags = 0; 3436 uint32_t tags = 0;
3437 tags = RawObject::SizeTag::update(instance_size, tags); 3437 tags = RawObject::SizeTag::update(instance_size, tags);
3438 ASSERT(cls.id() != kIllegalCid); 3438 ASSERT(cls.id() != kIllegalCid);
3439 tags = RawObject::ClassIdTag::update(cls.id(), tags); 3439 tags = RawObject::ClassIdTag::update(cls.id(), tags);
3440 // Extends the 32 bit tags with zeros, which is the uninitialized
3441 // hash code.
3440 MoveImmediate(FieldAddress(instance_reg, Object::tags_offset()), 3442 MoveImmediate(FieldAddress(instance_reg, Object::tags_offset()),
3441 Immediate(tags)); 3443 Immediate(tags));
3442 } else { 3444 } else {
3443 jmp(failure); 3445 jmp(failure);
3444 } 3446 }
3445 } 3447 }
3446 3448
3447 3449
3448 void Assembler::TryAllocateArray(intptr_t cid, 3450 void Assembler::TryAllocateArray(intptr_t cid,
3449 intptr_t instance_size, 3451 intptr_t instance_size,
(...skipping 23 matching lines...) Expand all
3473 j(ABOVE_EQUAL, failure); 3475 j(ABOVE_EQUAL, failure);
3474 3476
3475 // Successfully allocated the object(s), now update top to point to 3477 // Successfully allocated the object(s), now update top to point to
3476 // next object start and initialize the object. 3478 // next object start and initialize the object.
3477 movq(Address(temp, Heap::TopOffset(space)), end_address); 3479 movq(Address(temp, Heap::TopOffset(space)), end_address);
3478 addq(instance, Immediate(kHeapObjectTag)); 3480 addq(instance, Immediate(kHeapObjectTag));
3479 NOT_IN_PRODUCT(UpdateAllocationStatsWithSize(cid, instance_size, space)); 3481 NOT_IN_PRODUCT(UpdateAllocationStatsWithSize(cid, instance_size, space));
3480 3482
3481 // Initialize the tags. 3483 // Initialize the tags.
3482 // instance: new object start as a tagged pointer. 3484 // instance: new object start as a tagged pointer.
3483 uword tags = 0; 3485 uint32_t tags = 0;
3484 tags = RawObject::ClassIdTag::update(cid, tags); 3486 tags = RawObject::ClassIdTag::update(cid, tags);
3485 tags = RawObject::SizeTag::update(instance_size, tags); 3487 tags = RawObject::SizeTag::update(instance_size, tags);
3488 // Extends the 32 bit tags with zeros, which is the uninitialized
3489 // hash code.
3486 movq(FieldAddress(instance, Array::tags_offset()), Immediate(tags)); 3490 movq(FieldAddress(instance, Array::tags_offset()), Immediate(tags));
3487 } else { 3491 } else {
3488 jmp(failure); 3492 jmp(failure);
3489 } 3493 }
3490 } 3494 }
3491 3495
3492 void Assembler::Align(int alignment, intptr_t offset) { 3496 void Assembler::Align(int alignment, intptr_t offset) {
3493 ASSERT(Utils::IsPowerOfTwo(alignment)); 3497 ASSERT(Utils::IsPowerOfTwo(alignment));
3494 intptr_t pos = offset + buffer_.GetPosition(); 3498 intptr_t pos = offset + buffer_.GetPosition();
3495 int mod = pos & (alignment - 1); 3499 int mod = pos & (alignment - 1);
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
3801 3805
3802 3806
3803 const char* Assembler::FpuRegisterName(FpuRegister reg) { 3807 const char* Assembler::FpuRegisterName(FpuRegister reg) {
3804 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); 3808 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters));
3805 return xmm_reg_names[reg]; 3809 return xmm_reg_names[reg];
3806 } 3810 }
3807 3811
3808 } // namespace dart 3812 } // namespace dart
3809 3813
3810 #endif // defined TARGET_ARCH_X64 3814 #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