| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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 #include "src/code-stub-assembler.h" | 4 #include "src/code-stub-assembler.h" |
| 5 #include "src/code-factory.h" | 5 #include "src/code-factory.h" |
| 6 #include "src/frames-inl.h" | 6 #include "src/frames-inl.h" |
| 7 #include "src/frames.h" | 7 #include "src/frames.h" |
| 8 #include "src/ic/handler-configuration.h" | 8 #include "src/ic/handler-configuration.h" |
| 9 #include "src/ic/stub-cache.h" | 9 #include "src/ic/stub-cache.h" |
| 10 | 10 |
| (...skipping 6688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6699 | 6699 |
| 6700 void CodeStubAssembler::TrapAllocationMemento(Node* object, | 6700 void CodeStubAssembler::TrapAllocationMemento(Node* object, |
| 6701 Label* memento_found) { | 6701 Label* memento_found) { |
| 6702 Comment("[ TrapAllocationMemento"); | 6702 Comment("[ TrapAllocationMemento"); |
| 6703 Label no_memento_found(this); | 6703 Label no_memento_found(this); |
| 6704 Label top_check(this), map_check(this); | 6704 Label top_check(this), map_check(this); |
| 6705 | 6705 |
| 6706 Node* new_space_top_address = ExternalConstant( | 6706 Node* new_space_top_address = ExternalConstant( |
| 6707 ExternalReference::new_space_allocation_top_address(isolate())); | 6707 ExternalReference::new_space_allocation_top_address(isolate())); |
| 6708 const int kMementoMapOffset = JSArray::kSize - kHeapObjectTag; | 6708 const int kMementoMapOffset = JSArray::kSize - kHeapObjectTag; |
| 6709 const int kMementoEndOffset = kMementoMapOffset + AllocationMemento::kSize; | 6709 const int kMementoLastWordOffset = |
| 6710 kMementoMapOffset + AllocationMemento::kSize - kPointerSize; |
| 6710 | 6711 |
| 6711 // Bail out if the object is not in new space. | 6712 // Bail out if the object is not in new space. |
| 6712 Node* object_page = PageFromAddress(object); | 6713 Node* object_page = PageFromAddress(object); |
| 6713 { | 6714 { |
| 6714 const int mask = | 6715 const int mask = |
| 6715 (1 << MemoryChunk::IN_FROM_SPACE) | (1 << MemoryChunk::IN_TO_SPACE); | 6716 (1 << MemoryChunk::IN_FROM_SPACE) | (1 << MemoryChunk::IN_TO_SPACE); |
| 6716 Node* page_flags = Load(MachineType::IntPtr(), object_page); | 6717 Node* page_flags = Load(MachineType::IntPtr(), object_page); |
| 6717 GotoIf( | 6718 GotoIf( |
| 6718 WordEqual(WordAnd(page_flags, IntPtrConstant(mask)), IntPtrConstant(0)), | 6719 WordEqual(WordAnd(page_flags, IntPtrConstant(mask)), IntPtrConstant(0)), |
| 6719 &no_memento_found); | 6720 &no_memento_found); |
| 6720 } | 6721 } |
| 6721 | 6722 |
| 6722 Node* memento_end = IntPtrAdd(object, IntPtrConstant(kMementoEndOffset)); | 6723 Node* memento_last_word = |
| 6723 Node* memento_end_page = PageFromAddress(memento_end); | 6724 IntPtrAdd(object, IntPtrConstant(kMementoLastWordOffset)); |
| 6725 Node* memento_last_word_page = PageFromAddress(memento_last_word); |
| 6724 | 6726 |
| 6725 Node* new_space_top = Load(MachineType::Pointer(), new_space_top_address); | 6727 Node* new_space_top = Load(MachineType::Pointer(), new_space_top_address); |
| 6726 Node* new_space_top_page = PageFromAddress(new_space_top); | 6728 Node* new_space_top_page = PageFromAddress(new_space_top); |
| 6727 | 6729 |
| 6728 // If the object is in new space, we need to check whether it is and | 6730 // If the object is in new space, we need to check whether respective |
| 6729 // respective potential memento object on the same page as the current top. | 6731 // potential memento object is on the same page as the current top. |
| 6730 GotoIf(WordEqual(memento_end_page, new_space_top_page), &top_check); | 6732 GotoIf(WordEqual(memento_last_word_page, new_space_top_page), &top_check); |
| 6731 | 6733 |
| 6732 // The object is on a different page than allocation top. Bail out if the | 6734 // The object is on a different page than allocation top. Bail out if the |
| 6733 // object sits on the page boundary as no memento can follow and we cannot | 6735 // object sits on the page boundary as no memento can follow and we cannot |
| 6734 // touch the memory following it. | 6736 // touch the memory following it. |
| 6735 Branch(WordEqual(object_page, memento_end_page), &map_check, | 6737 Branch(WordEqual(object_page, memento_last_word_page), &map_check, |
| 6736 &no_memento_found); | 6738 &no_memento_found); |
| 6737 | 6739 |
| 6738 // If top is on the same page as the current object, we need to check whether | 6740 // If top is on the same page as the current object, we need to check whether |
| 6739 // we are below top. | 6741 // we are below top. |
| 6740 Bind(&top_check); | 6742 Bind(&top_check); |
| 6741 { | 6743 { |
| 6742 Branch(UintPtrGreaterThan(memento_end, new_space_top), &no_memento_found, | 6744 Branch(UintPtrGreaterThanOrEqual(memento_last_word, new_space_top), |
| 6743 &map_check); | 6745 &no_memento_found, &map_check); |
| 6744 } | 6746 } |
| 6745 | 6747 |
| 6746 // Memento map check. | 6748 // Memento map check. |
| 6747 Bind(&map_check); | 6749 Bind(&map_check); |
| 6748 { | 6750 { |
| 6749 Node* memento_map = LoadObjectField(object, kMementoMapOffset); | 6751 Node* memento_map = LoadObjectField(object, kMementoMapOffset); |
| 6750 Branch( | 6752 Branch( |
| 6751 WordEqual(memento_map, LoadRoot(Heap::kAllocationMementoMapRootIndex)), | 6753 WordEqual(memento_map, LoadRoot(Heap::kAllocationMementoMapRootIndex)), |
| 6752 memento_found, &no_memento_found); | 6754 memento_found, &no_memento_found); |
| 6753 } | 6755 } |
| (...skipping 1897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8651 Node* buffer_bit_field = LoadObjectField( | 8653 Node* buffer_bit_field = LoadObjectField( |
| 8652 buffer, JSArrayBuffer::kBitFieldOffset, MachineType::Uint32()); | 8654 buffer, JSArrayBuffer::kBitFieldOffset, MachineType::Uint32()); |
| 8653 Node* was_neutered_mask = Int32Constant(JSArrayBuffer::WasNeutered::kMask); | 8655 Node* was_neutered_mask = Int32Constant(JSArrayBuffer::WasNeutered::kMask); |
| 8654 | 8656 |
| 8655 return Word32NotEqual(Word32And(buffer_bit_field, was_neutered_mask), | 8657 return Word32NotEqual(Word32And(buffer_bit_field, was_neutered_mask), |
| 8656 Int32Constant(0)); | 8658 Int32Constant(0)); |
| 8657 } | 8659 } |
| 8658 | 8660 |
| 8659 } // namespace internal | 8661 } // namespace internal |
| 8660 } // namespace v8 | 8662 } // namespace v8 |
| OLD | NEW |