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

Side by Side Diff: src/objects-inl.h

Issue 1632913003: [heap] Move to page lookups for SemiSpace, NewSpace, and Heap containment methods (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix arm Created 4 years, 10 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 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 // Review notes: 5 // Review notes:
6 // 6 //
7 // - The use of macros in these inline functions may seem superfluous 7 // - The use of macros in these inline functions may seem superfluous
8 // but it is absolutely needed to make sure gcc generates optimal 8 // but it is absolutely needed to make sure gcc generates optimal
9 // code. gcc is not happy when attempting to inline too deep. 9 // code. gcc is not happy when attempting to inline too deep.
10 // 10 //
(...skipping 1221 matching lines...) Expand 10 before | Expand all | Expand 10 after
1232 #define RELEASE_WRITE_FIELD(p, offset, value) \ 1232 #define RELEASE_WRITE_FIELD(p, offset, value) \
1233 base::Release_Store( \ 1233 base::Release_Store( \
1234 reinterpret_cast<base::AtomicWord*>(FIELD_ADDR(p, offset)), \ 1234 reinterpret_cast<base::AtomicWord*>(FIELD_ADDR(p, offset)), \
1235 reinterpret_cast<base::AtomicWord>(value)); 1235 reinterpret_cast<base::AtomicWord>(value));
1236 1236
1237 #define NOBARRIER_WRITE_FIELD(p, offset, value) \ 1237 #define NOBARRIER_WRITE_FIELD(p, offset, value) \
1238 base::NoBarrier_Store( \ 1238 base::NoBarrier_Store( \
1239 reinterpret_cast<base::AtomicWord*>(FIELD_ADDR(p, offset)), \ 1239 reinterpret_cast<base::AtomicWord*>(FIELD_ADDR(p, offset)), \
1240 reinterpret_cast<base::AtomicWord>(value)); 1240 reinterpret_cast<base::AtomicWord>(value));
1241 1241
1242 #define WRITE_BARRIER(heap, object, offset, value) \ 1242 #define WRITE_BARRIER(heap, object, offset, value) \
1243 heap->incremental_marking()->RecordWrite( \ 1243 heap->incremental_marking()->RecordWrite( \
1244 object, HeapObject::RawField(object, offset), value); \ 1244 object, HeapObject::RawField(object, offset), value); \
1245 if (heap->InNewSpace(value)) { \ 1245 if (heap->InNewSpace(value)) { \
1246 heap->RecordWrite(object->address(), offset); \ 1246 heap->RecordWrite(object, offset); \
1247 } 1247 }
1248 1248
1249 #define CONDITIONAL_WRITE_BARRIER(heap, object, offset, value, mode) \ 1249 #define CONDITIONAL_WRITE_BARRIER(heap, object, offset, value, mode) \
1250 if (mode != SKIP_WRITE_BARRIER) { \ 1250 if (mode != SKIP_WRITE_BARRIER) { \
1251 if (mode == UPDATE_WRITE_BARRIER) { \ 1251 if (mode == UPDATE_WRITE_BARRIER) { \
1252 heap->incremental_marking()->RecordWrite( \ 1252 heap->incremental_marking()->RecordWrite( \
1253 object, HeapObject::RawField(object, offset), value); \ 1253 object, HeapObject::RawField(object, offset), value); \
1254 } \ 1254 } \
1255 if (heap->InNewSpace(value)) { \ 1255 if (heap->InNewSpace(value)) { \
1256 heap->RecordWrite(object->address(), offset); \ 1256 heap->RecordWrite(object, offset); \
1257 } \ 1257 } \
1258 } 1258 }
1259 1259
1260 #define READ_DOUBLE_FIELD(p, offset) \ 1260 #define READ_DOUBLE_FIELD(p, offset) \
1261 ReadDoubleValue(FIELD_ADDR_CONST(p, offset)) 1261 ReadDoubleValue(FIELD_ADDR_CONST(p, offset))
1262 1262
1263 #define WRITE_DOUBLE_FIELD(p, offset, value) \ 1263 #define WRITE_DOUBLE_FIELD(p, offset, value) \
1264 WriteDoubleValue(FIELD_ADDR(p, offset), value) 1264 WriteDoubleValue(FIELD_ADDR(p, offset), value)
1265 1265
1266 #define READ_INT_FIELD(p, offset) \ 1266 #define READ_INT_FIELD(p, offset) \
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after
2036 } 2036 }
2037 2037
2038 2038
2039 void WeakCell::initialize(HeapObject* val) { 2039 void WeakCell::initialize(HeapObject* val) {
2040 WRITE_FIELD(this, kValueOffset, val); 2040 WRITE_FIELD(this, kValueOffset, val);
2041 Heap* heap = GetHeap(); 2041 Heap* heap = GetHeap();
2042 // We just have to execute the generational barrier here because we never 2042 // We just have to execute the generational barrier here because we never
2043 // mark through a weak cell and collect evacuation candidates when we process 2043 // mark through a weak cell and collect evacuation candidates when we process
2044 // all weak cells. 2044 // all weak cells.
2045 if (heap->InNewSpace(val)) { 2045 if (heap->InNewSpace(val)) {
2046 heap->RecordWrite(address(), kValueOffset); 2046 heap->RecordWrite(this, kValueOffset);
2047 } 2047 }
2048 } 2048 }
2049 2049
2050 2050
2051 bool WeakCell::cleared() const { return value() == Smi::FromInt(0); } 2051 bool WeakCell::cleared() const { return value() == Smi::FromInt(0); }
2052 2052
2053 2053
2054 Object* WeakCell::next() const { return READ_FIELD(this, kNextOffset); } 2054 Object* WeakCell::next() const { return READ_FIELD(this, kNextOffset); }
2055 2055
2056 2056
(...skipping 5818 matching lines...) Expand 10 before | Expand all | Expand 10 after
7875 #undef WRITE_INT64_FIELD 7875 #undef WRITE_INT64_FIELD
7876 #undef READ_BYTE_FIELD 7876 #undef READ_BYTE_FIELD
7877 #undef WRITE_BYTE_FIELD 7877 #undef WRITE_BYTE_FIELD
7878 #undef NOBARRIER_READ_BYTE_FIELD 7878 #undef NOBARRIER_READ_BYTE_FIELD
7879 #undef NOBARRIER_WRITE_BYTE_FIELD 7879 #undef NOBARRIER_WRITE_BYTE_FIELD
7880 7880
7881 } // namespace internal 7881 } // namespace internal
7882 } // namespace v8 7882 } // namespace v8
7883 7883
7884 #endif // V8_OBJECTS_INL_H_ 7884 #endif // V8_OBJECTS_INL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698