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

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

Issue 1459083003: Fix object initialization when slack tracking for it's map is still enabled. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@toon
Patch Set: Fixed second nit in all platforms Created 5 years, 1 month 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/mips/macro-assembler-mips.h ('k') | src/mips64/builtins-mips64.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 1
2 // Copyright 2012 the V8 project authors. All rights reserved. 2 // Copyright 2012 the V8 project authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be 3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file. 4 // found in the LICENSE file.
5 5
6 #include <limits.h> // For LONG_MIN, LONG_MAX. 6 #include <limits.h> // For LONG_MIN, LONG_MAX.
7 7
8 #if V8_TARGET_ARCH_MIPS 8 #if V8_TARGET_ARCH_MIPS
9 9
10 #include "src/base/bits.h" 10 #include "src/base/bits.h"
(...skipping 3329 matching lines...) Expand 10 before | Expand all | Expand 10 after
3340 Branch(gc_required, Ugreater, scratch2, Operand(t9)); 3340 Branch(gc_required, Ugreater, scratch2, Operand(t9));
3341 sw(scratch2, MemOperand(topaddr)); 3341 sw(scratch2, MemOperand(topaddr));
3342 3342
3343 // Tag object if requested. 3343 // Tag object if requested.
3344 if ((flags & TAG_OBJECT) != 0) { 3344 if ((flags & TAG_OBJECT) != 0) {
3345 Addu(result, result, Operand(kHeapObjectTag)); 3345 Addu(result, result, Operand(kHeapObjectTag));
3346 } 3346 }
3347 } 3347 }
3348 3348
3349 3349
3350 void MacroAssembler::Allocate(Register object_size, 3350 void MacroAssembler::Allocate(Register object_size, Register result,
3351 Register result, 3351 Register result_end, Register scratch1,
3352 Register scratch1, 3352 Label* gc_required, AllocationFlags flags) {
3353 Register scratch2,
3354 Label* gc_required,
3355 AllocationFlags flags) {
3356 if (!FLAG_inline_new) { 3353 if (!FLAG_inline_new) {
3357 if (emit_debug_code()) { 3354 if (emit_debug_code()) {
3358 // Trash the registers to simulate an allocation failure. 3355 // Trash the registers to simulate an allocation failure.
3359 li(result, 0x7091); 3356 li(result, 0x7091);
3360 li(scratch1, 0x7191); 3357 li(scratch1, 0x7191);
3361 li(scratch2, 0x7291); 3358 li(result_end, 0x7291);
3362 } 3359 }
3363 jmp(gc_required); 3360 jmp(gc_required);
3364 return; 3361 return;
3365 } 3362 }
3366 3363
3367 DCHECK(!result.is(scratch1)); 3364 DCHECK(!result.is(scratch1));
3368 DCHECK(!result.is(scratch2)); 3365 DCHECK(!result.is(result_end));
3369 DCHECK(!scratch1.is(scratch2)); 3366 DCHECK(!scratch1.is(result_end));
3370 DCHECK(!object_size.is(t9)); 3367 DCHECK(!object_size.is(t9));
3371 DCHECK(!scratch1.is(t9) && !scratch2.is(t9) && !result.is(t9)); 3368 DCHECK(!scratch1.is(t9) && !result_end.is(t9) && !result.is(t9));
3372 3369
3373 // Check relative positions of allocation top and limit addresses. 3370 // Check relative positions of allocation top and limit addresses.
3374 // ARM adds additional checks to make sure the ldm instruction can be 3371 // ARM adds additional checks to make sure the ldm instruction can be
3375 // used. On MIPS we don't have ldm so we don't need additional checks either. 3372 // used. On MIPS we don't have ldm so we don't need additional checks either.
3376 ExternalReference allocation_top = 3373 ExternalReference allocation_top =
3377 AllocationUtils::GetAllocationTopReference(isolate(), flags); 3374 AllocationUtils::GetAllocationTopReference(isolate(), flags);
3378 ExternalReference allocation_limit = 3375 ExternalReference allocation_limit =
3379 AllocationUtils::GetAllocationLimitReference(isolate(), flags); 3376 AllocationUtils::GetAllocationLimitReference(isolate(), flags);
3380 intptr_t top = 3377 intptr_t top =
3381 reinterpret_cast<intptr_t>(allocation_top.address()); 3378 reinterpret_cast<intptr_t>(allocation_top.address());
(...skipping 19 matching lines...) Expand all
3401 Check(eq, kUnexpectedAllocationTop, result, Operand(t9)); 3398 Check(eq, kUnexpectedAllocationTop, result, Operand(t9));
3402 } 3399 }
3403 // Load allocation limit into t9. Result already contains allocation top. 3400 // Load allocation limit into t9. Result already contains allocation top.
3404 lw(t9, MemOperand(topaddr, limit - top)); 3401 lw(t9, MemOperand(topaddr, limit - top));
3405 } 3402 }
3406 3403
3407 if ((flags & DOUBLE_ALIGNMENT) != 0) { 3404 if ((flags & DOUBLE_ALIGNMENT) != 0) {
3408 // Align the next allocation. Storing the filler map without checking top is 3405 // Align the next allocation. Storing the filler map without checking top is
3409 // safe in new-space because the limit of the heap is aligned there. 3406 // safe in new-space because the limit of the heap is aligned there.
3410 DCHECK(kPointerAlignment * 2 == kDoubleAlignment); 3407 DCHECK(kPointerAlignment * 2 == kDoubleAlignment);
3411 And(scratch2, result, Operand(kDoubleAlignmentMask)); 3408 And(result_end, result, Operand(kDoubleAlignmentMask));
3412 Label aligned; 3409 Label aligned;
3413 Branch(&aligned, eq, scratch2, Operand(zero_reg)); 3410 Branch(&aligned, eq, result_end, Operand(zero_reg));
3414 if ((flags & PRETENURE) != 0) { 3411 if ((flags & PRETENURE) != 0) {
3415 Branch(gc_required, Ugreater_equal, result, Operand(t9)); 3412 Branch(gc_required, Ugreater_equal, result, Operand(t9));
3416 } 3413 }
3417 li(scratch2, Operand(isolate()->factory()->one_pointer_filler_map())); 3414 li(result_end, Operand(isolate()->factory()->one_pointer_filler_map()));
3418 sw(scratch2, MemOperand(result)); 3415 sw(result_end, MemOperand(result));
3419 Addu(result, result, Operand(kDoubleSize / 2)); 3416 Addu(result, result, Operand(kDoubleSize / 2));
3420 bind(&aligned); 3417 bind(&aligned);
3421 } 3418 }
3422 3419
3423 // Calculate new top and bail out if new space is exhausted. Use result 3420 // Calculate new top and bail out if new space is exhausted. Use result
3424 // to calculate the new top. Object size may be in words so a shift is 3421 // to calculate the new top. Object size may be in words so a shift is
3425 // required to get the number of bytes. 3422 // required to get the number of bytes.
3426 if ((flags & SIZE_IN_WORDS) != 0) { 3423 if ((flags & SIZE_IN_WORDS) != 0) {
3427 sll(scratch2, object_size, kPointerSizeLog2); 3424 sll(result_end, object_size, kPointerSizeLog2);
3428 Addu(scratch2, result, scratch2); 3425 Addu(result_end, result, result_end);
3429 } else { 3426 } else {
3430 Addu(scratch2, result, Operand(object_size)); 3427 Addu(result_end, result, Operand(object_size));
3431 } 3428 }
3432 Branch(gc_required, Ugreater, scratch2, Operand(t9)); 3429 Branch(gc_required, Ugreater, result_end, Operand(t9));
3433 3430
3434 // Update allocation top. result temporarily holds the new top. 3431 // Update allocation top. result temporarily holds the new top.
3435 if (emit_debug_code()) { 3432 if (emit_debug_code()) {
3436 And(t9, scratch2, Operand(kObjectAlignmentMask)); 3433 And(t9, result_end, Operand(kObjectAlignmentMask));
3437 Check(eq, kUnalignedAllocationInNewSpace, t9, Operand(zero_reg)); 3434 Check(eq, kUnalignedAllocationInNewSpace, t9, Operand(zero_reg));
3438 } 3435 }
3439 sw(scratch2, MemOperand(topaddr)); 3436 sw(result_end, MemOperand(topaddr));
3440 3437
3441 // Tag object if requested. 3438 // Tag object if requested.
3442 if ((flags & TAG_OBJECT) != 0) { 3439 if ((flags & TAG_OBJECT) != 0) {
3443 Addu(result, result, Operand(kHeapObjectTag)); 3440 Addu(result, result, Operand(kHeapObjectTag));
3444 } 3441 }
3445 } 3442 }
3446 3443
3447 3444
3448 void MacroAssembler::AllocateTwoByteString(Register result, 3445 void MacroAssembler::AllocateTwoByteString(Register result,
3449 Register length, 3446 Register length,
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
3699 lbu(scratch, MemOperand(src)); 3696 lbu(scratch, MemOperand(src));
3700 Addu(src, src, 1); 3697 Addu(src, src, 1);
3701 sb(scratch, MemOperand(dst)); 3698 sb(scratch, MemOperand(dst));
3702 Addu(dst, dst, 1); 3699 Addu(dst, dst, 1);
3703 Subu(length, length, Operand(1)); 3700 Subu(length, length, Operand(1));
3704 Branch(&byte_loop_1, ne, length, Operand(zero_reg)); 3701 Branch(&byte_loop_1, ne, length, Operand(zero_reg));
3705 bind(&done); 3702 bind(&done);
3706 } 3703 }
3707 3704
3708 3705
3709 void MacroAssembler::InitializeFieldsWithFiller(Register start_offset, 3706 void MacroAssembler::InitializeFieldsWithFiller(Register current_address,
3710 Register end_offset, 3707 Register end_address,
3711 Register filler) { 3708 Register filler) {
3712 Label loop, entry; 3709 Label loop, entry;
3713 Branch(&entry); 3710 Branch(&entry);
3714 bind(&loop); 3711 bind(&loop);
3715 sw(filler, MemOperand(start_offset)); 3712 sw(filler, MemOperand(current_address));
3716 Addu(start_offset, start_offset, kPointerSize); 3713 Addu(current_address, current_address, kPointerSize);
3717 bind(&entry); 3714 bind(&entry);
3718 Branch(&loop, ult, start_offset, Operand(end_offset)); 3715 Branch(&loop, ult, current_address, Operand(end_address));
3719 } 3716 }
3720 3717
3721 3718
3722 void MacroAssembler::CheckFastElements(Register map, 3719 void MacroAssembler::CheckFastElements(Register map,
3723 Register scratch, 3720 Register scratch,
3724 Label* fail) { 3721 Label* fail) {
3725 STATIC_ASSERT(FAST_SMI_ELEMENTS == 0); 3722 STATIC_ASSERT(FAST_SMI_ELEMENTS == 0);
3726 STATIC_ASSERT(FAST_HOLEY_SMI_ELEMENTS == 1); 3723 STATIC_ASSERT(FAST_HOLEY_SMI_ELEMENTS == 1);
3727 STATIC_ASSERT(FAST_ELEMENTS == 2); 3724 STATIC_ASSERT(FAST_ELEMENTS == 2);
3728 STATIC_ASSERT(FAST_HOLEY_ELEMENTS == 3); 3725 STATIC_ASSERT(FAST_HOLEY_ELEMENTS == 3);
(...skipping 2128 matching lines...) Expand 10 before | Expand all | Expand 10 after
5857 if (mag.shift > 0) sra(result, result, mag.shift); 5854 if (mag.shift > 0) sra(result, result, mag.shift);
5858 srl(at, dividend, 31); 5855 srl(at, dividend, 31);
5859 Addu(result, result, Operand(at)); 5856 Addu(result, result, Operand(at));
5860 } 5857 }
5861 5858
5862 5859
5863 } // namespace internal 5860 } // namespace internal
5864 } // namespace v8 5861 } // namespace v8
5865 5862
5866 #endif // V8_TARGET_ARCH_MIPS 5863 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/mips/macro-assembler-mips.h ('k') | src/mips64/builtins-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698