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

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

Issue 1542113002: Do not mark from native code. Check color and call incremental marker instead. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 12 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/arm/macro-assembler-arm.h ('k') | src/arm64/code-stubs-arm64.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 #include <limits.h> // For LONG_MIN, LONG_MAX. 5 #include <limits.h> // For LONG_MIN, LONG_MAX.
6 6
7 #if V8_TARGET_ARCH_ARM 7 #if V8_TARGET_ARCH_ARM
8 8
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/base/division-by-constant.h" 10 #include "src/base/division-by-constant.h"
(...skipping 3257 matching lines...) Expand 10 before | Expand all | Expand 10 after
3268 jmp(&other_color); 3268 jmp(&other_color);
3269 3269
3270 bind(&word_boundary); 3270 bind(&word_boundary);
3271 ldr(ip, MemOperand(bitmap_scratch, MemoryChunk::kHeaderSize + kPointerSize)); 3271 ldr(ip, MemOperand(bitmap_scratch, MemoryChunk::kHeaderSize + kPointerSize));
3272 tst(ip, Operand(1)); 3272 tst(ip, Operand(1));
3273 b(second_bit == 1 ? ne : eq, has_color); 3273 b(second_bit == 1 ? ne : eq, has_color);
3274 bind(&other_color); 3274 bind(&other_color);
3275 } 3275 }
3276 3276
3277 3277
3278 // Detect some, but not all, common pointer-free objects. This is used by the
3279 // incremental write barrier which doesn't care about oddballs (they are always
3280 // marked black immediately so this code is not hit).
3281 void MacroAssembler::JumpIfDataObject(Register value,
3282 Register scratch,
3283 Label* not_data_object) {
3284 Label is_data_object;
3285 ldr(scratch, FieldMemOperand(value, HeapObject::kMapOffset));
3286 CompareRoot(scratch, Heap::kHeapNumberMapRootIndex);
3287 b(eq, &is_data_object);
3288 DCHECK(kIsIndirectStringTag == 1 && kIsIndirectStringMask == 1);
3289 DCHECK(kNotStringTag == 0x80 && kIsNotStringMask == 0x80);
3290 // If it's a string and it's not a cons string then it's an object containing
3291 // no GC pointers.
3292 ldrb(scratch, FieldMemOperand(scratch, Map::kInstanceTypeOffset));
3293 tst(scratch, Operand(kIsIndirectStringMask | kIsNotStringMask));
3294 b(ne, not_data_object);
3295 bind(&is_data_object);
3296 }
3297
3298
3299 void MacroAssembler::GetMarkBits(Register addr_reg, 3278 void MacroAssembler::GetMarkBits(Register addr_reg,
3300 Register bitmap_reg, 3279 Register bitmap_reg,
3301 Register mask_reg) { 3280 Register mask_reg) {
3302 DCHECK(!AreAliased(addr_reg, bitmap_reg, mask_reg, no_reg)); 3281 DCHECK(!AreAliased(addr_reg, bitmap_reg, mask_reg, no_reg));
3303 and_(bitmap_reg, addr_reg, Operand(~Page::kPageAlignmentMask)); 3282 and_(bitmap_reg, addr_reg, Operand(~Page::kPageAlignmentMask));
3304 Ubfx(mask_reg, addr_reg, kPointerSizeLog2, Bitmap::kBitsPerCellLog2); 3283 Ubfx(mask_reg, addr_reg, kPointerSizeLog2, Bitmap::kBitsPerCellLog2);
3305 const int kLowBits = kPointerSizeLog2 + Bitmap::kBitsPerCellLog2; 3284 const int kLowBits = kPointerSizeLog2 + Bitmap::kBitsPerCellLog2;
3306 Ubfx(ip, addr_reg, kLowBits, kPageSizeBits - kLowBits); 3285 Ubfx(ip, addr_reg, kLowBits, kPageSizeBits - kLowBits);
3307 add(bitmap_reg, bitmap_reg, Operand(ip, LSL, kPointerSizeLog2)); 3286 add(bitmap_reg, bitmap_reg, Operand(ip, LSL, kPointerSizeLog2));
3308 mov(ip, Operand(1)); 3287 mov(ip, Operand(1));
3309 mov(mask_reg, Operand(ip, LSL, mask_reg)); 3288 mov(mask_reg, Operand(ip, LSL, mask_reg));
3310 } 3289 }
3311 3290
3312 3291
3313 void MacroAssembler::EnsureNotWhite( 3292 void MacroAssembler::JumpIfWhite(Register value, Register bitmap_scratch,
3314 Register value, 3293 Register mask_scratch, Register load_scratch,
3315 Register bitmap_scratch, 3294 Label* value_is_white) {
3316 Register mask_scratch,
3317 Register load_scratch,
3318 Label* value_is_white_and_not_data) {
3319 DCHECK(!AreAliased(value, bitmap_scratch, mask_scratch, ip)); 3295 DCHECK(!AreAliased(value, bitmap_scratch, mask_scratch, ip));
3320 GetMarkBits(value, bitmap_scratch, mask_scratch); 3296 GetMarkBits(value, bitmap_scratch, mask_scratch);
3321 3297
3322 // If the value is black or grey we don't need to do anything. 3298 // If the value is black or grey we don't need to do anything.
3323 DCHECK(strcmp(Marking::kWhiteBitPattern, "00") == 0); 3299 DCHECK(strcmp(Marking::kWhiteBitPattern, "00") == 0);
3324 DCHECK(strcmp(Marking::kBlackBitPattern, "10") == 0); 3300 DCHECK(strcmp(Marking::kBlackBitPattern, "10") == 0);
3325 DCHECK(strcmp(Marking::kGreyBitPattern, "11") == 0); 3301 DCHECK(strcmp(Marking::kGreyBitPattern, "11") == 0);
3326 DCHECK(strcmp(Marking::kImpossibleBitPattern, "01") == 0); 3302 DCHECK(strcmp(Marking::kImpossibleBitPattern, "01") == 0);
3327 3303
3328 Label done;
3329
3330 // Since both black and grey have a 1 in the first position and white does 3304 // Since both black and grey have a 1 in the first position and white does
3331 // not have a 1 there we only need to check one bit. 3305 // not have a 1 there we only need to check one bit.
3332 ldr(load_scratch, MemOperand(bitmap_scratch, MemoryChunk::kHeaderSize)); 3306 ldr(load_scratch, MemOperand(bitmap_scratch, MemoryChunk::kHeaderSize));
3333 tst(mask_scratch, load_scratch); 3307 tst(mask_scratch, load_scratch);
3334 b(ne, &done); 3308 b(eq, value_is_white);
3335
3336 if (emit_debug_code()) {
3337 // Check for impossible bit pattern.
3338 Label ok;
3339 // LSL may overflow, making the check conservative.
3340 tst(load_scratch, Operand(mask_scratch, LSL, 1));
3341 b(eq, &ok);
3342 stop("Impossible marking bit pattern");
3343 bind(&ok);
3344 }
3345
3346 // Value is white. We check whether it is data that doesn't need scanning.
3347 // Currently only checks for HeapNumber and non-cons strings.
3348 Register map = load_scratch; // Holds map while checking type.
3349 Register length = load_scratch; // Holds length of object after testing type.
3350 Label is_data_object;
3351
3352 // Check for heap-number
3353 ldr(map, FieldMemOperand(value, HeapObject::kMapOffset));
3354 CompareRoot(map, Heap::kHeapNumberMapRootIndex);
3355 mov(length, Operand(HeapNumber::kSize), LeaveCC, eq);
3356 b(eq, &is_data_object);
3357
3358 // Check for strings.
3359 DCHECK(kIsIndirectStringTag == 1 && kIsIndirectStringMask == 1);
3360 DCHECK(kNotStringTag == 0x80 && kIsNotStringMask == 0x80);
3361 // If it's a string and it's not a cons string then it's an object containing
3362 // no GC pointers.
3363 Register instance_type = load_scratch;
3364 ldrb(instance_type, FieldMemOperand(map, Map::kInstanceTypeOffset));
3365 tst(instance_type, Operand(kIsIndirectStringMask | kIsNotStringMask));
3366 b(ne, value_is_white_and_not_data);
3367 // It's a non-indirect (non-cons and non-slice) string.
3368 // If it's external, the length is just ExternalString::kSize.
3369 // Otherwise it's String::kHeaderSize + string->length() * (1 or 2).
3370 // External strings are the only ones with the kExternalStringTag bit
3371 // set.
3372 DCHECK_EQ(0, kSeqStringTag & kExternalStringTag);
3373 DCHECK_EQ(0, kConsStringTag & kExternalStringTag);
3374 tst(instance_type, Operand(kExternalStringTag));
3375 mov(length, Operand(ExternalString::kSize), LeaveCC, ne);
3376 b(ne, &is_data_object);
3377
3378 // Sequential string, either Latin1 or UC16.
3379 // For Latin1 (char-size of 1) we shift the smi tag away to get the length.
3380 // For UC16 (char-size of 2) we just leave the smi tag in place, thereby
3381 // getting the length multiplied by 2.
3382 DCHECK(kOneByteStringTag == 4 && kStringEncodingMask == 4);
3383 DCHECK(kSmiTag == 0 && kSmiTagSize == 1);
3384 ldr(ip, FieldMemOperand(value, String::kLengthOffset));
3385 tst(instance_type, Operand(kStringEncodingMask));
3386 mov(ip, Operand(ip, LSR, 1), LeaveCC, ne);
3387 add(length, ip, Operand(SeqString::kHeaderSize + kObjectAlignmentMask));
3388 and_(length, length, Operand(~kObjectAlignmentMask));
3389
3390 bind(&is_data_object);
3391 // Value is a data object, and it is white. Mark it black. Since we know
3392 // that the object is white we can make it black by flipping one bit.
3393 ldr(ip, MemOperand(bitmap_scratch, MemoryChunk::kHeaderSize));
3394 orr(ip, ip, Operand(mask_scratch));
3395 str(ip, MemOperand(bitmap_scratch, MemoryChunk::kHeaderSize));
3396
3397 and_(bitmap_scratch, bitmap_scratch, Operand(~Page::kPageAlignmentMask));
3398 ldr(ip, MemOperand(bitmap_scratch, MemoryChunk::kLiveBytesOffset));
3399 add(ip, ip, Operand(length));
3400 str(ip, MemOperand(bitmap_scratch, MemoryChunk::kLiveBytesOffset));
3401
3402 bind(&done);
3403 } 3309 }
3404 3310
3405 3311
3406 void MacroAssembler::ClampUint8(Register output_reg, Register input_reg) { 3312 void MacroAssembler::ClampUint8(Register output_reg, Register input_reg) {
3407 Usat(output_reg, 8, Operand(input_reg)); 3313 Usat(output_reg, 8, Operand(input_reg));
3408 } 3314 }
3409 3315
3410 3316
3411 void MacroAssembler::ClampDoubleToUint8(Register result_reg, 3317 void MacroAssembler::ClampDoubleToUint8(Register result_reg,
3412 DwVfpRegister input_reg, 3318 DwVfpRegister input_reg,
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
3682 } 3588 }
3683 } 3589 }
3684 if (mag.shift > 0) mov(result, Operand(result, ASR, mag.shift)); 3590 if (mag.shift > 0) mov(result, Operand(result, ASR, mag.shift));
3685 add(result, result, Operand(dividend, LSR, 31)); 3591 add(result, result, Operand(dividend, LSR, 31));
3686 } 3592 }
3687 3593
3688 } // namespace internal 3594 } // namespace internal
3689 } // namespace v8 3595 } // namespace v8
3690 3596
3691 #endif // V8_TARGET_ARCH_ARM 3597 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/macro-assembler-arm.h ('k') | src/arm64/code-stubs-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698