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

Side by Side Diff: src/x64/codegen-x64.cc

Issue 3039025: Fix aliasing problem in inlined stores on x64 and ia32. The receiver... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « src/ia32/codegen-ia32.cc ('k') | 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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 8033 matching lines...) Expand 10 before | Expand all | Expand 10 after
8044 8044
8045 // The initial (invalid) offset has to be large enough to force a 32-bit 8045 // The initial (invalid) offset has to be large enough to force a 32-bit
8046 // instruction encoding to allow patching with an arbitrary offset. Use 8046 // instruction encoding to allow patching with an arbitrary offset. Use
8047 // kMaxInt (minus kHeapObjectTag). 8047 // kMaxInt (minus kHeapObjectTag).
8048 int offset = kMaxInt; 8048 int offset = kMaxInt;
8049 __ movq(FieldOperand(receiver.reg(), offset), value.reg()); 8049 __ movq(FieldOperand(receiver.reg(), offset), value.reg());
8050 __ movq(result.reg(), value.reg()); 8050 __ movq(result.reg(), value.reg());
8051 8051
8052 // Allocate scratch register for write barrier. 8052 // Allocate scratch register for write barrier.
8053 Result scratch = allocator()->Allocate(); 8053 Result scratch = allocator()->Allocate();
8054 ASSERT(scratch.is_valid() && 8054 ASSERT(scratch.is_valid());
8055 result.is_valid() &&
8056 receiver.is_valid() &&
8057 value.is_valid());
8058 8055
8059 // The write barrier clobbers all input registers, so spill the 8056 // The write barrier clobbers all input registers, so spill the
8060 // receiver and the value. 8057 // receiver and the value.
8061 frame_->Spill(receiver.reg()); 8058 frame_->Spill(receiver.reg());
8062 frame_->Spill(value.reg()); 8059 frame_->Spill(value.reg());
8063 8060
8061 // If the receiver and the value share a register allocate a new
8062 // register for the receiver.
8063 if (receiver.reg().is(value.reg())) {
8064 receiver = allocator()->Allocate();
8065 ASSERT(receiver.is_valid());
8066 __ movq(receiver.reg(), value.reg());
8067 }
8068
8064 // Update the write barrier. To save instructions in the inlined 8069 // Update the write barrier. To save instructions in the inlined
8065 // version we do not filter smis. 8070 // version we do not filter smis.
8066 Label skip_write_barrier; 8071 Label skip_write_barrier;
8067 __ InNewSpace(receiver.reg(), value.reg(), equal, &skip_write_barrier); 8072 __ InNewSpace(receiver.reg(), value.reg(), equal, &skip_write_barrier);
8068 int delta_to_record_write = masm_->SizeOfCodeGeneratedSince(&patch_site); 8073 int delta_to_record_write = masm_->SizeOfCodeGeneratedSince(&patch_site);
8069 __ lea(scratch.reg(), Operand(receiver.reg(), offset)); 8074 __ lea(scratch.reg(), Operand(receiver.reg(), offset));
8070 __ RecordWriteHelper(receiver.reg(), scratch.reg(), value.reg()); 8075 __ RecordWriteHelper(receiver.reg(), scratch.reg(), value.reg());
8071 if (FLAG_debug_code) { 8076 if (FLAG_debug_code) {
8072 __ movq(receiver.reg(), BitCast<int64_t>(kZapValue), RelocInfo::NONE); 8077 __ movq(receiver.reg(), BitCast<int64_t>(kZapValue), RelocInfo::NONE);
8073 __ movq(value.reg(), BitCast<int64_t>(kZapValue), RelocInfo::NONE); 8078 __ movq(value.reg(), BitCast<int64_t>(kZapValue), RelocInfo::NONE);
(...skipping 4351 matching lines...) Expand 10 before | Expand all | Expand 10 after
12425 #undef __ 12430 #undef __
12426 12431
12427 void RecordWriteStub::Generate(MacroAssembler* masm) { 12432 void RecordWriteStub::Generate(MacroAssembler* masm) {
12428 masm->RecordWriteHelper(object_, addr_, scratch_); 12433 masm->RecordWriteHelper(object_, addr_, scratch_);
12429 masm->ret(0); 12434 masm->ret(0);
12430 } 12435 }
12431 12436
12432 } } // namespace v8::internal 12437 } } // namespace v8::internal
12433 12438
12434 #endif // V8_TARGET_ARCH_X64 12439 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/ia32/codegen-ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698