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

Side by Side Diff: src/arm64/macro-assembler-arm64.cc

Issue 1845463003: Remove usages of Heap::NewSpaceStart and its external reference (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Do not access mementos when the array is allocated on a page boundary Created 4 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #if V8_TARGET_ARCH_ARM64 5 #if V8_TARGET_ARCH_ARM64
6 6
7 #include "src/base/bits.h" 7 #include "src/base/bits.h"
8 #include "src/base/division-by-constant.h" 8 #include "src/base/division-by-constant.h"
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 1538 matching lines...) Expand 10 before | Expand all | Expand 10 after
1549 Ldr(current_object, FieldMemOperand(map, Map::kPrototypeOffset)); 1549 Ldr(current_object, FieldMemOperand(map, Map::kPrototypeOffset));
1550 Cmp(current_object, null_value); 1550 Cmp(current_object, null_value);
1551 B(ne, &next); 1551 B(ne, &next);
1552 } 1552 }
1553 1553
1554 1554
1555 void MacroAssembler::TestJSArrayForAllocationMemento(Register receiver, 1555 void MacroAssembler::TestJSArrayForAllocationMemento(Register receiver,
1556 Register scratch1, 1556 Register scratch1,
1557 Register scratch2, 1557 Register scratch2,
1558 Label* no_memento_found) { 1558 Label* no_memento_found) {
1559 ExternalReference new_space_start = 1559 Label map_check;
1560 ExternalReference::new_space_start(isolate());
1561 ExternalReference new_space_allocation_top = 1560 ExternalReference new_space_allocation_top =
1562 ExternalReference::new_space_allocation_top_address(isolate()); 1561 ExternalReference::new_space_allocation_top_address(isolate());
1562 const int kMementoMapOffset = JSArray::kSize - kHeapObjectTag;
1563 const int kMementoEndOffset = kMementoMapOffset + AllocationMemento::kSize;
1563 1564
1564 Add(scratch1, receiver, 1565 // Bail out if the object sits on the page boundary as no memento can follow
1565 JSArray::kSize + AllocationMemento::kSize - kHeapObjectTag); 1566 // and we cannot touch the memory following it.
1566 Cmp(scratch1, new_space_start); 1567 Add(scratch1, receiver, kMementoEndOffset);
1567 B(lt, no_memento_found); 1568 Eor(scratch2, scratch1, receiver);
1568 1569 Cmp(scratch2, Operand(Page::kPageSize));
1569 Mov(scratch2, new_space_allocation_top);
1570 Ldr(scratch2, MemOperand(scratch2));
1571 Cmp(scratch1, scratch2);
1572 B(gt, no_memento_found); 1570 B(gt, no_memento_found);
1573 1571 // Bail out if the object is not in new space. Reuse scratch1 from above.
1574 Ldr(scratch1, MemOperand(scratch1, -AllocationMemento::kSize)); 1572 JumpIfNotInNewSpace(scratch1, no_memento_found);
1575 Cmp(scratch1, 1573 // If the object is in new space, we need to check whether it is on the same
1576 Operand(isolate()->factory()->allocation_memento_map())); 1574 // page as the current top.
1575 Add(scratch2, receiver, kMementoEndOffset);
1576 Eor(scratch2, scratch2, new_space_allocation_top);
1577 Tst(scratch2, ~Page::kPageAlignmentMask);
1578 B(ne, no_memento_found);
1579 // Otherwise, we have to check whether we are still below top, to ensure that
1580 // we are not checking against a stale memento.
1581 Cmp(scratch1, new_space_allocation_top);
1582 B(gt, no_memento_found);
1583 bind(&map_check);
1584 Ldr(scratch1, MemOperand(receiver, kMementoMapOffset));
1585 Cmp(scratch1, Operand(isolate()->factory()->allocation_memento_map()));
1577 } 1586 }
1578 1587
1579 1588
1580 void MacroAssembler::InNewSpace(Register object, 1589 void MacroAssembler::InNewSpace(Register object,
1581 Condition cond, 1590 Condition cond,
1582 Label* branch) { 1591 Label* branch) {
1583 DCHECK(cond == eq || cond == ne); 1592 DCHECK(cond == eq || cond == ne);
1584 UseScratchRegisterScope temps(this); 1593 UseScratchRegisterScope temps(this);
1585 const int mask = 1594 const int mask =
1586 (1 << MemoryChunk::IN_FROM_SPACE) | (1 << MemoryChunk::IN_TO_SPACE); 1595 (1 << MemoryChunk::IN_FROM_SPACE) | (1 << MemoryChunk::IN_TO_SPACE);
(...skipping 3492 matching lines...) Expand 10 before | Expand all | Expand 10 after
5079 } 5088 }
5080 5089
5081 5090
5082 #undef __ 5091 #undef __
5083 5092
5084 5093
5085 } // namespace internal 5094 } // namespace internal
5086 } // namespace v8 5095 } // namespace v8
5087 5096
5088 #endif // V8_TARGET_ARCH_ARM64 5097 #endif // V8_TARGET_ARCH_ARM64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698