Index: src/arm64/macro-assembler-arm64.cc |
diff --git a/src/arm64/macro-assembler-arm64.cc b/src/arm64/macro-assembler-arm64.cc |
index 5067c43a42ef2518befa6eb109cae1f675fe4272..2229747de2dc81a2c5ce17418884e107c55a122f 100644 |
--- a/src/arm64/macro-assembler-arm64.cc |
+++ b/src/arm64/macro-assembler-arm64.cc |
@@ -1574,10 +1574,9 @@ void MacroAssembler::InNewSpace(Register object, |
Label* branch) { |
DCHECK(cond == eq || cond == ne); |
UseScratchRegisterScope temps(this); |
- Register temp = temps.AcquireX(); |
- And(temp, object, ExternalReference::new_space_mask(isolate())); |
- Cmp(temp, ExternalReference::new_space_start(isolate())); |
- B(cond, branch); |
+ const int mask = |
+ (1 << MemoryChunk::IN_FROM_SPACE) | (1 << MemoryChunk::IN_TO_SPACE); |
+ CheckPageFlag(object, temps.AcquireSameSizeAs(object), mask, cond, branch); |
} |
@@ -3991,6 +3990,17 @@ int MacroAssembler::SafepointRegisterStackIndex(int reg_code) { |
} |
} |
+void MacroAssembler::CheckPageFlag(const Register& object, |
+ const Register& scratch, int mask, |
+ Condition cc, Label* condition_met) { |
+ And(scratch, object, ~Page::kPageAlignmentMask); |
+ Ldr(scratch, MemOperand(scratch, MemoryChunk::kFlagsOffset)); |
+ if (cc == eq) { |
+ TestAndBranchIfAnySet(scratch, mask, condition_met); |
+ } else { |
+ TestAndBranchIfAllClear(scratch, mask, condition_met); |
+ } |
+} |
void MacroAssembler::CheckPageFlagSet(const Register& object, |
const Register& scratch, |