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

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

Issue 1193433002: MIPS: Fix unaligned memory access. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Moved to utils.h Created 5 years, 6 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
« no previous file with comments | « src/deoptimizer.cc ('k') | src/utils.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1227 matching lines...) Expand 10 before | Expand all | Expand 10 after
1238 if (mode != SKIP_WRITE_BARRIER) { \ 1238 if (mode != SKIP_WRITE_BARRIER) { \
1239 if (mode == UPDATE_WRITE_BARRIER) { \ 1239 if (mode == UPDATE_WRITE_BARRIER) { \
1240 heap->incremental_marking()->RecordWrite( \ 1240 heap->incremental_marking()->RecordWrite( \
1241 object, HeapObject::RawField(object, offset), value); \ 1241 object, HeapObject::RawField(object, offset), value); \
1242 } \ 1242 } \
1243 if (heap->InNewSpace(value)) { \ 1243 if (heap->InNewSpace(value)) { \
1244 heap->RecordWrite(object->address(), offset); \ 1244 heap->RecordWrite(object->address(), offset); \
1245 } \ 1245 } \
1246 } 1246 }
1247 1247
1248 #ifndef V8_TARGET_ARCH_MIPS 1248 #define READ_DOUBLE_FIELD(p, offset) \
1249 #define READ_DOUBLE_FIELD(p, offset) \ 1249 ReadDoubleValue(FIELD_ADDR_CONST(p, offset))
1250 (*reinterpret_cast<const double*>(FIELD_ADDR_CONST(p, offset)))
1251 #else // V8_TARGET_ARCH_MIPS
1252 // Prevent gcc from using load-double (mips ldc1) on (possibly)
1253 // non-64-bit aligned HeapNumber::value.
1254 static inline double read_double_field(const void* p, int offset) {
1255 union conversion {
1256 double d;
1257 uint32_t u[2];
1258 } c;
1259 c.u[0] = (*reinterpret_cast<const uint32_t*>(
1260 FIELD_ADDR_CONST(p, offset)));
1261 c.u[1] = (*reinterpret_cast<const uint32_t*>(
1262 FIELD_ADDR_CONST(p, offset + 4)));
1263 return c.d;
1264 }
1265 #define READ_DOUBLE_FIELD(p, offset) read_double_field(p, offset)
1266 #endif // V8_TARGET_ARCH_MIPS
1267 1250
1268 #ifndef V8_TARGET_ARCH_MIPS 1251 #define WRITE_DOUBLE_FIELD(p, offset, value) \
1269 #define WRITE_DOUBLE_FIELD(p, offset, value) \ 1252 WriteDoubleValue(FIELD_ADDR(p, offset), value)
1270 (*reinterpret_cast<double*>(FIELD_ADDR(p, offset)) = value)
1271 #else // V8_TARGET_ARCH_MIPS
1272 // Prevent gcc from using store-double (mips sdc1) on (possibly)
1273 // non-64-bit aligned HeapNumber::value.
1274 static inline void write_double_field(void* p, int offset,
1275 double value) {
1276 union conversion {
1277 double d;
1278 uint32_t u[2];
1279 } c;
1280 c.d = value;
1281 (*reinterpret_cast<uint32_t*>(FIELD_ADDR(p, offset))) = c.u[0];
1282 (*reinterpret_cast<uint32_t*>(FIELD_ADDR(p, offset + 4))) = c.u[1];
1283 }
1284 #define WRITE_DOUBLE_FIELD(p, offset, value) \
1285 write_double_field(p, offset, value)
1286 #endif // V8_TARGET_ARCH_MIPS
1287
1288 1253
1289 #define READ_INT_FIELD(p, offset) \ 1254 #define READ_INT_FIELD(p, offset) \
1290 (*reinterpret_cast<const int*>(FIELD_ADDR_CONST(p, offset))) 1255 (*reinterpret_cast<const int*>(FIELD_ADDR_CONST(p, offset)))
1291 1256
1292 #define WRITE_INT_FIELD(p, offset, value) \ 1257 #define WRITE_INT_FIELD(p, offset, value) \
1293 (*reinterpret_cast<int*>(FIELD_ADDR(p, offset)) = value) 1258 (*reinterpret_cast<int*>(FIELD_ADDR(p, offset)) = value)
1294 1259
1295 #define READ_INTPTR_FIELD(p, offset) \ 1260 #define READ_INTPTR_FIELD(p, offset) \
1296 (*reinterpret_cast<const intptr_t*>(FIELD_ADDR_CONST(p, offset))) 1261 (*reinterpret_cast<const intptr_t*>(FIELD_ADDR_CONST(p, offset)))
1297 1262
(...skipping 6060 matching lines...) Expand 10 before | Expand all | Expand 10 after
7358 #undef READ_SHORT_FIELD 7323 #undef READ_SHORT_FIELD
7359 #undef WRITE_SHORT_FIELD 7324 #undef WRITE_SHORT_FIELD
7360 #undef READ_BYTE_FIELD 7325 #undef READ_BYTE_FIELD
7361 #undef WRITE_BYTE_FIELD 7326 #undef WRITE_BYTE_FIELD
7362 #undef NOBARRIER_READ_BYTE_FIELD 7327 #undef NOBARRIER_READ_BYTE_FIELD
7363 #undef NOBARRIER_WRITE_BYTE_FIELD 7328 #undef NOBARRIER_WRITE_BYTE_FIELD
7364 7329
7365 } } // namespace v8::internal 7330 } } // namespace v8::internal
7366 7331
7367 #endif // V8_OBJECTS_INL_H_ 7332 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/deoptimizer.cc ('k') | src/utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698