Index: src/x64/macro-assembler-x64.cc |
diff --git a/src/x64/macro-assembler-x64.cc b/src/x64/macro-assembler-x64.cc |
index e302a419ea47513c4474aad05991f411cd89f62f..694832a18df2cd0b253293cbfd370e0a827beb3d 100644 |
--- a/src/x64/macro-assembler-x64.cc |
+++ b/src/x64/macro-assembler-x64.cc |
@@ -5280,25 +5280,38 @@ void MacroAssembler::CheckPageFlag( |
} |
-void MacroAssembler::JumpIfBlack(Register object, |
- Register bitmap_scratch, |
- Register mask_scratch, |
- Label* on_black, |
- Label::Distance on_black_distance) { |
+void MacroAssembler::JumpIfBlack(Register object, Register scratch0, |
+ Register scratch1, Label* on_black, |
+ Label::Distance on_black_near) { |
ulan
2016/01/05 14:45:23
let's keep the old name for on_black_distance.
Hannes Payer (out of office)
2016/01/07 20:17:33
Done.
|
+ HasColor(object, scratch0, scratch1, on_black, on_black_near, 1, |
+ 1); // kBlackBitPattern. |
+ DCHECK(strcmp(Marking::kBlackBitPattern, "11") == 0); |
+} |
+ |
+ |
+void MacroAssembler::HasColor(Register object, Register bitmap_scratch, |
+ Register mask_scratch, Label* has_color, |
+ Label::Distance has_color_distance, int first_bit, |
+ int second_bit) { |
DCHECK(!AreAliased(object, bitmap_scratch, mask_scratch, rcx)); |
+ |
GetMarkBits(object, bitmap_scratch, mask_scratch); |
- DCHECK(strcmp(Marking::kBlackBitPattern, "10") == 0); |
- // The mask_scratch register contains a 1 at the position of the first bit |
- // and a 0 at all other positions, including the position of the second bit. |
- movp(rcx, mask_scratch); |
- // Make rcx into a mask that covers both marking bits using the operation |
- // rcx = mask | (mask << 1). |
- leap(rcx, Operand(mask_scratch, mask_scratch, times_2, 0)); |
- // Note that we are using a 4-byte aligned 8-byte load. |
ulan
2016/01/05 14:45:23
// This change here should be sufficient to conver
Hannes Payer (out of office)
2016/01/07 20:17:33
Not sure what you mean here? Should I bring back t
Hannes Payer (out of office)
2016/01/11 12:24:32
After discussing offline, I kept x64 special and s
|
- andp(rcx, Operand(bitmap_scratch, MemoryChunk::kHeaderSize)); |
- cmpp(mask_scratch, rcx); |
- j(equal, on_black, on_black_distance); |
+ Label other_color, word_boundary; |
+ testp(Operand(bitmap_scratch, MemoryChunk::kHeaderSize), mask_scratch); |
+ j(first_bit == 1 ? zero : not_zero, &other_color, Label::kNear); |
+ shlp(mask_scratch, Immediate(1)); |
+ j(zero, &word_boundary, Label::kNear); |
+ testp(Operand(bitmap_scratch, MemoryChunk::kHeaderSize), mask_scratch); |
+ j(second_bit == 1 ? not_zero : zero, has_color, has_color_distance); |
+ jmp(&other_color, Label::kNear); |
+ |
+ bind(&word_boundary); |
+ testb(Operand(bitmap_scratch, MemoryChunk::kHeaderSize + kPointerSize), |
+ Immediate(1)); |
+ |
+ j(second_bit == 1 ? not_zero : zero, has_color, has_color_distance); |
+ bind(&other_color); |
} |
@@ -5321,7 +5334,7 @@ void MacroAssembler::GetMarkBits(Register addr_reg, |
movp(rcx, addr_reg); |
shrl(rcx, Immediate(kPointerSizeLog2)); |
andp(rcx, Immediate((1 << Bitmap::kBitsPerCellLog2) - 1)); |
- movl(mask_reg, Immediate(1)); |
+ movl(mask_reg, Immediate(3)); |
shlp_cl(mask_reg); |
} |
@@ -5334,8 +5347,8 @@ void MacroAssembler::JumpIfWhite(Register value, Register bitmap_scratch, |
// If the value is black or grey we don't need to do anything. |
DCHECK(strcmp(Marking::kWhiteBitPattern, "00") == 0); |
- DCHECK(strcmp(Marking::kBlackBitPattern, "10") == 0); |
- DCHECK(strcmp(Marking::kGreyBitPattern, "11") == 0); |
+ DCHECK(strcmp(Marking::kBlackBitPattern, "11") == 0); |
+ DCHECK(strcmp(Marking::kGreyBitPattern, "10") == 0); |
DCHECK(strcmp(Marking::kImpossibleBitPattern, "01") == 0); |
// Since both black and grey have a 1 in the first position and white does |