Index: src/arm/macro-assembler-arm.cc |
diff --git a/src/arm/macro-assembler-arm.cc b/src/arm/macro-assembler-arm.cc |
index ad22cd940ac5a1ad1851880cf04acc3e206b5adb..9c25ccde2f8cd52e6f5b9f85162715e1e35631c3 100644 |
--- a/src/arm/macro-assembler-arm.cc |
+++ b/src/arm/macro-assembler-arm.cc |
@@ -1728,6 +1728,34 @@ void MacroAssembler::AllocateHeapNumberWithValue(Register result, |
} |
+// Copies a fixed number of fields of heap objects from src to dst. |
+void MacroAssembler::CopyFields(Register dst, |
+ Register src, |
+ RegList temps, |
+ int field_count) { |
+ // At least one bit set in the first 15 registers. |
+ ASSERT((temps & ((1 << 15) - 1)) != 0); |
+ ASSERT((temps & dst.bit()) == 0); |
+ ASSERT((temps & src.bit()) == 0); |
+ // Primitive implementation using only one temporary register. |
+ |
+ Register tmp = no_reg; |
+ // Find a temp register in temps list. |
+ for (int i = 0; i < 15; i++) { |
+ if ((temps & (1 << i)) != 0) { |
+ tmp.set_code(i); |
+ break; |
+ } |
+ } |
+ ASSERT(!tmp.is(no_reg)); |
+ |
+ for (int i = 0; i < field_count; i++) { |
+ ldr(tmp, FieldMemOperand(src, i * kPointerSize)); |
+ str(tmp, FieldMemOperand(dst, i * kPointerSize)); |
+ } |
+} |
+ |
+ |
void MacroAssembler::CountLeadingZeros(Register zeros, // Answer. |
Register source, // Input. |
Register scratch) { |