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

Unified Diff: src/arm64/macro-assembler-arm64.cc

Issue 1475823003: [runtime] First step to sanitize regexp literal creation. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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
Index: src/arm64/macro-assembler-arm64.cc
diff --git a/src/arm64/macro-assembler-arm64.cc b/src/arm64/macro-assembler-arm64.cc
index a27f625c5e2ea0e4858e4c018ab0fbbe67e91b1f..d84975c40d441fd1bbeed8dd457855b7b01d5d15 100644
--- a/src/arm64/macro-assembler-arm64.cc
+++ b/src/arm64/macro-assembler-arm64.cc
@@ -2153,152 +2153,6 @@ void MacroAssembler::ClampDoubleToUint8(Register output,
}
-void MacroAssembler::CopyFieldsLoopPairsHelper(Register dst,
- Register src,
- unsigned count,
- Register scratch1,
- Register scratch2,
- Register scratch3,
- Register scratch4,
- Register scratch5) {
- // Untag src and dst into scratch registers.
- // Copy src->dst in a tight loop.
- DCHECK(!AreAliased(dst, src,
- scratch1, scratch2, scratch3, scratch4, scratch5));
- DCHECK(count >= 2);
-
- const Register& remaining = scratch3;
- Mov(remaining, count / 2);
-
- const Register& dst_untagged = scratch1;
- const Register& src_untagged = scratch2;
- Sub(dst_untagged, dst, kHeapObjectTag);
- Sub(src_untagged, src, kHeapObjectTag);
-
- // Copy fields in pairs.
- Label loop;
- Bind(&loop);
- Ldp(scratch4, scratch5,
- MemOperand(src_untagged, kXRegSize* 2, PostIndex));
- Stp(scratch4, scratch5,
- MemOperand(dst_untagged, kXRegSize* 2, PostIndex));
- Sub(remaining, remaining, 1);
- Cbnz(remaining, &loop);
-
- // Handle the leftovers.
- if (count & 1) {
- Ldr(scratch4, MemOperand(src_untagged));
- Str(scratch4, MemOperand(dst_untagged));
- }
-}
-
-
-void MacroAssembler::CopyFieldsUnrolledPairsHelper(Register dst,
- Register src,
- unsigned count,
- Register scratch1,
- Register scratch2,
- Register scratch3,
- Register scratch4) {
- // Untag src and dst into scratch registers.
- // Copy src->dst in an unrolled loop.
- DCHECK(!AreAliased(dst, src, scratch1, scratch2, scratch3, scratch4));
-
- const Register& dst_untagged = scratch1;
- const Register& src_untagged = scratch2;
- sub(dst_untagged, dst, kHeapObjectTag);
- sub(src_untagged, src, kHeapObjectTag);
-
- // Copy fields in pairs.
- for (unsigned i = 0; i < count / 2; i++) {
- Ldp(scratch3, scratch4, MemOperand(src_untagged, kXRegSize * 2, PostIndex));
- Stp(scratch3, scratch4, MemOperand(dst_untagged, kXRegSize * 2, PostIndex));
- }
-
- // Handle the leftovers.
- if (count & 1) {
- Ldr(scratch3, MemOperand(src_untagged));
- Str(scratch3, MemOperand(dst_untagged));
- }
-}
-
-
-void MacroAssembler::CopyFieldsUnrolledHelper(Register dst,
- Register src,
- unsigned count,
- Register scratch1,
- Register scratch2,
- Register scratch3) {
- // Untag src and dst into scratch registers.
- // Copy src->dst in an unrolled loop.
- DCHECK(!AreAliased(dst, src, scratch1, scratch2, scratch3));
-
- const Register& dst_untagged = scratch1;
- const Register& src_untagged = scratch2;
- Sub(dst_untagged, dst, kHeapObjectTag);
- Sub(src_untagged, src, kHeapObjectTag);
-
- // Copy fields one by one.
- for (unsigned i = 0; i < count; i++) {
- Ldr(scratch3, MemOperand(src_untagged, kXRegSize, PostIndex));
- Str(scratch3, MemOperand(dst_untagged, kXRegSize, PostIndex));
- }
-}
-
-
-void MacroAssembler::CopyFields(Register dst, Register src, CPURegList temps,
- unsigned count) {
- // One of two methods is used:
- //
- // For high 'count' values where many scratch registers are available:
- // Untag src and dst into scratch registers.
- // Copy src->dst in a tight loop.
- //
- // For low 'count' values or where few scratch registers are available:
- // Untag src and dst into scratch registers.
- // Copy src->dst in an unrolled loop.
- //
- // In both cases, fields are copied in pairs if possible, and left-overs are
- // handled separately.
- DCHECK(!AreAliased(dst, src));
- DCHECK(!temps.IncludesAliasOf(dst));
- DCHECK(!temps.IncludesAliasOf(src));
- DCHECK(!temps.IncludesAliasOf(xzr));
-
- if (emit_debug_code()) {
- Cmp(dst, src);
- Check(ne, kTheSourceAndDestinationAreTheSame);
- }
-
- // The value of 'count' at which a loop will be generated (if there are
- // enough scratch registers).
- static const unsigned kLoopThreshold = 8;
-
- UseScratchRegisterScope masm_temps(this);
- if ((temps.Count() >= 3) && (count >= kLoopThreshold)) {
- CopyFieldsLoopPairsHelper(dst, src, count,
- Register(temps.PopLowestIndex()),
- Register(temps.PopLowestIndex()),
- Register(temps.PopLowestIndex()),
- masm_temps.AcquireX(),
- masm_temps.AcquireX());
- } else if (temps.Count() >= 2) {
- CopyFieldsUnrolledPairsHelper(dst, src, count,
- Register(temps.PopLowestIndex()),
- Register(temps.PopLowestIndex()),
- masm_temps.AcquireX(),
- masm_temps.AcquireX());
- } else if (temps.Count() == 1) {
- CopyFieldsUnrolledHelper(dst, src, count,
- Register(temps.PopLowestIndex()),
- masm_temps.AcquireX(),
- masm_temps.AcquireX());
- } else {
- UNREACHABLE();
- }
-}
-
-
void MacroAssembler::CopyBytes(Register dst,
Register src,
Register length,

Powered by Google App Engine
This is Rietveld 408576698