Index: src/compiler/x64/code-generator-x64.cc |
diff --git a/src/compiler/x64/code-generator-x64.cc b/src/compiler/x64/code-generator-x64.cc |
index 897e96c1d3b99b798904c77af1f5b649b5228a5b..3efbb11c07c687223107c639111281d8528c43df 100644 |
--- a/src/compiler/x64/code-generator-x64.cc |
+++ b/src/compiler/x64/code-generator-x64.cc |
@@ -191,6 +191,46 @@ class OutOfLineTruncateDoubleToI final : public OutOfLineCode { |
XMMRegister const input_; |
}; |
+ |
+class OutOfLineRecordWrite final : public OutOfLineCode { |
+ public: |
+ OutOfLineRecordWrite(CodeGenerator* gen, Register object, Operand operand, |
+ Register value, Register scratch0, Register scratch1, |
+ RecordWriteMode mode) |
+ : OutOfLineCode(gen), |
+ object_(object), |
+ operand_(operand), |
+ value_(value), |
+ scratch0_(scratch0), |
+ scratch1_(scratch1), |
+ mode_(mode) {} |
+ |
+ void Generate() final { |
+ if (mode_ > RecordWriteMode::kValueIsPointer) { |
+ __ JumpIfSmi(value_, exit()); |
+ } |
+ if (mode_ > RecordWriteMode::kValueIsMap) { |
+ __ CheckPageFlag(value_, scratch0_, |
ulan
2016/02/19 15:02:32
Eliding kPointersToHereAreInterestingMask check fo
|
+ MemoryChunk::kPointersToHereAreInterestingMask, zero, |
+ exit()); |
+ } |
+ SaveFPRegsMode const save_fp_mode = |
+ frame()->DidAllocateDoubleRegisters() ? kSaveFPRegs : kDontSaveFPRegs; |
+ RecordWriteStub stub(isolate(), object_, scratch0_, scratch1_, |
+ EMIT_REMEMBERED_SET, save_fp_mode); |
+ __ leap(scratch1_, operand_); |
+ __ CallStub(&stub); |
+ } |
+ |
+ private: |
+ Register const object_; |
+ Operand const operand_; |
+ Register const value_; |
+ Register const scratch0_; |
+ Register const scratch1_; |
+ RecordWriteMode const mode_; |
+}; |
+ |
} // namespace |
@@ -654,6 +694,24 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) { |
__ bind(ool->exit()); |
break; |
} |
+ case kArchStoreWithWriteBarrier: { |
+ RecordWriteMode mode = |
+ static_cast<RecordWriteMode>(MiscField::decode(instr->opcode())); |
+ Register object = i.InputRegister(0); |
+ size_t index = 0; |
+ Operand operand = i.MemoryOperand(&index); |
+ Register value = i.InputRegister(index); |
+ Register scratch0 = i.TempRegister(0); |
+ Register scratch1 = i.TempRegister(1); |
+ auto ool = new (zone()) OutOfLineRecordWrite(this, object, operand, value, |
+ scratch0, scratch1, mode); |
+ __ movp(operand, value); |
+ __ CheckPageFlag(object, scratch0, |
+ MemoryChunk::kPointersFromHereAreInterestingMask, |
+ not_zero, ool->entry()); |
+ __ bind(ool->exit()); |
+ break; |
+ } |
case kX64Add32: |
ASSEMBLE_BINOP(addl); |
break; |
@@ -1299,24 +1357,6 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) { |
} |
break; |
} |
- case kX64StoreWriteBarrier: { |
- Register object = i.InputRegister(0); |
- Register value = i.InputRegister(2); |
- SaveFPRegsMode mode = |
- frame()->DidAllocateDoubleRegisters() ? kSaveFPRegs : kDontSaveFPRegs; |
- if (HasImmediateInput(instr, 1)) { |
- int index = i.InputInt32(1); |
- Register scratch = i.TempRegister(1); |
- __ movq(Operand(object, index), value); |
- __ RecordWriteContextSlot(object, index, value, scratch, mode); |
- } else { |
- Register index = i.InputRegister(1); |
- __ movq(Operand(object, index, times_1, 0), value); |
- __ leaq(index, Operand(object, index, times_1, 0)); |
- __ RecordWrite(object, index, value, mode); |
- } |
- break; |
- } |
case kCheckedLoadInt8: |
ASSEMBLE_CHECKED_LOAD_INTEGER(movsxbl); |
break; |