Chromium Code Reviews| Index: src/ia32/macro-assembler-ia32.cc |
| diff --git a/src/ia32/macro-assembler-ia32.cc b/src/ia32/macro-assembler-ia32.cc |
| index 27f8f35b66ff277f2d340c581e1c05e51f894f42..bb902da535fbc9c89e465190c201069c9c3d8023 100644 |
| --- a/src/ia32/macro-assembler-ia32.cc |
| +++ b/src/ia32/macro-assembler-ia32.cc |
| @@ -2398,16 +2398,31 @@ void MacroAssembler::PushHeapObject(Handle<HeapObject> object) { |
| void MacroAssembler::CmpWeakValue(Register value, Handle<WeakCell> cell, |
| Register scratch) { |
| + // TODO(erikcorry): Perhaps we can use a special weak cell that does not have |
| + // a read barrier, since we are not using it here. But then we have to be |
| + // sure we don't use the weak cell for normal loads that need a read barrier. |
| mov(scratch, cell); |
| - cmp(value, FieldOperand(scratch, WeakCell::kValueOffset)); |
| + mov(scratch, |
| + FieldOperand(scratch, WeakCell::kValueOffsetDontForgetTheReadBarrier)); |
| + and_(scratch, Immediate(~kReadBarrierTag)); |
| + cmp(value, scratch); |
| } |
| -void MacroAssembler::LoadWeakValue(Register value, Handle<WeakCell> cell, |
| - Label* miss) { |
| - mov(value, cell); |
| - mov(value, FieldOperand(value, WeakCell::kValueOffset)); |
| +void MacroAssembler::LoadWeakValue(Register value, Register scratch, |
| + Handle<WeakCell> cell, Label* miss) { |
| + DCHECK(!value.is(scratch)); |
| + mov(scratch, cell); |
| + mov(value, |
| + FieldOperand(scratch, WeakCell::kValueOffsetDontForgetTheReadBarrier)); |
| JumpIfSmi(value, miss); |
| + Label done; |
| + test(value, Immediate(kReadBarrierTag)); |
| + j(not_zero, &done); |
|
Hannes Payer (out of office)
2015/02/04 13:03:44
Do we need the test? Maybe the cpu is more happy w
|
| + and_(value, Immediate(~kReadBarrierTag)); |
| + mov(FieldOperand(scratch, WeakCell::kValueOffsetDontForgetTheReadBarrier), |
| + value); |
| + bind(&done); |
| } |