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

Unified Diff: src/arm64/macro-assembler-arm64.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/arm64/macro-assembler-arm64.h ('k') | src/crankshaft/arm64/lithium-codegen-arm64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/arm64/macro-assembler-arm64.cc
diff --git a/src/arm64/macro-assembler-arm64.cc b/src/arm64/macro-assembler-arm64.cc
index 5b941a2a5a53648433605d6deb502bd7539e0622..e21903d087b3a4bcb851cdb17291405a52527372 100644
--- a/src/arm64/macro-assembler-arm64.cc
+++ b/src/arm64/macro-assembler-arm64.cc
@@ -2354,38 +2354,35 @@ void MacroAssembler::CopyBytes(Register dst,
}
-void MacroAssembler::FillFields(Register dst,
- Register field_count,
- Register filler) {
- DCHECK(!dst.Is(csp));
+void MacroAssembler::InitializeFieldsWithFiller(Register current_address,
+ Register end_address,
+ Register filler) {
+ DCHECK(!current_address.Is(csp));
UseScratchRegisterScope temps(this);
- Register field_ptr = temps.AcquireX();
- Register counter = temps.AcquireX();
+ Register distance_in_words = temps.AcquireX();
Label done;
- // Decrement count. If the result < zero, count was zero, and there's nothing
- // to do. If count was one, flags are set to fail the gt condition at the end
- // of the pairs loop.
- Subs(counter, field_count, 1);
- B(lt, &done);
+ // Calculate the distance. If it's <= zero then there's nothing to do.
+ Subs(distance_in_words, end_address, current_address);
+ B(le, &done);
// There's at least one field to fill, so do this unconditionally.
- Str(filler, MemOperand(dst, kPointerSize, PostIndex));
+ Str(filler, MemOperand(current_address));
- // If the bottom bit of counter is set, there are an even number of fields to
- // fill, so pull the start pointer back by one field, allowing the pairs loop
- // to overwrite the field that was stored above.
- And(field_ptr, counter, 1);
- Sub(field_ptr, dst, Operand(field_ptr, LSL, kPointerSizeLog2));
+ // If the distance_in_words consists of odd number of words we advance
+ // start_address by one word, otherwise the pairs loop will ovwerite the
+ // field that was stored above.
+ And(distance_in_words, distance_in_words, kPointerSize);
+ Add(current_address, current_address, distance_in_words);
// Store filler to memory in pairs.
- Label entry, loop;
+ Label loop, entry;
B(&entry);
Bind(&loop);
- Stp(filler, filler, MemOperand(field_ptr, 2 * kPointerSize, PostIndex));
- Subs(counter, counter, 2);
+ Stp(filler, filler, MemOperand(current_address, 2 * kPointerSize, PostIndex));
Bind(&entry);
- B(gt, &loop);
+ Cmp(current_address, end_address);
+ B(lo, &loop);
Bind(&done);
}
@@ -3120,30 +3117,27 @@ void MacroAssembler::Allocate(int object_size,
}
-void MacroAssembler::Allocate(Register object_size,
- Register result,
- Register scratch1,
- Register scratch2,
- Label* gc_required,
- AllocationFlags flags) {
+void MacroAssembler::Allocate(Register object_size, Register result,
+ Register result_end, Register scratch,
+ Label* gc_required, AllocationFlags flags) {
if (!FLAG_inline_new) {
if (emit_debug_code()) {
// Trash the registers to simulate an allocation failure.
// We apply salt to the original zap value to easily spot the values.
Mov(result, (kDebugZapValue & ~0xffL) | 0x11L);
- Mov(scratch1, (kDebugZapValue & ~0xffL) | 0x21L);
- Mov(scratch2, (kDebugZapValue & ~0xffL) | 0x21L);
+ Mov(scratch, (kDebugZapValue & ~0xffL) | 0x21L);
+ Mov(result_end, (kDebugZapValue & ~0xffL) | 0x21L);
}
B(gc_required);
return;
}
UseScratchRegisterScope temps(this);
- Register scratch3 = temps.AcquireX();
+ Register scratch2 = temps.AcquireX();
- DCHECK(!AreAliased(object_size, result, scratch1, scratch2, scratch3));
- DCHECK(object_size.Is64Bits() && result.Is64Bits() &&
- scratch1.Is64Bits() && scratch2.Is64Bits());
+ DCHECK(!AreAliased(object_size, result, scratch, scratch2, result_end));
+ DCHECK(object_size.Is64Bits() && result.Is64Bits() && scratch.Is64Bits() &&
+ result_end.Is64Bits());
// Check relative positions of allocation top and limit addresses.
// The values must be adjacent in memory to allow the use of LDP.
@@ -3156,7 +3150,7 @@ void MacroAssembler::Allocate(Register object_size,
DCHECK((limit - top) == kPointerSize);
// Set up allocation top address and object size registers.
- Register top_address = scratch1;
+ Register top_address = scratch;
Register allocation_limit = scratch2;
Mov(top_address, heap_allocation_top);
@@ -3166,8 +3160,8 @@ void MacroAssembler::Allocate(Register object_size,
} else {
if (emit_debug_code()) {
// Assert that result actually contains top on entry.
- Ldr(scratch3, MemOperand(top_address));
- Cmp(result, scratch3);
+ Ldr(result_end, MemOperand(top_address));
+ Cmp(result, result_end);
Check(eq, kUnexpectedAllocationTop);
}
// Load the allocation limit. 'result' already contains the allocation top.
@@ -3180,19 +3174,19 @@ void MacroAssembler::Allocate(Register object_size,
// Calculate new top and bail out if new space is exhausted
if ((flags & SIZE_IN_WORDS) != 0) {
- Adds(scratch3, result, Operand(object_size, LSL, kPointerSizeLog2));
+ Adds(result_end, result, Operand(object_size, LSL, kPointerSizeLog2));
} else {
- Adds(scratch3, result, object_size);
+ Adds(result_end, result, object_size);
}
if (emit_debug_code()) {
- Tst(scratch3, kObjectAlignmentMask);
+ Tst(result_end, kObjectAlignmentMask);
Check(eq, kUnalignedAllocationInNewSpace);
}
- Ccmp(scratch3, allocation_limit, CFlag, cc);
+ Ccmp(result_end, allocation_limit, CFlag, cc);
B(hi, gc_required);
- Str(scratch3, MemOperand(top_address));
+ Str(result_end, MemOperand(top_address));
// Tag the object if requested.
if ((flags & TAG_OBJECT) != 0) {
« no previous file with comments | « src/arm64/macro-assembler-arm64.h ('k') | src/crankshaft/arm64/lithium-codegen-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698