[turbofan] Fix write barrier handling of map values.

We cannot omit flag check with kPointersToHereAreInterestingMask for maps because incremental marker dynamically sets and clears the flag.

BUG=chromium:587004
LOG=NO

Review URL: https://codereview.chromium.org/1714513003

Cr-Commit-Position: refs/heads/master@{#34165}
This commit is contained in:
ulan 2016-02-19 10:45:38 -08:00 committed by Commit bot
parent 67f75e30da
commit 5d06548208
9 changed files with 55 additions and 40 deletions

View File

@ -228,11 +228,9 @@ class OutOfLineRecordWrite final : public OutOfLineCode {
if (mode_ > RecordWriteMode::kValueIsPointer) { if (mode_ > RecordWriteMode::kValueIsPointer) {
__ JumpIfSmi(value_, exit()); __ JumpIfSmi(value_, exit());
} }
if (mode_ > RecordWriteMode::kValueIsMap) { __ CheckPageFlag(value_, scratch0_,
__ CheckPageFlag(value_, scratch0_, MemoryChunk::kPointersToHereAreInterestingMask, eq,
MemoryChunk::kPointersToHereAreInterestingMask, eq, exit());
exit());
}
SaveFPRegsMode const save_fp_mode = SaveFPRegsMode const save_fp_mode =
frame()->DidAllocateDoubleRegisters() ? kSaveFPRegs : kDontSaveFPRegs; frame()->DidAllocateDoubleRegisters() ? kSaveFPRegs : kDontSaveFPRegs;
if (!frame()->needs_frame()) { if (!frame()->needs_frame()) {

View File

@ -285,11 +285,9 @@ class OutOfLineRecordWrite final : public OutOfLineCode {
if (mode_ > RecordWriteMode::kValueIsPointer) { if (mode_ > RecordWriteMode::kValueIsPointer) {
__ JumpIfSmi(value_, exit()); __ JumpIfSmi(value_, exit());
} }
if (mode_ > RecordWriteMode::kValueIsMap) { __ CheckPageFlagClear(value_, scratch0_,
__ CheckPageFlagClear(value_, scratch0_, MemoryChunk::kPointersToHereAreInterestingMask,
MemoryChunk::kPointersToHereAreInterestingMask, exit());
exit());
}
SaveFPRegsMode const save_fp_mode = SaveFPRegsMode const save_fp_mode =
frame()->DidAllocateDoubleRegisters() ? kSaveFPRegs : kDontSaveFPRegs; frame()->DidAllocateDoubleRegisters() ? kSaveFPRegs : kDontSaveFPRegs;
if (!frame()->needs_frame()) { if (!frame()->needs_frame()) {

View File

@ -242,11 +242,9 @@ class OutOfLineRecordWrite final : public OutOfLineCode {
if (mode_ > RecordWriteMode::kValueIsPointer) { if (mode_ > RecordWriteMode::kValueIsPointer) {
__ JumpIfSmi(value_, exit()); __ JumpIfSmi(value_, exit());
} }
if (mode_ > RecordWriteMode::kValueIsMap) { __ CheckPageFlag(value_, scratch0_,
__ CheckPageFlag(value_, scratch0_, MemoryChunk::kPointersToHereAreInterestingMask, zero,
MemoryChunk::kPointersToHereAreInterestingMask, zero, exit());
exit());
}
SaveFPRegsMode const save_fp_mode = SaveFPRegsMode const save_fp_mode =
frame()->DidAllocateDoubleRegisters() ? kSaveFPRegs : kDontSaveFPRegs; frame()->DidAllocateDoubleRegisters() ? kSaveFPRegs : kDontSaveFPRegs;
RecordWriteStub stub(isolate(), object_, scratch0_, scratch1_, RecordWriteStub stub(isolate(), object_, scratch0_, scratch1_,

View File

@ -227,11 +227,9 @@ class OutOfLineRecordWrite final : public OutOfLineCode {
if (mode_ > RecordWriteMode::kValueIsPointer) { if (mode_ > RecordWriteMode::kValueIsPointer) {
__ JumpIfSmi(value_, exit()); __ JumpIfSmi(value_, exit());
} }
if (mode_ > RecordWriteMode::kValueIsMap) { __ CheckPageFlag(value_, scratch0_,
__ CheckPageFlag(value_, scratch0_, MemoryChunk::kPointersToHereAreInterestingMask, eq,
MemoryChunk::kPointersToHereAreInterestingMask, eq, exit());
exit());
}
SaveFPRegsMode const save_fp_mode = SaveFPRegsMode const save_fp_mode =
frame()->DidAllocateDoubleRegisters() ? kSaveFPRegs : kDontSaveFPRegs; frame()->DidAllocateDoubleRegisters() ? kSaveFPRegs : kDontSaveFPRegs;
if (!frame()->needs_frame()) { if (!frame()->needs_frame()) {

View File

@ -227,11 +227,9 @@ class OutOfLineRecordWrite final : public OutOfLineCode {
if (mode_ > RecordWriteMode::kValueIsPointer) { if (mode_ > RecordWriteMode::kValueIsPointer) {
__ JumpIfSmi(value_, exit()); __ JumpIfSmi(value_, exit());
} }
if (mode_ > RecordWriteMode::kValueIsMap) { __ CheckPageFlag(value_, scratch0_,
__ CheckPageFlag(value_, scratch0_, MemoryChunk::kPointersToHereAreInterestingMask, eq,
MemoryChunk::kPointersToHereAreInterestingMask, eq, exit());
exit());
}
SaveFPRegsMode const save_fp_mode = SaveFPRegsMode const save_fp_mode =
frame()->DidAllocateDoubleRegisters() ? kSaveFPRegs : kDontSaveFPRegs; frame()->DidAllocateDoubleRegisters() ? kSaveFPRegs : kDontSaveFPRegs;
if (!frame()->needs_frame()) { if (!frame()->needs_frame()) {

View File

@ -189,11 +189,9 @@ class OutOfLineRecordWrite final : public OutOfLineCode {
if (mode_ > RecordWriteMode::kValueIsPointer) { if (mode_ > RecordWriteMode::kValueIsPointer) {
__ JumpIfSmi(value_, exit()); __ JumpIfSmi(value_, exit());
} }
if (mode_ > RecordWriteMode::kValueIsMap) { __ CheckPageFlag(value_, scratch0_,
__ CheckPageFlag(value_, scratch0_, MemoryChunk::kPointersToHereAreInterestingMask, eq,
MemoryChunk::kPointersToHereAreInterestingMask, eq, exit());
exit());
}
SaveFPRegsMode const save_fp_mode = SaveFPRegsMode const save_fp_mode =
frame()->DidAllocateDoubleRegisters() ? kSaveFPRegs : kDontSaveFPRegs; frame()->DidAllocateDoubleRegisters() ? kSaveFPRegs : kDontSaveFPRegs;
if (!frame()->needs_frame()) { if (!frame()->needs_frame()) {

View File

@ -209,11 +209,9 @@ class OutOfLineRecordWrite final : public OutOfLineCode {
if (mode_ > RecordWriteMode::kValueIsPointer) { if (mode_ > RecordWriteMode::kValueIsPointer) {
__ JumpIfSmi(value_, exit()); __ JumpIfSmi(value_, exit());
} }
if (mode_ > RecordWriteMode::kValueIsMap) { __ CheckPageFlag(value_, scratch0_,
__ CheckPageFlag(value_, scratch0_, MemoryChunk::kPointersToHereAreInterestingMask, zero,
MemoryChunk::kPointersToHereAreInterestingMask, zero, exit());
exit());
}
SaveFPRegsMode const save_fp_mode = SaveFPRegsMode const save_fp_mode =
frame()->DidAllocateDoubleRegisters() ? kSaveFPRegs : kDontSaveFPRegs; frame()->DidAllocateDoubleRegisters() ? kSaveFPRegs : kDontSaveFPRegs;
RecordWriteStub stub(isolate(), object_, scratch0_, scratch1_, RecordWriteStub stub(isolate(), object_, scratch0_, scratch1_,

View File

@ -246,11 +246,9 @@ class OutOfLineRecordWrite final : public OutOfLineCode {
if (mode_ > RecordWriteMode::kValueIsPointer) { if (mode_ > RecordWriteMode::kValueIsPointer) {
__ JumpIfSmi(value_, exit()); __ JumpIfSmi(value_, exit());
} }
if (mode_ > RecordWriteMode::kValueIsMap) { __ CheckPageFlag(value_, scratch0_,
__ CheckPageFlag(value_, scratch0_, MemoryChunk::kPointersToHereAreInterestingMask, zero,
MemoryChunk::kPointersToHereAreInterestingMask, zero, exit());
exit());
}
SaveFPRegsMode const save_fp_mode = SaveFPRegsMode const save_fp_mode =
frame()->DidAllocateDoubleRegisters() ? kSaveFPRegs : kDontSaveFPRegs; frame()->DidAllocateDoubleRegisters() ? kSaveFPRegs : kDontSaveFPRegs;
RecordWriteStub stub(isolate(), object_, scratch0_, scratch1_, RecordWriteStub stub(isolate(), object_, scratch0_, scratch1_,

View File

@ -0,0 +1,31 @@
// Copyright 2016 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --expose-gc --min-semi-space-size=32
// We need to set --min-semi-space-size to enable allocation site pretenuring.
function foo(i) {
with({}) {};
x = {};
x.a = 0.23;
x.b = 0.3;
return x;
}
var all = [];
function step() {
for (var i = 0; i < 100; i++) {
var z = foo(i);
// Write unboxed double in object slack.
z.c = 0.1 + z.b
all.push(z);
}
gc(1);
gc(1);
}
step();
// Now foo will allocate objects in old space.
step();