Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(565)

Side by Side Diff: src/x64/macro-assembler-x64.cc

Issue 1517993003: [heap] Black is encoded with 11, grey with 10. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/x64/macro-assembler-x64.h ('k') | src/x87/macro-assembler-x87.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #if V8_TARGET_ARCH_X64 5 #if V8_TARGET_ARCH_X64
6 6
7 #include "src/base/bits.h" 7 #include "src/base/bits.h"
8 #include "src/base/division-by-constant.h" 8 #include "src/base/division-by-constant.h"
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 5268 matching lines...) Expand 10 before | Expand all | Expand 10 after
5279 j(cc, condition_met, condition_met_distance); 5279 j(cc, condition_met, condition_met_distance);
5280 } 5280 }
5281 5281
5282 5282
5283 void MacroAssembler::JumpIfBlack(Register object, 5283 void MacroAssembler::JumpIfBlack(Register object,
5284 Register bitmap_scratch, 5284 Register bitmap_scratch,
5285 Register mask_scratch, 5285 Register mask_scratch,
5286 Label* on_black, 5286 Label* on_black,
5287 Label::Distance on_black_distance) { 5287 Label::Distance on_black_distance) {
5288 DCHECK(!AreAliased(object, bitmap_scratch, mask_scratch, rcx)); 5288 DCHECK(!AreAliased(object, bitmap_scratch, mask_scratch, rcx));
5289
5289 GetMarkBits(object, bitmap_scratch, mask_scratch); 5290 GetMarkBits(object, bitmap_scratch, mask_scratch);
5290 5291
5291 DCHECK(strcmp(Marking::kBlackBitPattern, "10") == 0); 5292 DCHECK(strcmp(Marking::kBlackBitPattern, "11") == 0);
5292 // The mask_scratch register contains a 1 at the position of the first bit 5293 // The mask_scratch register contains a 1 at the position of the first bit
5293 // and a 0 at all other positions, including the position of the second bit. 5294 // and a 1 at a position of the second bit. All other positions are zero.
5294 movp(rcx, mask_scratch); 5295 movp(rcx, mask_scratch);
5295 // Make rcx into a mask that covers both marking bits using the operation
5296 // rcx = mask | (mask << 1).
5297 leap(rcx, Operand(mask_scratch, mask_scratch, times_2, 0));
5298 // Note that we are using a 4-byte aligned 8-byte load.
5299 andp(rcx, Operand(bitmap_scratch, MemoryChunk::kHeaderSize)); 5296 andp(rcx, Operand(bitmap_scratch, MemoryChunk::kHeaderSize));
5300 cmpp(mask_scratch, rcx); 5297 cmpp(mask_scratch, rcx);
5301 j(equal, on_black, on_black_distance); 5298 j(equal, on_black, on_black_distance);
5302 } 5299 }
5303 5300
5304 5301
5305 void MacroAssembler::GetMarkBits(Register addr_reg, 5302 void MacroAssembler::GetMarkBits(Register addr_reg,
5306 Register bitmap_reg, 5303 Register bitmap_reg,
5307 Register mask_reg) { 5304 Register mask_reg) {
5308 DCHECK(!AreAliased(addr_reg, bitmap_reg, mask_reg, rcx)); 5305 DCHECK(!AreAliased(addr_reg, bitmap_reg, mask_reg, rcx));
5309 movp(bitmap_reg, addr_reg); 5306 movp(bitmap_reg, addr_reg);
5310 // Sign extended 32 bit immediate. 5307 // Sign extended 32 bit immediate.
5311 andp(bitmap_reg, Immediate(~Page::kPageAlignmentMask)); 5308 andp(bitmap_reg, Immediate(~Page::kPageAlignmentMask));
5312 movp(rcx, addr_reg); 5309 movp(rcx, addr_reg);
5313 int shift = 5310 int shift =
5314 Bitmap::kBitsPerCellLog2 + kPointerSizeLog2 - Bitmap::kBytesPerCellLog2; 5311 Bitmap::kBitsPerCellLog2 + kPointerSizeLog2 - Bitmap::kBytesPerCellLog2;
5315 shrl(rcx, Immediate(shift)); 5312 shrl(rcx, Immediate(shift));
5316 andp(rcx, 5313 andp(rcx,
5317 Immediate((Page::kPageAlignmentMask >> shift) & 5314 Immediate((Page::kPageAlignmentMask >> shift) &
5318 ~(Bitmap::kBytesPerCell - 1))); 5315 ~(Bitmap::kBytesPerCell - 1)));
5319 5316
5320 addp(bitmap_reg, rcx); 5317 addp(bitmap_reg, rcx);
5321 movp(rcx, addr_reg); 5318 movp(rcx, addr_reg);
5322 shrl(rcx, Immediate(kPointerSizeLog2)); 5319 shrl(rcx, Immediate(kPointerSizeLog2));
5323 andp(rcx, Immediate((1 << Bitmap::kBitsPerCellLog2) - 1)); 5320 andp(rcx, Immediate((1 << Bitmap::kBitsPerCellLog2) - 1));
5324 movl(mask_reg, Immediate(1)); 5321 movl(mask_reg, Immediate(3));
5325 shlp_cl(mask_reg); 5322 shlp_cl(mask_reg);
5326 } 5323 }
5327 5324
5328 5325
5329 void MacroAssembler::JumpIfWhite(Register value, Register bitmap_scratch, 5326 void MacroAssembler::JumpIfWhite(Register value, Register bitmap_scratch,
5330 Register mask_scratch, Label* value_is_white, 5327 Register mask_scratch, Label* value_is_white,
5331 Label::Distance distance) { 5328 Label::Distance distance) {
5332 DCHECK(!AreAliased(value, bitmap_scratch, mask_scratch, rcx)); 5329 DCHECK(!AreAliased(value, bitmap_scratch, mask_scratch, rcx));
5333 GetMarkBits(value, bitmap_scratch, mask_scratch); 5330 GetMarkBits(value, bitmap_scratch, mask_scratch);
5334 5331
5335 // If the value is black or grey we don't need to do anything. 5332 // If the value is black or grey we don't need to do anything.
5336 DCHECK(strcmp(Marking::kWhiteBitPattern, "00") == 0); 5333 DCHECK(strcmp(Marking::kWhiteBitPattern, "00") == 0);
5337 DCHECK(strcmp(Marking::kBlackBitPattern, "10") == 0); 5334 DCHECK(strcmp(Marking::kBlackBitPattern, "11") == 0);
5338 DCHECK(strcmp(Marking::kGreyBitPattern, "11") == 0); 5335 DCHECK(strcmp(Marking::kGreyBitPattern, "10") == 0);
5339 DCHECK(strcmp(Marking::kImpossibleBitPattern, "01") == 0); 5336 DCHECK(strcmp(Marking::kImpossibleBitPattern, "01") == 0);
5340 5337
5341 // Since both black and grey have a 1 in the first position and white does 5338 // Since both black and grey have a 1 in the first position and white does
5342 // not have a 1 there we only need to check one bit. 5339 // not have a 1 there we only need to check one bit.
5343 testp(Operand(bitmap_scratch, MemoryChunk::kHeaderSize), mask_scratch); 5340 testp(Operand(bitmap_scratch, MemoryChunk::kHeaderSize), mask_scratch);
5344 j(zero, value_is_white, distance); 5341 j(zero, value_is_white, distance);
5345 } 5342 }
5346 5343
5347 5344
5348 void MacroAssembler::CheckEnumCache(Register null_value, Label* call_runtime) { 5345 void MacroAssembler::CheckEnumCache(Register null_value, Label* call_runtime) {
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
5460 movl(rax, dividend); 5457 movl(rax, dividend);
5461 shrl(rax, Immediate(31)); 5458 shrl(rax, Immediate(31));
5462 addl(rdx, rax); 5459 addl(rdx, rax);
5463 } 5460 }
5464 5461
5465 5462
5466 } // namespace internal 5463 } // namespace internal
5467 } // namespace v8 5464 } // namespace v8
5468 5465
5469 #endif // V8_TARGET_ARCH_X64 5466 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/macro-assembler-x64.h ('k') | src/x87/macro-assembler-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698