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

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

Issue 738453002: Add missing verified write on x64; extend test coverage (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/assembler_x64.h ('k') | runtime/vm/flow_graph_compiler_x64.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" 5 #include "vm/globals.h"
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 2742 matching lines...) Expand 10 before | Expand all | Expand 10 after
2753 } 2753 }
2754 } 2754 }
2755 2755
2756 2756
2757 void Assembler::StoreObject(const Address& dst, const Object& object, 2757 void Assembler::StoreObject(const Address& dst, const Object& object,
2758 Register pp) { 2758 Register pp) {
2759 if (CanLoadFromObjectPool(object)) { 2759 if (CanLoadFromObjectPool(object)) {
2760 LoadObject(TMP, object, pp); 2760 LoadObject(TMP, object, pp);
2761 movq(dst, TMP); 2761 movq(dst, TMP);
2762 } else { 2762 } else {
2763 LoadImmediate(dst, Immediate(reinterpret_cast<int64_t>(object.raw())), pp); 2763 MoveImmediate(dst, Immediate(reinterpret_cast<int64_t>(object.raw())), pp);
2764 } 2764 }
2765 } 2765 }
2766 2766
2767 2767
2768 void Assembler::PushObject(const Object& object, Register pp) { 2768 void Assembler::PushObject(const Object& object, Register pp) {
2769 if (CanLoadFromObjectPool(object)) { 2769 if (CanLoadFromObjectPool(object)) {
2770 LoadObject(TMP, object, pp); 2770 LoadObject(TMP, object, pp);
2771 pushq(TMP); 2771 pushq(TMP);
2772 } else { 2772 } else {
2773 PushImmediate(Immediate(reinterpret_cast<int64_t>(object.raw())), pp); 2773 PushImmediate(Immediate(reinterpret_cast<int64_t>(object.raw())), pp);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
2818 if (val_smi_tag != 0) { 2818 if (val_smi_tag != 0) {
2819 // Add back the tag bits. 2819 // Add back the tag bits.
2820 orq(reg, Immediate(val_smi_tag)); 2820 orq(reg, Immediate(val_smi_tag));
2821 } 2821 }
2822 } else { 2822 } else {
2823 movq(reg, imm); 2823 movq(reg, imm);
2824 } 2824 }
2825 } 2825 }
2826 2826
2827 2827
2828 void Assembler::LoadImmediate(const Address& dst, const Immediate& imm, 2828 void Assembler::MoveImmediate(const Address& dst, const Immediate& imm,
2829 Register pp) { 2829 Register pp) {
2830 if (CanLoadImmediateFromPool(imm, pp)) { 2830 if (CanLoadImmediateFromPool(imm, pp)) {
2831 LoadImmediate(TMP, imm, pp); 2831 LoadImmediate(TMP, imm, pp);
2832 movq(dst, TMP); 2832 movq(dst, TMP);
2833 } else { 2833 } else {
2834 movq(dst, imm); 2834 movq(dst, imm);
2835 } 2835 }
2836 } 2836 }
2837 2837
2838 2838
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
2945 pushq(value); 2945 pushq(value);
2946 StoreIntoObjectFilter(object, value, &done); 2946 StoreIntoObjectFilter(object, value, &done);
2947 Stop("Store buffer update is required"); 2947 Stop("Store buffer update is required");
2948 Bind(&done); 2948 Bind(&done);
2949 popq(value); 2949 popq(value);
2950 #endif // defined(DEBUG) 2950 #endif // defined(DEBUG)
2951 // No store buffer update. 2951 // No store buffer update.
2952 } 2952 }
2953 2953
2954 2954
2955 void Assembler::StoreIntoObjectNoBarrier(Register object,
2956 const Address& dest,
2957 const Object& value,
2958 Register pp) {
2959 if (VerifiedMemory::enabled()) {
2960 VerifyHeapWord(dest);
2961 Register temp = (pp == RCX) ? RDX : RCX;
2962 pushq(temp);
2963 leaq(temp, dest);
2964 StoreObject(Address(temp, 0), value, pp);
2965 StoreObject(Address(temp, VerifiedMemory::offset()), value, pp);
2966 popq(temp);
2967 } else {
2968 StoreObject(dest, value, pp);
2969 }
2970 // TODO(koda): Use 'object', verify that generational barrier's not needed.
2971 }
2972
2973
2955 void Assembler::StoreIntoSmiField(const Address& dest, Register value) { 2974 void Assembler::StoreIntoSmiField(const Address& dest, Register value) {
2956 VerifiedWrite(dest, value); 2975 VerifiedWrite(dest, value);
2957 #if defined(DEBUG) 2976 #if defined(DEBUG)
2958 Label done; 2977 Label done;
2959 testq(value, Immediate(kHeapObjectTag)); 2978 testq(value, Immediate(kHeapObjectTag));
2960 j(ZERO, &done); 2979 j(ZERO, &done);
2961 Stop("Smi expected"); 2980 Stop("Smi expected");
2962 Bind(&done); 2981 Bind(&done);
2963 #endif // defined(DEBUG) 2982 #endif // defined(DEBUG)
2964 } 2983 }
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
3421 // next object start and store the class in the class field of object. 3440 // next object start and store the class in the class field of object.
3422 LoadImmediate(TMP, Immediate(heap->TopAddress(space)), pp); 3441 LoadImmediate(TMP, Immediate(heap->TopAddress(space)), pp);
3423 movq(Address(TMP, 0), instance_reg); 3442 movq(Address(TMP, 0), instance_reg);
3424 UpdateAllocationStats(cls.id(), space); 3443 UpdateAllocationStats(cls.id(), space);
3425 ASSERT(instance_size >= kHeapObjectTag); 3444 ASSERT(instance_size >= kHeapObjectTag);
3426 AddImmediate(instance_reg, Immediate(kHeapObjectTag - instance_size), pp); 3445 AddImmediate(instance_reg, Immediate(kHeapObjectTag - instance_size), pp);
3427 uword tags = 0; 3446 uword tags = 0;
3428 tags = RawObject::SizeTag::update(instance_size, tags); 3447 tags = RawObject::SizeTag::update(instance_size, tags);
3429 ASSERT(cls.id() != kIllegalCid); 3448 ASSERT(cls.id() != kIllegalCid);
3430 tags = RawObject::ClassIdTag::update(cls.id(), tags); 3449 tags = RawObject::ClassIdTag::update(cls.id(), tags);
3431 LoadImmediate(FieldAddress(instance_reg, Object::tags_offset()), 3450 MoveImmediate(FieldAddress(instance_reg, Object::tags_offset()),
3432 Immediate(tags), pp); 3451 Immediate(tags), pp);
3433 } else { 3452 } else {
3434 jmp(failure); 3453 jmp(failure);
3435 } 3454 }
3436 } 3455 }
3437 3456
3438 3457
3439 void Assembler::TryAllocateArray(intptr_t cid, 3458 void Assembler::TryAllocateArray(intptr_t cid,
3440 intptr_t instance_size, 3459 intptr_t instance_size,
3441 Label* failure, 3460 Label* failure,
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
3755 3774
3756 3775
3757 const char* Assembler::FpuRegisterName(FpuRegister reg) { 3776 const char* Assembler::FpuRegisterName(FpuRegister reg) {
3758 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); 3777 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters));
3759 return xmm_reg_names[reg]; 3778 return xmm_reg_names[reg];
3760 } 3779 }
3761 3780
3762 } // namespace dart 3781 } // namespace dart
3763 3782
3764 #endif // defined TARGET_ARCH_X64 3783 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/assembler_x64.h ('k') | runtime/vm/flow_graph_compiler_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698