Forced inlining of some GC-related methods.

The selection of methods were driven by GCC's -Winline plus some benchmarking.
On ia32, the additional amount of code is roughly 63kB (= 0.07% of Chrome ;-).

BUG=v8:1607

Review URL: https://codereview.chromium.org/12338002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13710 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
svenpanne@chromium.org 2013-02-21 14:02:52 +00:00
parent 4c72bb7508
commit 54b4b1ecc2
3 changed files with 25 additions and 25 deletions

View File

@ -1373,10 +1373,10 @@ class Heap {
MUST_USE_RESULT MaybeObject* CreateSymbol(String* str); MUST_USE_RESULT MaybeObject* CreateSymbol(String* str);
// Write barrier support for address[offset] = o. // Write barrier support for address[offset] = o.
inline void RecordWrite(Address address, int offset); INLINE(void RecordWrite(Address address, int offset));
// Write barrier support for address[start : start + len[ = o. // Write barrier support for address[start : start + len[ = o.
inline void RecordWrites(Address address, int start, int len); INLINE(void RecordWrites(Address address, int start, int len));
// Given an address occupied by a live code object, return that object. // Given an address occupied by a live code object, return that object.
Object* FindCodeObject(Address a); Object* FindCodeObject(Address a);

View File

@ -1293,9 +1293,9 @@ class MarkCompactMarkingVisitor
// Visit all unmarked objects pointed to by [start, end). // Visit all unmarked objects pointed to by [start, end).
// Returns false if the operation fails (lack of stack space). // Returns false if the operation fails (lack of stack space).
static inline bool VisitUnmarkedObjects(Heap* heap, INLINE(static bool VisitUnmarkedObjects(Heap* heap,
Object** start, Object** start,
Object** end) { Object** end)) {
// Return false is we are close to the stack limit. // Return false is we are close to the stack limit.
StackLimitCheck check(heap->isolate()); StackLimitCheck check(heap->isolate());
if (check.HasOverflowed()) return false; if (check.HasOverflowed()) return false;

View File

@ -53,59 +53,59 @@ class Marking {
: heap_(heap) { : heap_(heap) {
} }
static inline MarkBit MarkBitFrom(Address addr); INLINE(static MarkBit MarkBitFrom(Address addr));
static inline MarkBit MarkBitFrom(HeapObject* obj) { INLINE(static MarkBit MarkBitFrom(HeapObject* obj)) {
return MarkBitFrom(reinterpret_cast<Address>(obj)); return MarkBitFrom(reinterpret_cast<Address>(obj));
} }
// Impossible markbits: 01 // Impossible markbits: 01
static const char* kImpossibleBitPattern; static const char* kImpossibleBitPattern;
static inline bool IsImpossible(MarkBit mark_bit) { INLINE(static bool IsImpossible(MarkBit mark_bit)) {
return !mark_bit.Get() && mark_bit.Next().Get(); return !mark_bit.Get() && mark_bit.Next().Get();
} }
// Black markbits: 10 - this is required by the sweeper. // Black markbits: 10 - this is required by the sweeper.
static const char* kBlackBitPattern; static const char* kBlackBitPattern;
static inline bool IsBlack(MarkBit mark_bit) { INLINE(static bool IsBlack(MarkBit mark_bit)) {
return mark_bit.Get() && !mark_bit.Next().Get(); return mark_bit.Get() && !mark_bit.Next().Get();
} }
// White markbits: 00 - this is required by the mark bit clearer. // White markbits: 00 - this is required by the mark bit clearer.
static const char* kWhiteBitPattern; static const char* kWhiteBitPattern;
static inline bool IsWhite(MarkBit mark_bit) { INLINE(static bool IsWhite(MarkBit mark_bit)) {
return !mark_bit.Get(); return !mark_bit.Get();
} }
// Grey markbits: 11 // Grey markbits: 11
static const char* kGreyBitPattern; static const char* kGreyBitPattern;
static inline bool IsGrey(MarkBit mark_bit) { INLINE(static bool IsGrey(MarkBit mark_bit)) {
return mark_bit.Get() && mark_bit.Next().Get(); return mark_bit.Get() && mark_bit.Next().Get();
} }
static inline void MarkBlack(MarkBit mark_bit) { INLINE(static void MarkBlack(MarkBit mark_bit)) {
mark_bit.Set(); mark_bit.Set();
mark_bit.Next().Clear(); mark_bit.Next().Clear();
} }
static inline void BlackToGrey(MarkBit markbit) { INLINE(static void BlackToGrey(MarkBit markbit)) {
markbit.Next().Set(); markbit.Next().Set();
} }
static inline void WhiteToGrey(MarkBit markbit) { INLINE(static void WhiteToGrey(MarkBit markbit)) {
markbit.Set(); markbit.Set();
markbit.Next().Set(); markbit.Next().Set();
} }
static inline void GreyToBlack(MarkBit markbit) { INLINE(static void GreyToBlack(MarkBit markbit)) {
markbit.Next().Clear(); markbit.Next().Clear();
} }
static inline void BlackToGrey(HeapObject* obj) { INLINE(static void BlackToGrey(HeapObject* obj)) {
BlackToGrey(MarkBitFrom(obj)); BlackToGrey(MarkBitFrom(obj));
} }
static inline void AnyToGrey(MarkBit markbit) { INLINE(static void AnyToGrey(MarkBit markbit)) {
markbit.Set(); markbit.Set();
markbit.Next().Set(); markbit.Next().Set();
} }
@ -194,7 +194,7 @@ class MarkingDeque {
// Push the (marked) object on the marking stack if there is room, // Push the (marked) object on the marking stack if there is room,
// otherwise mark the object as overflowed and wait for a rescan of the // otherwise mark the object as overflowed and wait for a rescan of the
// heap. // heap.
inline void PushBlack(HeapObject* object) { INLINE(void PushBlack(HeapObject* object)) {
ASSERT(object->IsHeapObject()); ASSERT(object->IsHeapObject());
if (IsFull()) { if (IsFull()) {
Marking::BlackToGrey(object); Marking::BlackToGrey(object);
@ -206,7 +206,7 @@ class MarkingDeque {
} }
} }
inline void PushGrey(HeapObject* object) { INLINE(void PushGrey(HeapObject* object)) {
ASSERT(object->IsHeapObject()); ASSERT(object->IsHeapObject());
if (IsFull()) { if (IsFull()) {
SetOverflowed(); SetOverflowed();
@ -216,7 +216,7 @@ class MarkingDeque {
} }
} }
inline HeapObject* Pop() { INLINE(HeapObject* Pop()) {
ASSERT(!IsEmpty()); ASSERT(!IsEmpty());
top_ = ((top_ - 1) & mask_); top_ = ((top_ - 1) & mask_);
HeapObject* object = array_[top_]; HeapObject* object = array_[top_];
@ -224,7 +224,7 @@ class MarkingDeque {
return object; return object;
} }
inline void UnshiftGrey(HeapObject* object) { INLINE(void UnshiftGrey(HeapObject* object)) {
ASSERT(object->IsHeapObject()); ASSERT(object->IsHeapObject());
if (IsFull()) { if (IsFull()) {
SetOverflowed(); SetOverflowed();
@ -366,10 +366,10 @@ class SlotsBuffer {
return buffer != NULL && buffer->chain_length_ >= kChainLengthThreshold; return buffer != NULL && buffer->chain_length_ >= kChainLengthThreshold;
} }
static bool AddTo(SlotsBufferAllocator* allocator, INLINE(static bool AddTo(SlotsBufferAllocator* allocator,
SlotsBuffer** buffer_address, SlotsBuffer** buffer_address,
ObjectSlot slot, ObjectSlot slot,
AdditionMode mode) { AdditionMode mode)) {
SlotsBuffer* buffer = *buffer_address; SlotsBuffer* buffer = *buffer_address;
if (buffer == NULL || buffer->IsFull()) { if (buffer == NULL || buffer->IsFull()) {
if (mode == FAIL_ON_OVERFLOW && ChainLengthThresholdReached(buffer)) { if (mode == FAIL_ON_OVERFLOW && ChainLengthThresholdReached(buffer)) {
@ -634,7 +634,7 @@ class MarkCompactCollector {
IsEvacuationCandidate(); IsEvacuationCandidate();
} }
void EvictEvacuationCandidate(Page* page) { INLINE(void EvictEvacuationCandidate(Page* page)) {
if (FLAG_trace_fragmentation) { if (FLAG_trace_fragmentation) {
PrintF("Page %p is too popular. Disabling evacuation.\n", PrintF("Page %p is too popular. Disabling evacuation.\n",
reinterpret_cast<void*>(page)); reinterpret_cast<void*>(page));