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

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

Issue 2466573002: [stubs] Fix allocation memento detection. (Closed)
Patch Set: Created 4 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 unified diff | Download patch
« no previous file with comments | « src/s390/macro-assembler-s390.cc ('k') | src/x87/macro-assembler-x87.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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_X64 5 #if V8_TARGET_ARCH_X64
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 5451 matching lines...) Expand 10 before | Expand all | Expand 10 after
5462 5462
5463 void MacroAssembler::TestJSArrayForAllocationMemento( 5463 void MacroAssembler::TestJSArrayForAllocationMemento(
5464 Register receiver_reg, 5464 Register receiver_reg,
5465 Register scratch_reg, 5465 Register scratch_reg,
5466 Label* no_memento_found) { 5466 Label* no_memento_found) {
5467 Label map_check; 5467 Label map_check;
5468 Label top_check; 5468 Label top_check;
5469 ExternalReference new_space_allocation_top = 5469 ExternalReference new_space_allocation_top =
5470 ExternalReference::new_space_allocation_top_address(isolate()); 5470 ExternalReference::new_space_allocation_top_address(isolate());
5471 const int kMementoMapOffset = JSArray::kSize - kHeapObjectTag; 5471 const int kMementoMapOffset = JSArray::kSize - kHeapObjectTag;
5472 const int kMementoEndOffset = kMementoMapOffset + AllocationMemento::kSize; 5472 const int kMementoLastWordOffset =
5473 kMementoMapOffset + AllocationMemento::kSize - kPointerSize;
5473 5474
5474 // Bail out if the object is not in new space. 5475 // Bail out if the object is not in new space.
5475 JumpIfNotInNewSpace(receiver_reg, scratch_reg, no_memento_found); 5476 JumpIfNotInNewSpace(receiver_reg, scratch_reg, no_memento_found);
5476 // If the object is in new space, we need to check whether it is on the same 5477 // If the object is in new space, we need to check whether it is on the same
5477 // page as the current top. 5478 // page as the current top.
5478 leap(scratch_reg, Operand(receiver_reg, kMementoEndOffset)); 5479 leap(scratch_reg, Operand(receiver_reg, kMementoLastWordOffset));
5479 xorp(scratch_reg, ExternalOperand(new_space_allocation_top)); 5480 xorp(scratch_reg, ExternalOperand(new_space_allocation_top));
5480 testp(scratch_reg, Immediate(~Page::kPageAlignmentMask)); 5481 testp(scratch_reg, Immediate(~Page::kPageAlignmentMask));
5481 j(zero, &top_check); 5482 j(zero, &top_check);
5482 // The object is on a different page than allocation top. Bail out if the 5483 // The object is on a different page than allocation top. Bail out if the
5483 // object sits on the page boundary as no memento can follow and we cannot 5484 // object sits on the page boundary as no memento can follow and we cannot
5484 // touch the memory following it. 5485 // touch the memory following it.
5485 leap(scratch_reg, Operand(receiver_reg, kMementoEndOffset)); 5486 leap(scratch_reg, Operand(receiver_reg, kMementoLastWordOffset));
5486 xorp(scratch_reg, receiver_reg); 5487 xorp(scratch_reg, receiver_reg);
5487 testp(scratch_reg, Immediate(~Page::kPageAlignmentMask)); 5488 testp(scratch_reg, Immediate(~Page::kPageAlignmentMask));
5488 j(not_zero, no_memento_found); 5489 j(not_zero, no_memento_found);
5489 // Continue with the actual map check. 5490 // Continue with the actual map check.
5490 jmp(&map_check); 5491 jmp(&map_check);
5491 // If top is on the same page as the current object, we need to check whether 5492 // If top is on the same page as the current object, we need to check whether
5492 // we are below top. 5493 // we are below top.
5493 bind(&top_check); 5494 bind(&top_check);
5494 leap(scratch_reg, Operand(receiver_reg, kMementoEndOffset)); 5495 leap(scratch_reg, Operand(receiver_reg, kMementoLastWordOffset));
5495 cmpp(scratch_reg, ExternalOperand(new_space_allocation_top)); 5496 cmpp(scratch_reg, ExternalOperand(new_space_allocation_top));
5496 j(greater, no_memento_found); 5497 j(greater_equal, no_memento_found);
5497 // Memento map check. 5498 // Memento map check.
5498 bind(&map_check); 5499 bind(&map_check);
5499 CompareRoot(MemOperand(receiver_reg, kMementoMapOffset), 5500 CompareRoot(MemOperand(receiver_reg, kMementoMapOffset),
5500 Heap::kAllocationMementoMapRootIndex); 5501 Heap::kAllocationMementoMapRootIndex);
5501 } 5502 }
5502 5503
5503 5504
5504 void MacroAssembler::JumpIfDictionaryInPrototypeChain( 5505 void MacroAssembler::JumpIfDictionaryInPrototypeChain(
5505 Register object, 5506 Register object,
5506 Register scratch0, 5507 Register scratch0,
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
5550 movl(rax, dividend); 5551 movl(rax, dividend);
5551 shrl(rax, Immediate(31)); 5552 shrl(rax, Immediate(31));
5552 addl(rdx, rax); 5553 addl(rdx, rax);
5553 } 5554 }
5554 5555
5555 5556
5556 } // namespace internal 5557 } // namespace internal
5557 } // namespace v8 5558 } // namespace v8
5558 5559
5559 #endif // V8_TARGET_ARCH_X64 5560 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/s390/macro-assembler-s390.cc ('k') | src/x87/macro-assembler-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698