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 // 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 1104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1115 return HasPropertyWithHandler(proxy, name); | 1115 return HasPropertyWithHandler(proxy, name); |
1116 } | 1116 } |
1117 | 1117 |
1118 | 1118 |
1119 #define FIELD_ADDR(p, offset) \ | 1119 #define FIELD_ADDR(p, offset) \ |
1120 (reinterpret_cast<byte*>(p) + offset - kHeapObjectTag) | 1120 (reinterpret_cast<byte*>(p) + offset - kHeapObjectTag) |
1121 | 1121 |
1122 #define READ_FIELD(p, offset) \ | 1122 #define READ_FIELD(p, offset) \ |
1123 (*reinterpret_cast<Object**>(FIELD_ADDR(p, offset))) | 1123 (*reinterpret_cast<Object**>(FIELD_ADDR(p, offset))) |
1124 | 1124 |
1125 #define ACQUIRE_READ_FIELD(p, offset) \ | 1125 #define ACQUIRE_READ_FIELD(p, offset) \ |
1126 reinterpret_cast<Object*>( \ | 1126 reinterpret_cast<Object*>(base::Acquire_Load( \ |
Jakob Kummerow
2014/06/05 11:49:06
IWYU?
| |
1127 Acquire_Load(reinterpret_cast<AtomicWord*>(FIELD_ADDR(p, offset)))) | 1127 reinterpret_cast<base::AtomicWord*>(FIELD_ADDR(p, offset)))) |
1128 | 1128 |
1129 #define NOBARRIER_READ_FIELD(p, offset) \ | 1129 #define NOBARRIER_READ_FIELD(p, offset) \ |
1130 reinterpret_cast<Object*>( \ | 1130 reinterpret_cast<Object*>(base::NoBarrier_Load( \ |
1131 NoBarrier_Load(reinterpret_cast<AtomicWord*>(FIELD_ADDR(p, offset)))) | 1131 reinterpret_cast<base::AtomicWord*>(FIELD_ADDR(p, offset)))) |
1132 | 1132 |
1133 #define WRITE_FIELD(p, offset, value) \ | 1133 #define WRITE_FIELD(p, offset, value) \ |
1134 (*reinterpret_cast<Object**>(FIELD_ADDR(p, offset)) = value) | 1134 (*reinterpret_cast<Object**>(FIELD_ADDR(p, offset)) = value) |
1135 | 1135 |
1136 #define RELEASE_WRITE_FIELD(p, offset, value) \ | 1136 #define RELEASE_WRITE_FIELD(p, offset, value) \ |
1137 Release_Store(reinterpret_cast<AtomicWord*>(FIELD_ADDR(p, offset)), \ | 1137 base::Release_Store( \ |
1138 reinterpret_cast<AtomicWord>(value)); | 1138 reinterpret_cast<base::AtomicWord*>(FIELD_ADDR(p, offset)), \ |
1139 reinterpret_cast<base::AtomicWord>(value)); | |
1139 | 1140 |
1140 #define NOBARRIER_WRITE_FIELD(p, offset, value) \ | 1141 #define NOBARRIER_WRITE_FIELD(p, offset, value) \ |
1141 NoBarrier_Store(reinterpret_cast<AtomicWord*>(FIELD_ADDR(p, offset)), \ | 1142 base::NoBarrier_Store( \ |
1142 reinterpret_cast<AtomicWord>(value)); | 1143 reinterpret_cast<base::AtomicWord*>(FIELD_ADDR(p, offset)), \ |
1144 reinterpret_cast<base::AtomicWord>(value)); | |
1143 | 1145 |
1144 #define WRITE_BARRIER(heap, object, offset, value) \ | 1146 #define WRITE_BARRIER(heap, object, offset, value) \ |
1145 heap->incremental_marking()->RecordWrite( \ | 1147 heap->incremental_marking()->RecordWrite( \ |
1146 object, HeapObject::RawField(object, offset), value); \ | 1148 object, HeapObject::RawField(object, offset), value); \ |
1147 if (heap->InNewSpace(value)) { \ | 1149 if (heap->InNewSpace(value)) { \ |
1148 heap->RecordWrite(object->address(), offset); \ | 1150 heap->RecordWrite(object->address(), offset); \ |
1149 } | 1151 } |
1150 | 1152 |
1151 #define CONDITIONAL_WRITE_BARRIER(heap, object, offset, value, mode) \ | 1153 #define CONDITIONAL_WRITE_BARRIER(heap, object, offset, value, mode) \ |
1152 if (mode == UPDATE_WRITE_BARRIER) { \ | 1154 if (mode == UPDATE_WRITE_BARRIER) { \ |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1228 | 1230 |
1229 #define READ_SHORT_FIELD(p, offset) \ | 1231 #define READ_SHORT_FIELD(p, offset) \ |
1230 (*reinterpret_cast<uint16_t*>(FIELD_ADDR(p, offset))) | 1232 (*reinterpret_cast<uint16_t*>(FIELD_ADDR(p, offset))) |
1231 | 1233 |
1232 #define WRITE_SHORT_FIELD(p, offset, value) \ | 1234 #define WRITE_SHORT_FIELD(p, offset, value) \ |
1233 (*reinterpret_cast<uint16_t*>(FIELD_ADDR(p, offset)) = value) | 1235 (*reinterpret_cast<uint16_t*>(FIELD_ADDR(p, offset)) = value) |
1234 | 1236 |
1235 #define READ_BYTE_FIELD(p, offset) \ | 1237 #define READ_BYTE_FIELD(p, offset) \ |
1236 (*reinterpret_cast<byte*>(FIELD_ADDR(p, offset))) | 1238 (*reinterpret_cast<byte*>(FIELD_ADDR(p, offset))) |
1237 | 1239 |
1238 #define NOBARRIER_READ_BYTE_FIELD(p, offset) \ | 1240 #define NOBARRIER_READ_BYTE_FIELD(p, offset) \ |
1239 static_cast<byte>(NoBarrier_Load( \ | 1241 static_cast<byte>(base::NoBarrier_Load( \ |
1240 reinterpret_cast<Atomic8*>(FIELD_ADDR(p, offset))) ) | 1242 reinterpret_cast<base::Atomic8*>(FIELD_ADDR(p, offset)))) |
1241 | 1243 |
1242 #define WRITE_BYTE_FIELD(p, offset, value) \ | 1244 #define WRITE_BYTE_FIELD(p, offset, value) \ |
1243 (*reinterpret_cast<byte*>(FIELD_ADDR(p, offset)) = value) | 1245 (*reinterpret_cast<byte*>(FIELD_ADDR(p, offset)) = value) |
1244 | 1246 |
1245 #define NOBARRIER_WRITE_BYTE_FIELD(p, offset, value) \ | 1247 #define NOBARRIER_WRITE_BYTE_FIELD(p, offset, value) \ |
1246 NoBarrier_Store(reinterpret_cast<Atomic8*>(FIELD_ADDR(p, offset)), \ | 1248 base::NoBarrier_Store( \ |
1247 static_cast<Atomic8>(value)); | 1249 reinterpret_cast<base::Atomic8*>(FIELD_ADDR(p, offset)), \ |
1250 static_cast<base::Atomic8>(value)); | |
1248 | 1251 |
1249 Object** HeapObject::RawField(HeapObject* obj, int byte_offset) { | 1252 Object** HeapObject::RawField(HeapObject* obj, int byte_offset) { |
1250 return &READ_FIELD(obj, byte_offset); | 1253 return &READ_FIELD(obj, byte_offset); |
1251 } | 1254 } |
1252 | 1255 |
1253 | 1256 |
1254 int Smi::value() { | 1257 int Smi::value() { |
1255 return Internals::SmiValue(this); | 1258 return Internals::SmiValue(this); |
1256 } | 1259 } |
1257 | 1260 |
(...skipping 5729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6987 #undef READ_SHORT_FIELD | 6990 #undef READ_SHORT_FIELD |
6988 #undef WRITE_SHORT_FIELD | 6991 #undef WRITE_SHORT_FIELD |
6989 #undef READ_BYTE_FIELD | 6992 #undef READ_BYTE_FIELD |
6990 #undef WRITE_BYTE_FIELD | 6993 #undef WRITE_BYTE_FIELD |
6991 #undef NOBARRIER_READ_BYTE_FIELD | 6994 #undef NOBARRIER_READ_BYTE_FIELD |
6992 #undef NOBARRIER_WRITE_BYTE_FIELD | 6995 #undef NOBARRIER_WRITE_BYTE_FIELD |
6993 | 6996 |
6994 } } // namespace v8::internal | 6997 } } // namespace v8::internal |
6995 | 6998 |
6996 #endif // V8_OBJECTS_INL_H_ | 6999 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |