Add missing write barrier for arguments store ICs.

Review URL: http://codereview.chromium.org/7207006

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8390 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
fschneider@chromium.org 2011-06-23 09:20:07 +00:00
parent 1eb34e542c
commit 4bc671c2b0
5 changed files with 70 additions and 0 deletions

View File

@ -996,12 +996,16 @@ void KeyedStoreIC::GenerateNonStrictArguments(MacroAssembler* masm) {
MemOperand mapped_location =
GenerateMappedArgumentsLookup(masm, r2, r1, r3, r4, r5, &notin, &slow);
__ str(r0, mapped_location);
__ add(r6, r3, r5);
__ RecordWrite(r3, r6, r9);
__ Ret();
__ bind(&notin);
// The unmapped lookup expects that the parameter map is in r3.
MemOperand unmapped_location =
GenerateUnmappedArgumentsLookup(masm, r1, r3, r4, &slow);
__ str(r0, unmapped_location);
__ add(r6, r3, r4);
__ RecordWrite(r3, r6, r9);
__ Ret();
__ bind(&slow);
GenerateMiss(masm, false);

View File

@ -801,12 +801,18 @@ void KeyedStoreIC::GenerateNonStrictArguments(MacroAssembler* masm) {
Operand mapped_location =
GenerateMappedArgumentsLookup(masm, edx, ecx, ebx, edi, &notin, &slow);
__ mov(mapped_location, eax);
__ lea(ecx, mapped_location);
__ mov(edx, eax);
__ RecordWrite(ebx, ecx, edx);
__ Ret();
__ bind(&notin);
// The unmapped lookup expects that the parameter map is in ebx.
Operand unmapped_location =
GenerateUnmappedArgumentsLookup(masm, ecx, ebx, edi, &slow);
__ mov(unmapped_location, eax);
__ lea(edi, unmapped_location);
__ mov(edx, eax);
__ RecordWrite(ebx, edi, edx);
__ Ret();
__ bind(&slow);
GenerateMiss(masm, false);

View File

@ -1308,12 +1308,18 @@ void KeyedStoreIC::GenerateNonStrictArguments(MacroAssembler* masm) {
Operand mapped_location = GenerateMappedArgumentsLookup(
masm, rdx, rcx, rbx, rdi, r8, &notin, &slow);
__ movq(mapped_location, rax);
__ lea(r9, mapped_location);
__ movq(r8, rax);
__ RecordWrite(rbx, r9, r8);
__ Ret();
__ bind(&notin);
// The unmapped lookup expects that the parameter map is in rbx.
Operand unmapped_location =
GenerateUnmappedArgumentsLookup(masm, rcx, rbx, rdi, &slow);
__ movq(unmapped_location, rax);
__ lea(r9, unmapped_location);
__ movq(r8, rax);
__ RecordWrite(rbx, r9, r8);
__ Ret();
__ bind(&slow);
GenerateMiss(masm, false);

View File

@ -40,3 +40,20 @@ var baz = foo(0);
baz(4);
baz(5);
baz(6);
// Test writing a non-smi.
function foo2(x) {
var a = arguments;
function bar2(i) {
assertEquals(i, ++a[0]);
assertEquals(i, x);
};
bar2(1.5);
bar2(2.5);
bar2(3.5);
return bar2;
}
var baz2 = foo2(0.5);
baz2(4.5);
baz2(5.5);
baz2(6.5);

View File

@ -0,0 +1,37 @@
// Copyright 2011 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided
// with the distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --expose-gc --nocleanup_code_caches_at_gc
function f(x) {
gc();
arguments[0] = {};
}
f(1);
f(1);
f(1);