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

Side by Side Diff: src/ia32/codegen-ia32.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 | « no previous file | src/x64/codegen-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 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 8899 matching lines...) Expand 10 before | Expand all | Expand 10 after
8910 8910
8911 // The initial (invalid) offset has to be large enough to force a 32-bit 8911 // The initial (invalid) offset has to be large enough to force a 32-bit
8912 // instruction encoding to allow patching with an arbitrary offset. Use 8912 // instruction encoding to allow patching with an arbitrary offset. Use
8913 // kMaxInt (minus kHeapObjectTag). 8913 // kMaxInt (minus kHeapObjectTag).
8914 int offset = kMaxInt; 8914 int offset = kMaxInt;
8915 __ mov(FieldOperand(receiver.reg(), offset), value.reg()); 8915 __ mov(FieldOperand(receiver.reg(), offset), value.reg());
8916 __ mov(result.reg(), Operand(value.reg())); 8916 __ mov(result.reg(), Operand(value.reg()));
8917 8917
8918 // Allocate scratch register for write barrier. 8918 // Allocate scratch register for write barrier.
8919 Result scratch = allocator()->Allocate(); 8919 Result scratch = allocator()->Allocate();
8920 ASSERT(scratch.is_valid() && 8920 ASSERT(scratch.is_valid());
8921 result.is_valid() &&
8922 receiver.is_valid() &&
8923 value.is_valid());
8924 8921
8925 // The write barrier clobbers all input registers, so spill the 8922 // The write barrier clobbers all input registers, so spill the
8926 // receiver and the value. 8923 // receiver and the value.
8927 frame_->Spill(receiver.reg()); 8924 frame_->Spill(receiver.reg());
8928 frame_->Spill(value.reg()); 8925 frame_->Spill(value.reg());
8929 8926
8927 // If the receiver and the value share a register allocate a new
8928 // register for the receiver.
8929 if (receiver.reg().is(value.reg())) {
8930 receiver = allocator()->Allocate();
8931 ASSERT(receiver.is_valid());
8932 __ mov(receiver.reg(), Operand(value.reg()));
8933 }
8934
8930 // Update the write barrier. To save instructions in the inlined 8935 // Update the write barrier. To save instructions in the inlined
8931 // version we do not filter smis. 8936 // version we do not filter smis.
8932 Label skip_write_barrier; 8937 Label skip_write_barrier;
8933 __ InNewSpace(receiver.reg(), value.reg(), equal, &skip_write_barrier); 8938 __ InNewSpace(receiver.reg(), value.reg(), equal, &skip_write_barrier);
8934 int delta_to_record_write = masm_->SizeOfCodeGeneratedSince(&patch_site); 8939 int delta_to_record_write = masm_->SizeOfCodeGeneratedSince(&patch_site);
8935 __ lea(scratch.reg(), Operand(receiver.reg(), offset)); 8940 __ lea(scratch.reg(), Operand(receiver.reg(), offset));
8936 __ RecordWriteHelper(receiver.reg(), scratch.reg(), value.reg()); 8941 __ RecordWriteHelper(receiver.reg(), scratch.reg(), value.reg());
8937 if (FLAG_debug_code) { 8942 if (FLAG_debug_code) {
8938 __ mov(receiver.reg(), Immediate(BitCast<int32_t>(kZapValue))); 8943 __ mov(receiver.reg(), Immediate(BitCast<int32_t>(kZapValue)));
8939 __ mov(value.reg(), Immediate(BitCast<int32_t>(kZapValue))); 8944 __ mov(value.reg(), Immediate(BitCast<int32_t>(kZapValue)));
(...skipping 4963 matching lines...) Expand 10 before | Expand all | Expand 10 after
13903 masm.GetCode(&desc); 13908 masm.GetCode(&desc);
13904 // Call the function from C++. 13909 // Call the function from C++.
13905 return FUNCTION_CAST<MemCopyFunction>(buffer); 13910 return FUNCTION_CAST<MemCopyFunction>(buffer);
13906 } 13911 }
13907 13912
13908 #undef __ 13913 #undef __
13909 13914
13910 } } // namespace v8::internal 13915 } } // namespace v8::internal
13911 13916
13912 #endif // V8_TARGET_ARCH_IA32 13917 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « no previous file | src/x64/codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698