OLD | NEW |
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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/base/atomicops.h" | 7 #include "src/base/atomicops.h" |
| 8 #include "src/base/bits.h" |
8 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
9 #include "src/compilation-cache.h" | 10 #include "src/compilation-cache.h" |
10 #include "src/cpu-profiler.h" | 11 #include "src/cpu-profiler.h" |
11 #include "src/deoptimizer.h" | 12 #include "src/deoptimizer.h" |
12 #include "src/execution.h" | 13 #include "src/execution.h" |
13 #include "src/gdb-jit.h" | 14 #include "src/gdb-jit.h" |
14 #include "src/global-handles.h" | 15 #include "src/global-handles.h" |
15 #include "src/heap/incremental-marking.h" | 16 #include "src/heap/incremental-marking.h" |
16 #include "src/heap/mark-compact.h" | 17 #include "src/heap/mark-compact.h" |
17 #include "src/heap/objects-visiting.h" | 18 #include "src/heap/objects-visiting.h" |
(...skipping 1901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1919 if (it.HasNext()) { | 1920 if (it.HasNext()) { |
1920 const MarkBit::CellType next_cell = *(cell + 1); | 1921 const MarkBit::CellType next_cell = *(cell + 1); |
1921 grey_objects = current_cell & ((current_cell >> 1) | | 1922 grey_objects = current_cell & ((current_cell >> 1) | |
1922 (next_cell << (Bitmap::kBitsPerCell - 1))); | 1923 (next_cell << (Bitmap::kBitsPerCell - 1))); |
1923 } else { | 1924 } else { |
1924 grey_objects = current_cell & (current_cell >> 1); | 1925 grey_objects = current_cell & (current_cell >> 1); |
1925 } | 1926 } |
1926 | 1927 |
1927 int offset = 0; | 1928 int offset = 0; |
1928 while (grey_objects != 0) { | 1929 while (grey_objects != 0) { |
1929 int trailing_zeros = CompilerIntrinsics::CountTrailingZeros(grey_objects); | 1930 int trailing_zeros = base::bits::CountTrailingZeros32(grey_objects); |
1930 grey_objects >>= trailing_zeros; | 1931 grey_objects >>= trailing_zeros; |
1931 offset += trailing_zeros; | 1932 offset += trailing_zeros; |
1932 MarkBit markbit(cell, 1 << offset, false); | 1933 MarkBit markbit(cell, 1 << offset, false); |
1933 DCHECK(Marking::IsGrey(markbit)); | 1934 DCHECK(Marking::IsGrey(markbit)); |
1934 Marking::GreyToBlack(markbit); | 1935 Marking::GreyToBlack(markbit); |
1935 Address addr = cell_base + offset * kPointerSize; | 1936 Address addr = cell_base + offset * kPointerSize; |
1936 HeapObject* object = HeapObject::FromAddress(addr); | 1937 HeapObject* object = HeapObject::FromAddress(addr); |
1937 MemoryChunk::IncrementLiveBytesFromGC(object->address(), object->Size()); | 1938 MemoryChunk::IncrementLiveBytesFromGC(object->address(), object->Size()); |
1938 marking_deque->PushBlack(object); | 1939 marking_deque->PushBlack(object); |
1939 if (marking_deque->IsFull()) return; | 1940 if (marking_deque->IsFull()) return; |
(...skipping 18 matching lines...) Expand all Loading... |
1958 | 1959 |
1959 for (MarkBitCellIterator it(p); !it.Done(); it.Advance()) { | 1960 for (MarkBitCellIterator it(p); !it.Done(); it.Advance()) { |
1960 Address cell_base = it.CurrentCellBase(); | 1961 Address cell_base = it.CurrentCellBase(); |
1961 MarkBit::CellType* cell = it.CurrentCell(); | 1962 MarkBit::CellType* cell = it.CurrentCell(); |
1962 | 1963 |
1963 MarkBit::CellType current_cell = *cell; | 1964 MarkBit::CellType current_cell = *cell; |
1964 if (current_cell == 0) continue; | 1965 if (current_cell == 0) continue; |
1965 | 1966 |
1966 int offset = 0; | 1967 int offset = 0; |
1967 while (current_cell != 0) { | 1968 while (current_cell != 0) { |
1968 int trailing_zeros = CompilerIntrinsics::CountTrailingZeros(current_cell); | 1969 int trailing_zeros = base::bits::CountTrailingZeros32(current_cell); |
1969 current_cell >>= trailing_zeros; | 1970 current_cell >>= trailing_zeros; |
1970 offset += trailing_zeros; | 1971 offset += trailing_zeros; |
1971 Address address = cell_base + offset * kPointerSize; | 1972 Address address = cell_base + offset * kPointerSize; |
1972 HeapObject* object = HeapObject::FromAddress(address); | 1973 HeapObject* object = HeapObject::FromAddress(address); |
1973 | 1974 |
1974 int size = object->Size(); | 1975 int size = object->Size(); |
1975 survivors_size += size; | 1976 survivors_size += size; |
1976 | 1977 |
1977 Heap::UpdateAllocationSiteFeedback(object, Heap::RECORD_SCRATCHPAD_SLOT); | 1978 Heap::UpdateAllocationSiteFeedback(object, Heap::RECORD_SCRATCHPAD_SLOT); |
1978 | 1979 |
(...skipping 2799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4778 SlotsBuffer* buffer = *buffer_address; | 4779 SlotsBuffer* buffer = *buffer_address; |
4779 while (buffer != NULL) { | 4780 while (buffer != NULL) { |
4780 SlotsBuffer* next_buffer = buffer->next(); | 4781 SlotsBuffer* next_buffer = buffer->next(); |
4781 DeallocateBuffer(buffer); | 4782 DeallocateBuffer(buffer); |
4782 buffer = next_buffer; | 4783 buffer = next_buffer; |
4783 } | 4784 } |
4784 *buffer_address = NULL; | 4785 *buffer_address = NULL; |
4785 } | 4786 } |
4786 } | 4787 } |
4787 } // namespace v8::internal | 4788 } // namespace v8::internal |
OLD | NEW |