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

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

Issue 1848003002: s390: Remove usages of Heap::NewSpaceStart and its external reference (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add kNear Created 4 years, 9 months 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/s390/macro-assembler-s390.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/s390/macro-assembler-s390.cc
diff --git a/src/s390/macro-assembler-s390.cc b/src/s390/macro-assembler-s390.cc
index 8ca4674d069cbd965f6737cef4bc5ef240a67a9a..559f7d030a75f74448fbb05ffd32d86f8f16983f 100644
--- a/src/s390/macro-assembler-s390.cc
+++ b/src/s390/macro-assembler-s390.cc
@@ -3704,20 +3704,46 @@ void MacroAssembler::StoreRepresentation(Register src, const MemOperand& mem,
void MacroAssembler::TestJSArrayForAllocationMemento(Register receiver_reg,
Register scratch_reg,
+ Register scratch2_reg,
Label* no_memento_found) {
- ExternalReference new_space_start =
- ExternalReference::new_space_start(isolate());
+ Label map_check;
+ Label top_check;
ExternalReference new_space_allocation_top =
ExternalReference::new_space_allocation_top_address(isolate());
- AddP(scratch_reg, receiver_reg,
- Operand(JSArray::kSize + AllocationMemento::kSize - kHeapObjectTag));
- CmpP(scratch_reg, Operand(new_space_start));
- blt(no_memento_found);
- mov(ip, Operand(new_space_allocation_top));
- LoadP(ip, MemOperand(ip));
- CmpP(scratch_reg, ip);
+ const int kMementoMapOffset = JSArray::kSize - kHeapObjectTag;
+ const int kMementoEndOffset = kMementoMapOffset + AllocationMemento::kSize;
+ Register mask = scratch2_reg;
+
+ DCHECK(!AreAliased(receiver_reg, scratch_reg, mask));
+
+ // Bail out if the object is not in new space.
+ JumpIfNotInNewSpace(receiver_reg, scratch_reg, no_memento_found);
+
+ DCHECK((~Page::kPageAlignmentMask & 0xffff) == 0);
+ LoadImmP(mask, Operand((~Page::kPageAlignmentMask >> 16)));
+ AddP(scratch_reg, receiver_reg, Operand(kMementoEndOffset));
+
+ // If the object is in new space, we need to check whether it is on the same
+ // page as the current top.
+ XorP(r0, scratch_reg, Operand(new_space_allocation_top));
+ AndP(r0, r0, mask);
+ beq(&top_check, Label::kNear);
+ // The object is on a different page than allocation top. Bail out if the
+ // object sits on the page boundary as no memento can follow and we cannot
+ // touch the memory following it.
+ XorP(r0, scratch_reg, receiver_reg);
+ AndP(r0, r0, mask);
+ bne(no_memento_found);
+ // Continue with the actual map check.
+ b(&map_check, Label::kNear);
+ // If top is on the same page as the current object, we need to check whether
+ // we are below top.
+ bind(&top_check);
+ CmpP(scratch_reg, Operand(new_space_allocation_top));
bgt(no_memento_found);
- LoadP(scratch_reg, MemOperand(scratch_reg, -AllocationMemento::kSize));
+ // Memento map check.
+ bind(&map_check);
+ LoadP(scratch_reg, MemOperand(receiver_reg, kMementoMapOffset));
CmpP(scratch_reg, Operand(isolate()->factory()->allocation_memento_map()));
}
« no previous file with comments | « src/s390/macro-assembler-s390.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698