| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 | 58 |
| 59 | 59 |
| 60 #define CAST_ACCESSOR(type) \ | 60 #define CAST_ACCESSOR(type) \ |
| 61 type* type::cast(Object* object) { \ | 61 type* type::cast(Object* object) { \ |
| 62 SLOW_ASSERT(object->Is##type()); \ | 62 SLOW_ASSERT(object->Is##type()); \ |
| 63 return reinterpret_cast<type*>(object); \ | 63 return reinterpret_cast<type*>(object); \ |
| 64 } | 64 } |
| 65 | 65 |
| 66 | 66 |
| 67 #define INT_ACCESSORS(holder, name, offset) \ | 67 #define INT_ACCESSORS(holder, name, offset) \ |
| 68 int holder::name() { return READ_INT_FIELD(this, offset); } \ | 68 int holder::name() { return Heap::read_int_field(this, offset); } \ |
| 69 void holder::set_##name(int value) { WRITE_INT_FIELD(this, offset, value); } | 69 void holder::set_##name(int value) { \ |
| 70 Heap::write_int_field(this, offset, value); } |
| 70 | 71 |
| 71 | 72 |
| 72 #define ACCESSORS(holder, name, type, offset) \ | 73 #define ACCESSORS(holder, name, type, offset) \ |
| 73 type* holder::name() { return type::cast(READ_FIELD(this, offset)); } \ | 74 type* holder::name() { return type::cast(Heap::read_field(this, offset)); } \ |
| 74 void holder::set_##name(type* value, WriteBarrierMode mode) { \ | 75 void holder::set_##name(type* value, WriteBarrierMode mode) { \ |
| 75 WRITE_FIELD(this, offset, value); \ | 76 Heap::write_field(this, offset, value, mode); \ |
| 76 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, offset, value, mode); \ | |
| 77 } | 77 } |
| 78 | 78 |
| 79 | 79 |
| 80 // Getter that returns a tagged Smi and setter that writes a tagged Smi. | 80 // Getter that returns a tagged Smi and setter that writes a tagged Smi. |
| 81 #define ACCESSORS_TO_SMI(holder, name, offset) \ | 81 #define ACCESSORS_TO_SMI(holder, name, offset) \ |
| 82 Smi* holder::name() { return Smi::cast(READ_FIELD(this, offset)); } \ | 82 Smi* holder::name() { return Smi::cast(Heap::read_field(this, offset)); } \ |
| 83 void holder::set_##name(Smi* value, WriteBarrierMode mode) { \ | 83 void holder::set_##name(Smi* value, WriteBarrierMode mode) { \ |
| 84 WRITE_FIELD(this, offset, value); \ | 84 Heap::write_field(this, offset, value, SKIP_WRITE_BARRIER); \ |
| 85 } | 85 } |
| 86 | 86 |
| 87 | 87 |
| 88 // Getter that returns a Smi as an int and writes an int as a Smi. | 88 // Getter that returns a Smi as an int and writes an int as a Smi. |
| 89 #define SMI_ACCESSORS(holder, name, offset) \ | 89 #define SMI_ACCESSORS(holder, name, offset) \ |
| 90 int holder::name() { \ | 90 int holder::name() { \ |
| 91 Object* value = READ_FIELD(this, offset); \ | 91 Object* value = Heap::read_field(this, offset); \ |
| 92 return Smi::cast(value)->value(); \ | 92 return Smi::cast(value)->value(); \ |
| 93 } \ | 93 } \ |
| 94 void holder::set_##name(int value) { \ | 94 void holder::set_##name(int value) { \ |
| 95 WRITE_FIELD(this, offset, Smi::FromInt(value)); \ | 95 Heap::write_field(this, offset, \ |
| 96 Smi::FromInt(value), SKIP_WRITE_BARRIER); \ |
| 96 } | 97 } |
| 97 | 98 |
| 98 #define SYNCHRONIZED_SMI_ACCESSORS(holder, name, offset) \ | 99 #define SYNCHRONIZED_SMI_ACCESSORS(holder, name, offset) \ |
| 99 int holder::synchronized_##name() { \ | 100 int holder::synchronized_##name() { \ |
| 100 Object* value = ACQUIRE_READ_FIELD(this, offset); \ | 101 Object* value = Heap::acquire_read_field(this, offset); \ |
| 101 return Smi::cast(value)->value(); \ | 102 return Smi::cast(value)->value(); \ |
| 102 } \ | 103 } \ |
| 103 void holder::synchronized_set_##name(int value) { \ | 104 void holder::synchronized_set_##name(int value) { \ |
| 104 RELEASE_WRITE_FIELD(this, offset, Smi::FromInt(value)); \ | 105 Heap::release_write_field(this, offset, Smi::FromInt(value)); \ |
| 105 } | 106 } |
| 106 | 107 |
| 107 #define NOBARRIER_SMI_ACCESSORS(holder, name, offset) \ | 108 #define NOBARRIER_SMI_ACCESSORS(holder, name, offset) \ |
| 108 int holder::nobarrier_##name() { \ | 109 int holder::nobarrier_##name() { \ |
| 109 Object* value = NOBARRIER_READ_FIELD(this, offset); \ | 110 Object* value = Heap::nobarrier_read_field(this, offset); \ |
| 110 return Smi::cast(value)->value(); \ | 111 return Smi::cast(value)->value(); \ |
| 111 } \ | 112 } \ |
| 112 void holder::nobarrier_set_##name(int value) { \ | 113 void holder::nobarrier_set_##name(int value) { \ |
| 113 NOBARRIER_WRITE_FIELD(this, offset, Smi::FromInt(value)); \ | 114 Heap::nobarrier_write_field(this, offset, Smi::FromInt(value)); \ |
| 114 } | 115 } |
| 115 | 116 |
| 116 #define BOOL_GETTER(holder, field, name, offset) \ | 117 #define BOOL_GETTER(holder, field, name, offset) \ |
| 117 bool holder::name() { \ | 118 bool holder::name() { \ |
| 118 return BooleanBit::get(field(), offset); \ | 119 return BooleanBit::get(field(), offset); \ |
| 119 } \ | 120 } \ |
| 120 | 121 |
| 121 | 122 |
| 122 #define BOOL_ACCESSORS(holder, field, name, offset) \ | 123 #define BOOL_ACCESSORS(holder, field, name, offset) \ |
| 123 bool holder::name() { \ | 124 bool holder::name() { \ |
| (...skipping 998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1122 } | 1123 } |
| 1123 | 1124 |
| 1124 | 1125 |
| 1125 bool JSProxy::HasElementWithHandler(Handle<JSProxy> proxy, uint32_t index) { | 1126 bool JSProxy::HasElementWithHandler(Handle<JSProxy> proxy, uint32_t index) { |
| 1126 Isolate* isolate = proxy->GetIsolate(); | 1127 Isolate* isolate = proxy->GetIsolate(); |
| 1127 Handle<String> name = isolate->factory()->Uint32ToString(index); | 1128 Handle<String> name = isolate->factory()->Uint32ToString(index); |
| 1128 return HasPropertyWithHandler(proxy, name); | 1129 return HasPropertyWithHandler(proxy, name); |
| 1129 } | 1130 } |
| 1130 | 1131 |
| 1131 | 1132 |
| 1132 #define FIELD_ADDR(p, offset) \ | |
| 1133 (reinterpret_cast<byte*>(p) + offset - kHeapObjectTag) | |
| 1134 | |
| 1135 #define READ_FIELD(p, offset) \ | |
| 1136 (*reinterpret_cast<Object**>(FIELD_ADDR(p, offset))) | |
| 1137 | |
| 1138 #define ACQUIRE_READ_FIELD(p, offset) \ | |
| 1139 reinterpret_cast<Object*>( \ | |
| 1140 Acquire_Load(reinterpret_cast<AtomicWord*>(FIELD_ADDR(p, offset)))) | |
| 1141 | |
| 1142 #define NOBARRIER_READ_FIELD(p, offset) \ | |
| 1143 reinterpret_cast<Object*>( \ | |
| 1144 NoBarrier_Load(reinterpret_cast<AtomicWord*>(FIELD_ADDR(p, offset)))) | |
| 1145 | |
| 1146 #define WRITE_FIELD(p, offset, value) \ | |
| 1147 (*reinterpret_cast<Object**>(FIELD_ADDR(p, offset)) = value) | |
| 1148 | |
| 1149 #define RELEASE_WRITE_FIELD(p, offset, value) \ | |
| 1150 Release_Store(reinterpret_cast<AtomicWord*>(FIELD_ADDR(p, offset)), \ | |
| 1151 reinterpret_cast<AtomicWord>(value)); | |
| 1152 | |
| 1153 #define NOBARRIER_WRITE_FIELD(p, offset, value) \ | |
| 1154 NoBarrier_Store(reinterpret_cast<AtomicWord*>(FIELD_ADDR(p, offset)), \ | |
| 1155 reinterpret_cast<AtomicWord>(value)); | |
| 1156 | |
| 1157 #define WRITE_BARRIER(heap, object, offset, value) \ | |
| 1158 heap->incremental_marking()->RecordWrite( \ | |
| 1159 object, HeapObject::RawField(object, offset), value); \ | |
| 1160 if (heap->InNewSpace(value)) { \ | |
| 1161 heap->RecordWrite(object->address(), offset); \ | |
| 1162 } | |
| 1163 | |
| 1164 #define CONDITIONAL_WRITE_BARRIER(heap, object, offset, value, mode) \ | |
| 1165 if (mode == UPDATE_WRITE_BARRIER) { \ | |
| 1166 heap->incremental_marking()->RecordWrite( \ | |
| 1167 object, HeapObject::RawField(object, offset), value); \ | |
| 1168 if (heap->InNewSpace(value)) { \ | |
| 1169 heap->RecordWrite(object->address(), offset); \ | |
| 1170 } \ | |
| 1171 } | |
| 1172 | |
| 1173 #ifndef V8_TARGET_ARCH_MIPS | |
| 1174 #define READ_DOUBLE_FIELD(p, offset) \ | |
| 1175 (*reinterpret_cast<double*>(FIELD_ADDR(p, offset))) | |
| 1176 #else // V8_TARGET_ARCH_MIPS | |
| 1177 // Prevent gcc from using load-double (mips ldc1) on (possibly) | |
| 1178 // non-64-bit aligned HeapNumber::value. | |
| 1179 static inline double read_double_field(void* p, int offset) { | |
| 1180 union conversion { | |
| 1181 double d; | |
| 1182 uint32_t u[2]; | |
| 1183 } c; | |
| 1184 c.u[0] = (*reinterpret_cast<uint32_t*>(FIELD_ADDR(p, offset))); | |
| 1185 c.u[1] = (*reinterpret_cast<uint32_t*>(FIELD_ADDR(p, offset + 4))); | |
| 1186 return c.d; | |
| 1187 } | |
| 1188 #define READ_DOUBLE_FIELD(p, offset) read_double_field(p, offset) | |
| 1189 #endif // V8_TARGET_ARCH_MIPS | |
| 1190 | |
| 1191 #ifndef V8_TARGET_ARCH_MIPS | |
| 1192 #define WRITE_DOUBLE_FIELD(p, offset, value) \ | |
| 1193 (*reinterpret_cast<double*>(FIELD_ADDR(p, offset)) = value) | |
| 1194 #else // V8_TARGET_ARCH_MIPS | |
| 1195 // Prevent gcc from using store-double (mips sdc1) on (possibly) | |
| 1196 // non-64-bit aligned HeapNumber::value. | |
| 1197 static inline void write_double_field(void* p, int offset, | |
| 1198 double value) { | |
| 1199 union conversion { | |
| 1200 double d; | |
| 1201 uint32_t u[2]; | |
| 1202 } c; | |
| 1203 c.d = value; | |
| 1204 (*reinterpret_cast<uint32_t*>(FIELD_ADDR(p, offset))) = c.u[0]; | |
| 1205 (*reinterpret_cast<uint32_t*>(FIELD_ADDR(p, offset + 4))) = c.u[1]; | |
| 1206 } | |
| 1207 #define WRITE_DOUBLE_FIELD(p, offset, value) \ | |
| 1208 write_double_field(p, offset, value) | |
| 1209 #endif // V8_TARGET_ARCH_MIPS | |
| 1210 | |
| 1211 | |
| 1212 #define READ_INT_FIELD(p, offset) \ | |
| 1213 (*reinterpret_cast<int*>(FIELD_ADDR(p, offset))) | |
| 1214 | |
| 1215 #define WRITE_INT_FIELD(p, offset, value) \ | |
| 1216 (*reinterpret_cast<int*>(FIELD_ADDR(p, offset)) = value) | |
| 1217 | |
| 1218 #define READ_INTPTR_FIELD(p, offset) \ | |
| 1219 (*reinterpret_cast<intptr_t*>(FIELD_ADDR(p, offset))) | |
| 1220 | |
| 1221 #define WRITE_INTPTR_FIELD(p, offset, value) \ | |
| 1222 (*reinterpret_cast<intptr_t*>(FIELD_ADDR(p, offset)) = value) | |
| 1223 | |
| 1224 #define READ_UINT32_FIELD(p, offset) \ | |
| 1225 (*reinterpret_cast<uint32_t*>(FIELD_ADDR(p, offset))) | |
| 1226 | |
| 1227 #define WRITE_UINT32_FIELD(p, offset, value) \ | |
| 1228 (*reinterpret_cast<uint32_t*>(FIELD_ADDR(p, offset)) = value) | |
| 1229 | |
| 1230 #define READ_INT32_FIELD(p, offset) \ | |
| 1231 (*reinterpret_cast<int32_t*>(FIELD_ADDR(p, offset))) | |
| 1232 | |
| 1233 #define WRITE_INT32_FIELD(p, offset, value) \ | |
| 1234 (*reinterpret_cast<int32_t*>(FIELD_ADDR(p, offset)) = value) | |
| 1235 | |
| 1236 #define READ_INT64_FIELD(p, offset) \ | |
| 1237 (*reinterpret_cast<int64_t*>(FIELD_ADDR(p, offset))) | |
| 1238 | |
| 1239 #define WRITE_INT64_FIELD(p, offset, value) \ | |
| 1240 (*reinterpret_cast<int64_t*>(FIELD_ADDR(p, offset)) = value) | |
| 1241 | |
| 1242 #define READ_SHORT_FIELD(p, offset) \ | |
| 1243 (*reinterpret_cast<uint16_t*>(FIELD_ADDR(p, offset))) | |
| 1244 | |
| 1245 #define WRITE_SHORT_FIELD(p, offset, value) \ | |
| 1246 (*reinterpret_cast<uint16_t*>(FIELD_ADDR(p, offset)) = value) | |
| 1247 | |
| 1248 #define READ_BYTE_FIELD(p, offset) \ | |
| 1249 (*reinterpret_cast<byte*>(FIELD_ADDR(p, offset))) | |
| 1250 | |
| 1251 #define NOBARRIER_READ_BYTE_FIELD(p, offset) \ | |
| 1252 static_cast<byte>(NoBarrier_Load( \ | |
| 1253 reinterpret_cast<Atomic8*>(FIELD_ADDR(p, offset))) ) | |
| 1254 | |
| 1255 #define WRITE_BYTE_FIELD(p, offset, value) \ | |
| 1256 (*reinterpret_cast<byte*>(FIELD_ADDR(p, offset)) = value) | |
| 1257 | |
| 1258 #define NOBARRIER_WRITE_BYTE_FIELD(p, offset, value) \ | |
| 1259 NoBarrier_Store(reinterpret_cast<Atomic8*>(FIELD_ADDR(p, offset)), \ | |
| 1260 static_cast<Atomic8>(value)); | |
| 1261 | |
| 1262 Object** HeapObject::RawField(HeapObject* obj, int byte_offset) { | 1133 Object** HeapObject::RawField(HeapObject* obj, int byte_offset) { |
| 1263 return &READ_FIELD(obj, byte_offset); | 1134 return reinterpret_cast<Object**>(Heap::get_field_address(obj, byte_offset)); |
| 1264 } | 1135 } |
| 1265 | 1136 |
| 1266 | 1137 |
| 1267 int Smi::value() { | 1138 int Smi::value() { |
| 1268 return Internals::SmiValue(this); | 1139 return Internals::SmiValue(this); |
| 1269 } | 1140 } |
| 1270 | 1141 |
| 1271 | 1142 |
| 1272 Smi* Smi::FromInt(int value) { | 1143 Smi* Smi::FromInt(int value) { |
| 1273 ASSERT(Smi::IsValid(value)); | 1144 ASSERT(Smi::IsValid(value)); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1352 | 1223 |
| 1353 | 1224 |
| 1354 HeapObject* MapWord::ToForwardingAddress() { | 1225 HeapObject* MapWord::ToForwardingAddress() { |
| 1355 ASSERT(IsForwardingAddress()); | 1226 ASSERT(IsForwardingAddress()); |
| 1356 return HeapObject::FromAddress(reinterpret_cast<Address>(value_)); | 1227 return HeapObject::FromAddress(reinterpret_cast<Address>(value_)); |
| 1357 } | 1228 } |
| 1358 | 1229 |
| 1359 | 1230 |
| 1360 #ifdef VERIFY_HEAP | 1231 #ifdef VERIFY_HEAP |
| 1361 void HeapObject::VerifyObjectField(int offset) { | 1232 void HeapObject::VerifyObjectField(int offset) { |
| 1362 VerifyPointer(READ_FIELD(this, offset)); | 1233 VerifyPointer(Heap::read_field(this, offset)); |
| 1363 } | 1234 } |
| 1364 | 1235 |
| 1365 void HeapObject::VerifySmiField(int offset) { | 1236 void HeapObject::VerifySmiField(int offset) { |
| 1366 CHECK(READ_FIELD(this, offset)->IsSmi()); | 1237 CHECK(Heap::read_field(this, offset)->IsSmi()); |
| 1367 } | 1238 } |
| 1368 #endif | 1239 #endif |
| 1369 | 1240 |
| 1370 | 1241 |
| 1371 Heap* HeapObject::GetHeap() { | 1242 Heap* HeapObject::GetHeap() { |
| 1372 Heap* heap = | 1243 Heap* heap = |
| 1373 MemoryChunk::FromAddress(reinterpret_cast<Address>(this))->heap(); | 1244 MemoryChunk::FromAddress(reinterpret_cast<Address>(this))->heap(); |
| 1374 SLOW_ASSERT(heap != NULL); | 1245 SLOW_ASSERT(heap != NULL); |
| 1375 return heap; | 1246 return heap; |
| 1376 } | 1247 } |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1416 } | 1287 } |
| 1417 | 1288 |
| 1418 | 1289 |
| 1419 // Unsafe accessor omitting write barrier. | 1290 // Unsafe accessor omitting write barrier. |
| 1420 void HeapObject::set_map_no_write_barrier(Map* value) { | 1291 void HeapObject::set_map_no_write_barrier(Map* value) { |
| 1421 set_map_word(MapWord::FromMap(value)); | 1292 set_map_word(MapWord::FromMap(value)); |
| 1422 } | 1293 } |
| 1423 | 1294 |
| 1424 | 1295 |
| 1425 MapWord HeapObject::map_word() { | 1296 MapWord HeapObject::map_word() { |
| 1426 return MapWord( | 1297 return MapWord(reinterpret_cast<uintptr_t>( |
| 1427 reinterpret_cast<uintptr_t>(NOBARRIER_READ_FIELD(this, kMapOffset))); | 1298 Heap::nobarrier_read_field(this, kMapOffset))); |
| 1428 } | 1299 } |
| 1429 | 1300 |
| 1430 | 1301 |
| 1431 void HeapObject::set_map_word(MapWord map_word) { | 1302 void HeapObject::set_map_word(MapWord map_word) { |
| 1432 NOBARRIER_WRITE_FIELD( | 1303 Heap::nobarrier_write_field( |
| 1433 this, kMapOffset, reinterpret_cast<Object*>(map_word.value_)); | 1304 this, kMapOffset, reinterpret_cast<Object*>(map_word.value_)); |
| 1434 } | 1305 } |
| 1435 | 1306 |
| 1436 | 1307 |
| 1437 MapWord HeapObject::synchronized_map_word() { | 1308 MapWord HeapObject::synchronized_map_word() { |
| 1438 return MapWord( | 1309 return MapWord( |
| 1439 reinterpret_cast<uintptr_t>(ACQUIRE_READ_FIELD(this, kMapOffset))); | 1310 reinterpret_cast<uintptr_t>(Heap::acquire_read_field(this, kMapOffset))); |
| 1440 } | 1311 } |
| 1441 | 1312 |
| 1442 | 1313 |
| 1443 void HeapObject::synchronized_set_map_word(MapWord map_word) { | 1314 void HeapObject::synchronized_set_map_word(MapWord map_word) { |
| 1444 RELEASE_WRITE_FIELD( | 1315 Heap::release_write_field( |
| 1445 this, kMapOffset, reinterpret_cast<Object*>(map_word.value_)); | 1316 this, kMapOffset, reinterpret_cast<Object*>(map_word.value_)); |
| 1446 } | 1317 } |
| 1447 | 1318 |
| 1448 | 1319 |
| 1449 HeapObject* HeapObject::FromAddress(Address address) { | 1320 HeapObject* HeapObject::FromAddress(Address address) { |
| 1450 ASSERT_TAG_ALIGNED(address); | 1321 ASSERT_TAG_ALIGNED(address); |
| 1451 return reinterpret_cast<HeapObject*>(address + kHeapObjectTag); | 1322 return reinterpret_cast<HeapObject*>(address + kHeapObjectTag); |
| 1452 } | 1323 } |
| 1453 | 1324 |
| 1454 | 1325 |
| 1455 Address HeapObject::address() { | 1326 Address HeapObject::address() { |
| 1456 return reinterpret_cast<Address>(this) - kHeapObjectTag; | 1327 return reinterpret_cast<Address>(this) - kHeapObjectTag; |
| 1457 } | 1328 } |
| 1458 | 1329 |
| 1459 | 1330 |
| 1460 int HeapObject::Size() { | 1331 int HeapObject::Size() { |
| 1461 return SizeFromMap(map()); | 1332 return SizeFromMap(map()); |
| 1462 } | 1333 } |
| 1463 | 1334 |
| 1464 | 1335 |
| 1465 void HeapObject::IteratePointers(ObjectVisitor* v, int start, int end) { | 1336 void HeapObject::IteratePointers(ObjectVisitor* v, int start, int end) { |
| 1466 v->VisitPointers(reinterpret_cast<Object**>(FIELD_ADDR(this, start)), | 1337 v->VisitPointers( |
| 1467 reinterpret_cast<Object**>(FIELD_ADDR(this, end))); | 1338 reinterpret_cast<Object**>(Heap::get_field_address(this, start)), |
| 1339 reinterpret_cast<Object**>(Heap::get_field_address(this, end))); |
| 1468 } | 1340 } |
| 1469 | 1341 |
| 1470 | 1342 |
| 1471 void HeapObject::IteratePointer(ObjectVisitor* v, int offset) { | 1343 void HeapObject::IteratePointer(ObjectVisitor* v, int offset) { |
| 1472 v->VisitPointer(reinterpret_cast<Object**>(FIELD_ADDR(this, offset))); | 1344 v->VisitPointer( |
| 1345 reinterpret_cast<Object**>(Heap::get_field_address(this, offset))); |
| 1473 } | 1346 } |
| 1474 | 1347 |
| 1475 | 1348 |
| 1476 void HeapObject::IterateNextCodeLink(ObjectVisitor* v, int offset) { | 1349 void HeapObject::IterateNextCodeLink(ObjectVisitor* v, int offset) { |
| 1477 v->VisitNextCodeLink(reinterpret_cast<Object**>(FIELD_ADDR(this, offset))); | 1350 v->VisitNextCodeLink( |
| 1351 reinterpret_cast<Object**>(Heap::get_field_address(this, offset))); |
| 1478 } | 1352 } |
| 1479 | 1353 |
| 1480 | 1354 |
| 1481 double HeapNumber::value() { | 1355 double HeapNumber::value() { |
| 1482 return READ_DOUBLE_FIELD(this, kValueOffset); | 1356 return Heap::read_double_field(this, kValueOffset); |
| 1483 } | 1357 } |
| 1484 | 1358 |
| 1485 | 1359 |
| 1486 void HeapNumber::set_value(double value) { | 1360 void HeapNumber::set_value(double value) { |
| 1487 WRITE_DOUBLE_FIELD(this, kValueOffset, value); | 1361 Heap::write_double_field(this, kValueOffset, value); |
| 1488 } | 1362 } |
| 1489 | 1363 |
| 1490 | 1364 |
| 1491 int HeapNumber::get_exponent() { | 1365 int HeapNumber::get_exponent() { |
| 1492 return ((READ_INT_FIELD(this, kExponentOffset) & kExponentMask) >> | 1366 return ((Heap::read_int_field(this, kExponentOffset) & kExponentMask) >> |
| 1493 kExponentShift) - kExponentBias; | 1367 kExponentShift) - kExponentBias; |
| 1494 } | 1368 } |
| 1495 | 1369 |
| 1496 | 1370 |
| 1497 int HeapNumber::get_sign() { | 1371 int HeapNumber::get_sign() { |
| 1498 return READ_INT_FIELD(this, kExponentOffset) & kSignMask; | 1372 return Heap::read_int_field(this, kExponentOffset) & kSignMask; |
| 1499 } | 1373 } |
| 1500 | 1374 |
| 1501 | 1375 |
| 1502 ACCESSORS(JSObject, properties, FixedArray, kPropertiesOffset) | 1376 ACCESSORS(JSObject, properties, FixedArray, kPropertiesOffset) |
| 1503 | 1377 |
| 1504 | 1378 |
| 1505 Object** FixedArray::GetFirstElementAddress() { | 1379 Object** FixedArray::GetFirstElementAddress() { |
| 1506 return reinterpret_cast<Object**>(FIELD_ADDR(this, OffsetOfElementAt(0))); | 1380 return reinterpret_cast<Object**>( |
| 1381 Heap::get_field_address(this, OffsetOfElementAt(0))); |
| 1507 } | 1382 } |
| 1508 | 1383 |
| 1509 | 1384 |
| 1510 bool FixedArray::ContainsOnlySmisOrHoles() { | 1385 bool FixedArray::ContainsOnlySmisOrHoles() { |
| 1511 Object* the_hole = GetHeap()->the_hole_value(); | 1386 Object* the_hole = GetHeap()->the_hole_value(); |
| 1512 Object** current = GetFirstElementAddress(); | 1387 Object** current = GetFirstElementAddress(); |
| 1513 for (int i = 0; i < length(); ++i) { | 1388 for (int i = 0; i < length(); ++i) { |
| 1514 Object* candidate = *current++; | 1389 Object* candidate = *current++; |
| 1515 if (!candidate->IsSmi() && candidate != the_hole) return false; | 1390 if (!candidate->IsSmi() && candidate != the_hole) return false; |
| 1516 } | 1391 } |
| 1517 return true; | 1392 return true; |
| 1518 } | 1393 } |
| 1519 | 1394 |
| 1520 | 1395 |
| 1521 FixedArrayBase* JSObject::elements() { | 1396 FixedArrayBase* JSObject::elements() { |
| 1522 Object* array = READ_FIELD(this, kElementsOffset); | 1397 Object* array = Heap::read_field(this, kElementsOffset); |
| 1523 return static_cast<FixedArrayBase*>(array); | 1398 return static_cast<FixedArrayBase*>(array); |
| 1524 } | 1399 } |
| 1525 | 1400 |
| 1526 | 1401 |
| 1527 void JSObject::ValidateElements(Handle<JSObject> object) { | 1402 void JSObject::ValidateElements(Handle<JSObject> object) { |
| 1528 #ifdef ENABLE_SLOW_ASSERTS | 1403 #ifdef ENABLE_SLOW_ASSERTS |
| 1529 if (FLAG_enable_slow_asserts) { | 1404 if (FLAG_enable_slow_asserts) { |
| 1530 ElementsAccessor* accessor = object->GetElementsAccessor(); | 1405 ElementsAccessor* accessor = object->GetElementsAccessor(); |
| 1531 accessor->Validate(object); | 1406 accessor->Validate(object); |
| 1532 } | 1407 } |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1765 (value->map() == object->GetHeap()->fixed_array_map() || | 1640 (value->map() == object->GetHeap()->fixed_array_map() || |
| 1766 value->map() == object->GetHeap()->fixed_cow_array_map())); | 1641 value->map() == object->GetHeap()->fixed_cow_array_map())); |
| 1767 ASSERT((*value == object->GetHeap()->empty_fixed_array()) || | 1642 ASSERT((*value == object->GetHeap()->empty_fixed_array()) || |
| 1768 (object->map()->has_fast_double_elements() == | 1643 (object->map()->has_fast_double_elements() == |
| 1769 value->IsFixedDoubleArray())); | 1644 value->IsFixedDoubleArray())); |
| 1770 object->set_elements(*value); | 1645 object->set_elements(*value); |
| 1771 } | 1646 } |
| 1772 | 1647 |
| 1773 | 1648 |
| 1774 void JSObject::set_elements(FixedArrayBase* value, WriteBarrierMode mode) { | 1649 void JSObject::set_elements(FixedArrayBase* value, WriteBarrierMode mode) { |
| 1775 WRITE_FIELD(this, kElementsOffset, value); | 1650 Heap::write_field(this, kElementsOffset, value, mode); |
| 1776 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kElementsOffset, value, mode); | |
| 1777 } | 1651 } |
| 1778 | 1652 |
| 1779 | 1653 |
| 1780 void JSObject::initialize_properties() { | 1654 void JSObject::initialize_properties() { |
| 1781 ASSERT(!GetHeap()->InNewSpace(GetHeap()->empty_fixed_array())); | 1655 ASSERT(!GetHeap()->InNewSpace(GetHeap()->empty_fixed_array())); |
| 1782 WRITE_FIELD(this, kPropertiesOffset, GetHeap()->empty_fixed_array()); | 1656 Heap::write_field(this, |
| 1657 kPropertiesOffset, |
| 1658 GetHeap()->empty_fixed_array(), |
| 1659 SKIP_WRITE_BARRIER); |
| 1783 } | 1660 } |
| 1784 | 1661 |
| 1785 | 1662 |
| 1786 void JSObject::initialize_elements() { | 1663 void JSObject::initialize_elements() { |
| 1787 FixedArrayBase* elements = map()->GetInitialElements(); | 1664 FixedArrayBase* elements = map()->GetInitialElements(); |
| 1788 WRITE_FIELD(this, kElementsOffset, elements); | 1665 Heap::write_field(this, kElementsOffset, elements, SKIP_WRITE_BARRIER); |
| 1789 } | 1666 } |
| 1790 | 1667 |
| 1791 | 1668 |
| 1792 Handle<String> JSObject::ExpectedTransitionKey(Handle<Map> map) { | 1669 Handle<String> JSObject::ExpectedTransitionKey(Handle<Map> map) { |
| 1793 DisallowHeapAllocation no_gc; | 1670 DisallowHeapAllocation no_gc; |
| 1794 if (!map->HasTransitionArray()) return Handle<String>::null(); | 1671 if (!map->HasTransitionArray()) return Handle<String>::null(); |
| 1795 TransitionArray* transitions = map->transitions(); | 1672 TransitionArray* transitions = map->transitions(); |
| 1796 if (!transitions->IsSimpleTransition()) return Handle<String>::null(); | 1673 if (!transitions->IsSimpleTransition()) return Handle<String>::null(); |
| 1797 int transition = TransitionArray::kSimpleTransitionIndex; | 1674 int transition = TransitionArray::kSimpleTransitionIndex; |
| 1798 PropertyDetails details = transitions->GetTargetDetails(transition); | 1675 PropertyDetails details = transitions->GetTargetDetails(transition); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1822 if (target_details.attributes() != NONE) return Handle<Map>::null(); | 1699 if (target_details.attributes() != NONE) return Handle<Map>::null(); |
| 1823 return Handle<Map>(transitions->GetTarget(transition)); | 1700 return Handle<Map>(transitions->GetTarget(transition)); |
| 1824 } | 1701 } |
| 1825 | 1702 |
| 1826 | 1703 |
| 1827 ACCESSORS(Oddball, to_string, String, kToStringOffset) | 1704 ACCESSORS(Oddball, to_string, String, kToStringOffset) |
| 1828 ACCESSORS(Oddball, to_number, Object, kToNumberOffset) | 1705 ACCESSORS(Oddball, to_number, Object, kToNumberOffset) |
| 1829 | 1706 |
| 1830 | 1707 |
| 1831 byte Oddball::kind() { | 1708 byte Oddball::kind() { |
| 1832 return Smi::cast(READ_FIELD(this, kKindOffset))->value(); | 1709 return Smi::cast(Heap::read_field(this, kKindOffset))->value(); |
| 1833 } | 1710 } |
| 1834 | 1711 |
| 1835 | 1712 |
| 1836 void Oddball::set_kind(byte value) { | 1713 void Oddball::set_kind(byte value) { |
| 1837 WRITE_FIELD(this, kKindOffset, Smi::FromInt(value)); | 1714 Heap::write_field(this, kKindOffset, Smi::FromInt(value), SKIP_WRITE_BARRIER); |
| 1838 } | 1715 } |
| 1839 | 1716 |
| 1840 | 1717 |
| 1841 Object* Cell::value() { | 1718 Object* Cell::value() { |
| 1842 return READ_FIELD(this, kValueOffset); | 1719 return Heap::read_field(this, kValueOffset); |
| 1843 } | 1720 } |
| 1844 | 1721 |
| 1845 | 1722 |
| 1846 void Cell::set_value(Object* val, WriteBarrierMode ignored) { | 1723 void Cell::set_value(Object* val, WriteBarrierMode ignored) { |
| 1847 // The write barrier is not used for global property cells. | 1724 // The write barrier is not used for global property cells. |
| 1848 ASSERT(!val->IsPropertyCell() && !val->IsCell()); | 1725 ASSERT(!val->IsPropertyCell() && !val->IsCell()); |
| 1849 WRITE_FIELD(this, kValueOffset, val); | 1726 Heap::write_field(this, kValueOffset, val, SKIP_WRITE_BARRIER); |
| 1850 } | 1727 } |
| 1851 | 1728 |
| 1852 ACCESSORS(PropertyCell, dependent_code, DependentCode, kDependentCodeOffset) | 1729 ACCESSORS(PropertyCell, dependent_code, DependentCode, kDependentCodeOffset) |
| 1853 | 1730 |
| 1854 Object* PropertyCell::type_raw() { | 1731 Object* PropertyCell::type_raw() { |
| 1855 return READ_FIELD(this, kTypeOffset); | 1732 return Heap::read_field(this, kTypeOffset); |
| 1856 } | 1733 } |
| 1857 | 1734 |
| 1858 | 1735 |
| 1859 void PropertyCell::set_type_raw(Object* val, WriteBarrierMode ignored) { | 1736 void PropertyCell::set_type_raw(Object* val, WriteBarrierMode ignored) { |
| 1860 WRITE_FIELD(this, kTypeOffset, val); | 1737 Heap::write_field(this, kTypeOffset, val, SKIP_WRITE_BARRIER); |
| 1861 } | 1738 } |
| 1862 | 1739 |
| 1863 | 1740 |
| 1864 int JSObject::GetHeaderSize() { | 1741 int JSObject::GetHeaderSize() { |
| 1865 InstanceType type = map()->instance_type(); | 1742 InstanceType type = map()->instance_type(); |
| 1866 // Check for the most common kind of JavaScript object before | 1743 // Check for the most common kind of JavaScript object before |
| 1867 // falling into the generic switch. This speeds up the internal | 1744 // falling into the generic switch. This speeds up the internal |
| 1868 // field operations considerably on average. | 1745 // field operations considerably on average. |
| 1869 if (type == JS_OBJECT_TYPE) return JSObject::kHeaderSize; | 1746 if (type == JS_OBJECT_TYPE) return JSObject::kHeaderSize; |
| 1870 switch (type) { | 1747 switch (type) { |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1932 ASSERT(index < GetInternalFieldCount() && index >= 0); | 1809 ASSERT(index < GetInternalFieldCount() && index >= 0); |
| 1933 return GetHeaderSize() + (kPointerSize * index); | 1810 return GetHeaderSize() + (kPointerSize * index); |
| 1934 } | 1811 } |
| 1935 | 1812 |
| 1936 | 1813 |
| 1937 Object* JSObject::GetInternalField(int index) { | 1814 Object* JSObject::GetInternalField(int index) { |
| 1938 ASSERT(index < GetInternalFieldCount() && index >= 0); | 1815 ASSERT(index < GetInternalFieldCount() && index >= 0); |
| 1939 // Internal objects do follow immediately after the header, whereas in-object | 1816 // Internal objects do follow immediately after the header, whereas in-object |
| 1940 // properties are at the end of the object. Therefore there is no need | 1817 // properties are at the end of the object. Therefore there is no need |
| 1941 // to adjust the index here. | 1818 // to adjust the index here. |
| 1942 return READ_FIELD(this, GetHeaderSize() + (kPointerSize * index)); | 1819 return Heap::read_field(this, GetHeaderSize() + (kPointerSize * index)); |
| 1943 } | 1820 } |
| 1944 | 1821 |
| 1945 | 1822 |
| 1946 void JSObject::SetInternalField(int index, Object* value) { | 1823 void JSObject::SetInternalField(int index, Object* value) { |
| 1947 ASSERT(index < GetInternalFieldCount() && index >= 0); | 1824 ASSERT(index < GetInternalFieldCount() && index >= 0); |
| 1948 // Internal objects do follow immediately after the header, whereas in-object | 1825 // Internal objects do follow immediately after the header, whereas in-object |
| 1949 // properties are at the end of the object. Therefore there is no need | 1826 // properties are at the end of the object. Therefore there is no need |
| 1950 // to adjust the index here. | 1827 // to adjust the index here. |
| 1951 int offset = GetHeaderSize() + (kPointerSize * index); | 1828 int offset = GetHeaderSize() + (kPointerSize * index); |
| 1952 WRITE_FIELD(this, offset, value); | 1829 Heap::write_field(this, offset, value, UPDATE_WRITE_BARRIER); |
| 1953 WRITE_BARRIER(GetHeap(), this, offset, value); | |
| 1954 } | 1830 } |
| 1955 | 1831 |
| 1956 | 1832 |
| 1957 void JSObject::SetInternalField(int index, Smi* value) { | 1833 void JSObject::SetInternalField(int index, Smi* value) { |
| 1958 ASSERT(index < GetInternalFieldCount() && index >= 0); | 1834 ASSERT(index < GetInternalFieldCount() && index >= 0); |
| 1959 // Internal objects do follow immediately after the header, whereas in-object | 1835 // Internal objects do follow immediately after the header, whereas in-object |
| 1960 // properties are at the end of the object. Therefore there is no need | 1836 // properties are at the end of the object. Therefore there is no need |
| 1961 // to adjust the index here. | 1837 // to adjust the index here. |
| 1962 int offset = GetHeaderSize() + (kPointerSize * index); | 1838 int offset = GetHeaderSize() + (kPointerSize * index); |
| 1963 WRITE_FIELD(this, offset, value); | 1839 Heap::write_field(this, offset, value, SKIP_WRITE_BARRIER); |
| 1964 } | 1840 } |
| 1965 | 1841 |
| 1966 | 1842 |
| 1967 // Access fast-case object properties at index. The use of these routines | 1843 // Access fast-case object properties at index. The use of these routines |
| 1968 // is needed to correctly distinguish between properties stored in-object and | 1844 // is needed to correctly distinguish between properties stored in-object and |
| 1969 // properties stored in the properties array. | 1845 // properties stored in the properties array. |
| 1970 Object* JSObject::RawFastPropertyAt(int index) { | 1846 Object* JSObject::RawFastPropertyAt(int index) { |
| 1971 // Adjust for the number of properties stored in the object. | 1847 // Adjust for the number of properties stored in the object. |
| 1972 index -= map()->inobject_properties(); | 1848 index -= map()->inobject_properties(); |
| 1973 if (index < 0) { | 1849 if (index < 0) { |
| 1974 int offset = map()->instance_size() + (index * kPointerSize); | 1850 int offset = map()->instance_size() + (index * kPointerSize); |
| 1975 return READ_FIELD(this, offset); | 1851 return Heap::read_field(this, offset); |
| 1976 } else { | 1852 } else { |
| 1977 ASSERT(index < properties()->length()); | 1853 ASSERT(index < properties()->length()); |
| 1978 return properties()->get(index); | 1854 return properties()->get(index); |
| 1979 } | 1855 } |
| 1980 } | 1856 } |
| 1981 | 1857 |
| 1982 | 1858 |
| 1983 void JSObject::FastPropertyAtPut(int index, Object* value) { | 1859 void JSObject::FastPropertyAtPut(int index, Object* value) { |
| 1984 // Adjust for the number of properties stored in the object. | 1860 // Adjust for the number of properties stored in the object. |
| 1985 index -= map()->inobject_properties(); | 1861 index -= map()->inobject_properties(); |
| 1986 if (index < 0) { | 1862 if (index < 0) { |
| 1987 int offset = map()->instance_size() + (index * kPointerSize); | 1863 int offset = map()->instance_size() + (index * kPointerSize); |
| 1988 WRITE_FIELD(this, offset, value); | 1864 Heap::write_field(this, offset, value, UPDATE_WRITE_BARRIER); |
| 1989 WRITE_BARRIER(GetHeap(), this, offset, value); | |
| 1990 } else { | 1865 } else { |
| 1991 ASSERT(index < properties()->length()); | 1866 ASSERT(index < properties()->length()); |
| 1992 properties()->set(index, value); | 1867 properties()->set(index, value); |
| 1993 } | 1868 } |
| 1994 } | 1869 } |
| 1995 | 1870 |
| 1996 | 1871 |
| 1997 int JSObject::GetInObjectPropertyOffset(int index) { | 1872 int JSObject::GetInObjectPropertyOffset(int index) { |
| 1998 return map()->GetInObjectPropertyOffset(index); | 1873 return map()->GetInObjectPropertyOffset(index); |
| 1999 } | 1874 } |
| 2000 | 1875 |
| 2001 | 1876 |
| 2002 Object* JSObject::InObjectPropertyAt(int index) { | 1877 Object* JSObject::InObjectPropertyAt(int index) { |
| 2003 int offset = GetInObjectPropertyOffset(index); | 1878 int offset = GetInObjectPropertyOffset(index); |
| 2004 return READ_FIELD(this, offset); | 1879 return Heap::read_field(this, offset); |
| 2005 } | 1880 } |
| 2006 | 1881 |
| 2007 | 1882 |
| 2008 Object* JSObject::InObjectPropertyAtPut(int index, | 1883 Object* JSObject::InObjectPropertyAtPut(int index, |
| 2009 Object* value, | 1884 Object* value, |
| 2010 WriteBarrierMode mode) { | 1885 WriteBarrierMode mode) { |
| 2011 // Adjust for the number of properties stored in the object. | 1886 // Adjust for the number of properties stored in the object. |
| 2012 int offset = GetInObjectPropertyOffset(index); | 1887 int offset = GetInObjectPropertyOffset(index); |
| 2013 WRITE_FIELD(this, offset, value); | 1888 Heap::write_field(this, offset, value, mode); |
| 2014 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, offset, value, mode); | |
| 2015 return value; | 1889 return value; |
| 2016 } | 1890 } |
| 2017 | 1891 |
| 2018 | 1892 |
| 2019 | 1893 |
| 2020 void JSObject::InitializeBody(Map* map, | 1894 void JSObject::InitializeBody(Map* map, |
| 2021 Object* pre_allocated_value, | 1895 Object* pre_allocated_value, |
| 2022 Object* filler_value) { | 1896 Object* filler_value) { |
| 2023 ASSERT(!filler_value->IsHeapObject() || | 1897 ASSERT(!filler_value->IsHeapObject() || |
| 2024 !GetHeap()->InNewSpace(filler_value)); | 1898 !GetHeap()->InNewSpace(filler_value)); |
| 2025 ASSERT(!pre_allocated_value->IsHeapObject() || | 1899 ASSERT(!pre_allocated_value->IsHeapObject() || |
| 2026 !GetHeap()->InNewSpace(pre_allocated_value)); | 1900 !GetHeap()->InNewSpace(pre_allocated_value)); |
| 2027 int size = map->instance_size(); | 1901 int size = map->instance_size(); |
| 2028 int offset = kHeaderSize; | 1902 int offset = kHeaderSize; |
| 2029 if (filler_value != pre_allocated_value) { | 1903 if (filler_value != pre_allocated_value) { |
| 2030 int pre_allocated = map->pre_allocated_property_fields(); | 1904 int pre_allocated = map->pre_allocated_property_fields(); |
| 2031 ASSERT(pre_allocated * kPointerSize + kHeaderSize <= size); | 1905 ASSERT(pre_allocated * kPointerSize + kHeaderSize <= size); |
| 2032 for (int i = 0; i < pre_allocated; i++) { | 1906 for (int i = 0; i < pre_allocated; i++) { |
| 2033 WRITE_FIELD(this, offset, pre_allocated_value); | 1907 Heap::write_field(this, offset, pre_allocated_value, SKIP_WRITE_BARRIER); |
| 2034 offset += kPointerSize; | 1908 offset += kPointerSize; |
| 2035 } | 1909 } |
| 2036 } | 1910 } |
| 2037 while (offset < size) { | 1911 while (offset < size) { |
| 2038 WRITE_FIELD(this, offset, filler_value); | 1912 Heap::write_field(this, offset, filler_value, SKIP_WRITE_BARRIER); |
| 2039 offset += kPointerSize; | 1913 offset += kPointerSize; |
| 2040 } | 1914 } |
| 2041 } | 1915 } |
| 2042 | 1916 |
| 2043 | 1917 |
| 2044 bool JSObject::HasFastProperties() { | 1918 bool JSObject::HasFastProperties() { |
| 2045 ASSERT(properties()->IsDictionary() == map()->is_dictionary_map()); | 1919 ASSERT(properties()->IsDictionary() == map()->is_dictionary_map()); |
| 2046 return !properties()->IsDictionary(); | 1920 return !properties()->IsDictionary(); |
| 2047 } | 1921 } |
| 2048 | 1922 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 2063 } else { | 1937 } else { |
| 2064 limit = Max(inobject, kFastPropertiesSoftLimit); | 1938 limit = Max(inobject, kFastPropertiesSoftLimit); |
| 2065 } | 1939 } |
| 2066 return properties()->length() > limit; | 1940 return properties()->length() > limit; |
| 2067 } | 1941 } |
| 2068 | 1942 |
| 2069 | 1943 |
| 2070 void Struct::InitializeBody(int object_size) { | 1944 void Struct::InitializeBody(int object_size) { |
| 2071 Object* value = GetHeap()->undefined_value(); | 1945 Object* value = GetHeap()->undefined_value(); |
| 2072 for (int offset = kHeaderSize; offset < object_size; offset += kPointerSize) { | 1946 for (int offset = kHeaderSize; offset < object_size; offset += kPointerSize) { |
| 2073 WRITE_FIELD(this, offset, value); | 1947 Heap::write_field(this, offset, value, SKIP_WRITE_BARRIER); |
| 2074 } | 1948 } |
| 2075 } | 1949 } |
| 2076 | 1950 |
| 2077 | 1951 |
| 2078 bool Object::ToArrayIndex(uint32_t* index) { | 1952 bool Object::ToArrayIndex(uint32_t* index) { |
| 2079 if (IsSmi()) { | 1953 if (IsSmi()) { |
| 2080 int value = Smi::cast(this)->value(); | 1954 int value = Smi::cast(this)->value(); |
| 2081 if (value < 0) return false; | 1955 if (value < 0) return false; |
| 2082 *index = value; | 1956 *index = value; |
| 2083 return true; | 1957 return true; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2125 | 1999 |
| 2126 | 2000 |
| 2127 FixedArrayBase* FixedArrayBase::cast(Object* object) { | 2001 FixedArrayBase* FixedArrayBase::cast(Object* object) { |
| 2128 ASSERT(object->IsFixedArrayBase()); | 2002 ASSERT(object->IsFixedArrayBase()); |
| 2129 return reinterpret_cast<FixedArrayBase*>(object); | 2003 return reinterpret_cast<FixedArrayBase*>(object); |
| 2130 } | 2004 } |
| 2131 | 2005 |
| 2132 | 2006 |
| 2133 Object* FixedArray::get(int index) { | 2007 Object* FixedArray::get(int index) { |
| 2134 SLOW_ASSERT(index >= 0 && index < this->length()); | 2008 SLOW_ASSERT(index >= 0 && index < this->length()); |
| 2135 return READ_FIELD(this, kHeaderSize + index * kPointerSize); | 2009 return Heap::read_field(this, kHeaderSize + index * kPointerSize); |
| 2136 } | 2010 } |
| 2137 | 2011 |
| 2138 | 2012 |
| 2139 Handle<Object> FixedArray::get(Handle<FixedArray> array, int index) { | 2013 Handle<Object> FixedArray::get(Handle<FixedArray> array, int index) { |
| 2140 return handle(array->get(index), array->GetIsolate()); | 2014 return handle(array->get(index), array->GetIsolate()); |
| 2141 } | 2015 } |
| 2142 | 2016 |
| 2143 | 2017 |
| 2144 bool FixedArray::is_the_hole(int index) { | 2018 bool FixedArray::is_the_hole(int index) { |
| 2145 return get(index) == GetHeap()->the_hole_value(); | 2019 return get(index) == GetHeap()->the_hole_value(); |
| 2146 } | 2020 } |
| 2147 | 2021 |
| 2148 | 2022 |
| 2149 void FixedArray::set(int index, Smi* value) { | 2023 void FixedArray::set(int index, Smi* value) { |
| 2150 ASSERT(map() != GetHeap()->fixed_cow_array_map()); | 2024 ASSERT(map() != GetHeap()->fixed_cow_array_map()); |
| 2151 ASSERT(index >= 0 && index < this->length()); | 2025 ASSERT(index >= 0 && index < this->length()); |
| 2152 ASSERT(reinterpret_cast<Object*>(value)->IsSmi()); | 2026 ASSERT(reinterpret_cast<Object*>(value)->IsSmi()); |
| 2153 int offset = kHeaderSize + index * kPointerSize; | 2027 int offset = kHeaderSize + index * kPointerSize; |
| 2154 WRITE_FIELD(this, offset, value); | 2028 Heap::write_field(this, offset, value, SKIP_WRITE_BARRIER); |
| 2155 } | 2029 } |
| 2156 | 2030 |
| 2157 | 2031 |
| 2158 void FixedArray::set(int index, Object* value) { | 2032 void FixedArray::set(int index, Object* value) { |
| 2159 ASSERT(map() != GetHeap()->fixed_cow_array_map()); | 2033 ASSERT(map() != GetHeap()->fixed_cow_array_map()); |
| 2160 ASSERT(index >= 0 && index < this->length()); | 2034 ASSERT(index >= 0 && index < this->length()); |
| 2161 int offset = kHeaderSize + index * kPointerSize; | 2035 int offset = kHeaderSize + index * kPointerSize; |
| 2162 WRITE_FIELD(this, offset, value); | 2036 Heap::write_field(this, offset, value, UPDATE_WRITE_BARRIER); |
| 2163 WRITE_BARRIER(GetHeap(), this, offset, value); | |
| 2164 } | 2037 } |
| 2165 | 2038 |
| 2166 | 2039 |
| 2167 inline bool FixedDoubleArray::is_the_hole_nan(double value) { | 2040 inline bool FixedDoubleArray::is_the_hole_nan(double value) { |
| 2168 return BitCast<uint64_t, double>(value) == kHoleNanInt64; | 2041 return BitCast<uint64_t, double>(value) == kHoleNanInt64; |
| 2169 } | 2042 } |
| 2170 | 2043 |
| 2171 | 2044 |
| 2172 inline double FixedDoubleArray::hole_nan_as_double() { | 2045 inline double FixedDoubleArray::hole_nan_as_double() { |
| 2173 return BitCast<double, uint64_t>(kHoleNanInt64); | 2046 return BitCast<double, uint64_t>(kHoleNanInt64); |
| 2174 } | 2047 } |
| 2175 | 2048 |
| 2176 | 2049 |
| 2177 inline double FixedDoubleArray::canonical_not_the_hole_nan_as_double() { | 2050 inline double FixedDoubleArray::canonical_not_the_hole_nan_as_double() { |
| 2178 ASSERT(BitCast<uint64_t>(OS::nan_value()) != kHoleNanInt64); | 2051 ASSERT(BitCast<uint64_t>(OS::nan_value()) != kHoleNanInt64); |
| 2179 ASSERT((BitCast<uint64_t>(OS::nan_value()) >> 32) != kHoleNanUpper32); | 2052 ASSERT((BitCast<uint64_t>(OS::nan_value()) >> 32) != kHoleNanUpper32); |
| 2180 return OS::nan_value(); | 2053 return OS::nan_value(); |
| 2181 } | 2054 } |
| 2182 | 2055 |
| 2183 | 2056 |
| 2184 double FixedDoubleArray::get_scalar(int index) { | 2057 double FixedDoubleArray::get_scalar(int index) { |
| 2185 ASSERT(map() != GetHeap()->fixed_cow_array_map() && | 2058 ASSERT(map() != GetHeap()->fixed_cow_array_map() && |
| 2186 map() != GetHeap()->fixed_array_map()); | 2059 map() != GetHeap()->fixed_array_map()); |
| 2187 ASSERT(index >= 0 && index < this->length()); | 2060 ASSERT(index >= 0 && index < this->length()); |
| 2188 double result = READ_DOUBLE_FIELD(this, kHeaderSize + index * kDoubleSize); | 2061 double result = |
| 2062 Heap::read_double_field(this, kHeaderSize + index * kDoubleSize); |
| 2189 ASSERT(!is_the_hole_nan(result)); | 2063 ASSERT(!is_the_hole_nan(result)); |
| 2190 return result; | 2064 return result; |
| 2191 } | 2065 } |
| 2192 | 2066 |
| 2193 int64_t FixedDoubleArray::get_representation(int index) { | 2067 int64_t FixedDoubleArray::get_representation(int index) { |
| 2194 ASSERT(map() != GetHeap()->fixed_cow_array_map() && | 2068 ASSERT(map() != GetHeap()->fixed_cow_array_map() && |
| 2195 map() != GetHeap()->fixed_array_map()); | 2069 map() != GetHeap()->fixed_array_map()); |
| 2196 ASSERT(index >= 0 && index < this->length()); | 2070 ASSERT(index >= 0 && index < this->length()); |
| 2197 return READ_INT64_FIELD(this, kHeaderSize + index * kDoubleSize); | 2071 return Heap::read_int64_field(this, kHeaderSize + index * kDoubleSize); |
| 2198 } | 2072 } |
| 2199 | 2073 |
| 2200 | 2074 |
| 2201 Handle<Object> FixedDoubleArray::get(Handle<FixedDoubleArray> array, | 2075 Handle<Object> FixedDoubleArray::get(Handle<FixedDoubleArray> array, |
| 2202 int index) { | 2076 int index) { |
| 2203 if (array->is_the_hole(index)) { | 2077 if (array->is_the_hole(index)) { |
| 2204 return array->GetIsolate()->factory()->the_hole_value(); | 2078 return array->GetIsolate()->factory()->the_hole_value(); |
| 2205 } else { | 2079 } else { |
| 2206 return array->GetIsolate()->factory()->NewNumber(array->get_scalar(index)); | 2080 return array->GetIsolate()->factory()->NewNumber(array->get_scalar(index)); |
| 2207 } | 2081 } |
| 2208 } | 2082 } |
| 2209 | 2083 |
| 2210 | 2084 |
| 2211 void FixedDoubleArray::set(int index, double value) { | 2085 void FixedDoubleArray::set(int index, double value) { |
| 2212 ASSERT(map() != GetHeap()->fixed_cow_array_map() && | 2086 ASSERT(map() != GetHeap()->fixed_cow_array_map() && |
| 2213 map() != GetHeap()->fixed_array_map()); | 2087 map() != GetHeap()->fixed_array_map()); |
| 2214 int offset = kHeaderSize + index * kDoubleSize; | 2088 int offset = kHeaderSize + index * kDoubleSize; |
| 2215 if (std::isnan(value)) value = canonical_not_the_hole_nan_as_double(); | 2089 if (std::isnan(value)) value = canonical_not_the_hole_nan_as_double(); |
| 2216 WRITE_DOUBLE_FIELD(this, offset, value); | 2090 Heap::write_double_field(this, offset, value); |
| 2217 } | 2091 } |
| 2218 | 2092 |
| 2219 | 2093 |
| 2220 void FixedDoubleArray::set_the_hole(int index) { | 2094 void FixedDoubleArray::set_the_hole(int index) { |
| 2221 ASSERT(map() != GetHeap()->fixed_cow_array_map() && | 2095 ASSERT(map() != GetHeap()->fixed_cow_array_map() && |
| 2222 map() != GetHeap()->fixed_array_map()); | 2096 map() != GetHeap()->fixed_array_map()); |
| 2223 int offset = kHeaderSize + index * kDoubleSize; | 2097 int offset = kHeaderSize + index * kDoubleSize; |
| 2224 WRITE_DOUBLE_FIELD(this, offset, hole_nan_as_double()); | 2098 Heap::write_double_field(this, offset, hole_nan_as_double()); |
| 2225 } | 2099 } |
| 2226 | 2100 |
| 2227 | 2101 |
| 2228 bool FixedDoubleArray::is_the_hole(int index) { | 2102 bool FixedDoubleArray::is_the_hole(int index) { |
| 2229 int offset = kHeaderSize + index * kDoubleSize; | 2103 int offset = kHeaderSize + index * kDoubleSize; |
| 2230 return is_the_hole_nan(READ_DOUBLE_FIELD(this, offset)); | 2104 return is_the_hole_nan(Heap::read_double_field(this, offset)); |
| 2231 } | 2105 } |
| 2232 | 2106 |
| 2233 | 2107 |
| 2234 double* FixedDoubleArray::data_start() { | 2108 double* FixedDoubleArray::data_start() { |
| 2235 return reinterpret_cast<double*>(FIELD_ADDR(this, kHeaderSize)); | 2109 return reinterpret_cast<double*>(Heap::get_field_address(this, kHeaderSize)); |
| 2236 } | 2110 } |
| 2237 | 2111 |
| 2238 | 2112 |
| 2239 void FixedDoubleArray::FillWithHoles(int from, int to) { | 2113 void FixedDoubleArray::FillWithHoles(int from, int to) { |
| 2240 for (int i = from; i < to; i++) { | 2114 for (int i = from; i < to; i++) { |
| 2241 set_the_hole(i); | 2115 set_the_hole(i); |
| 2242 } | 2116 } |
| 2243 } | 2117 } |
| 2244 | 2118 |
| 2245 | 2119 |
| 2246 void ConstantPoolArray::set_weak_object_state( | 2120 void ConstantPoolArray::set_weak_object_state( |
| 2247 ConstantPoolArray::WeakObjectState state) { | 2121 ConstantPoolArray::WeakObjectState state) { |
| 2248 int old_layout_field = READ_INT_FIELD(this, kArrayLayoutOffset); | 2122 int old_layout_field = Heap::read_int_field(this, kArrayLayoutOffset); |
| 2249 int new_layout_field = WeakObjectStateField::update(old_layout_field, state); | 2123 int new_layout_field = WeakObjectStateField::update(old_layout_field, state); |
| 2250 WRITE_INT_FIELD(this, kArrayLayoutOffset, new_layout_field); | 2124 Heap::write_int_field(this, kArrayLayoutOffset, new_layout_field); |
| 2251 } | 2125 } |
| 2252 | 2126 |
| 2253 | 2127 |
| 2254 ConstantPoolArray::WeakObjectState ConstantPoolArray::get_weak_object_state() { | 2128 ConstantPoolArray::WeakObjectState ConstantPoolArray::get_weak_object_state() { |
| 2255 int layout_field = READ_INT_FIELD(this, kArrayLayoutOffset); | 2129 int layout_field = Heap::read_int_field(this, kArrayLayoutOffset); |
| 2256 return WeakObjectStateField::decode(layout_field); | 2130 return WeakObjectStateField::decode(layout_field); |
| 2257 } | 2131 } |
| 2258 | 2132 |
| 2259 | 2133 |
| 2260 int ConstantPoolArray::first_int64_index() { | 2134 int ConstantPoolArray::first_int64_index() { |
| 2261 return 0; | 2135 return 0; |
| 2262 } | 2136 } |
| 2263 | 2137 |
| 2264 | 2138 |
| 2265 int ConstantPoolArray::first_code_ptr_index() { | 2139 int ConstantPoolArray::first_code_ptr_index() { |
| 2266 int layout_field = READ_INT_FIELD(this, kArrayLayoutOffset); | 2140 int layout_field = Heap::read_int_field(this, kArrayLayoutOffset); |
| 2267 return first_int64_index() + | 2141 return first_int64_index() + |
| 2268 NumberOfInt64EntriesField::decode(layout_field); | 2142 NumberOfInt64EntriesField::decode(layout_field); |
| 2269 } | 2143 } |
| 2270 | 2144 |
| 2271 | 2145 |
| 2272 int ConstantPoolArray::first_heap_ptr_index() { | 2146 int ConstantPoolArray::first_heap_ptr_index() { |
| 2273 int layout_field = READ_INT_FIELD(this, kArrayLayoutOffset); | 2147 int layout_field = Heap::read_int_field(this, kArrayLayoutOffset); |
| 2274 return first_code_ptr_index() + | 2148 return first_code_ptr_index() + |
| 2275 NumberOfCodePtrEntriesField::decode(layout_field); | 2149 NumberOfCodePtrEntriesField::decode(layout_field); |
| 2276 } | 2150 } |
| 2277 | 2151 |
| 2278 | 2152 |
| 2279 int ConstantPoolArray::first_int32_index() { | 2153 int ConstantPoolArray::first_int32_index() { |
| 2280 int layout_field = READ_INT_FIELD(this, kArrayLayoutOffset); | 2154 int layout_field = Heap::read_int_field(this, kArrayLayoutOffset); |
| 2281 return first_heap_ptr_index() + | 2155 return first_heap_ptr_index() + |
| 2282 NumberOfHeapPtrEntriesField::decode(layout_field); | 2156 NumberOfHeapPtrEntriesField::decode(layout_field); |
| 2283 } | 2157 } |
| 2284 | 2158 |
| 2285 | 2159 |
| 2286 int ConstantPoolArray::count_of_int64_entries() { | 2160 int ConstantPoolArray::count_of_int64_entries() { |
| 2287 return first_code_ptr_index(); | 2161 return first_code_ptr_index(); |
| 2288 } | 2162 } |
| 2289 | 2163 |
| 2290 | 2164 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 2309 int number_of_int32_entries) { | 2183 int number_of_int32_entries) { |
| 2310 set_length(number_of_int64_entries + | 2184 set_length(number_of_int64_entries + |
| 2311 number_of_code_ptr_entries + | 2185 number_of_code_ptr_entries + |
| 2312 number_of_heap_ptr_entries + | 2186 number_of_heap_ptr_entries + |
| 2313 number_of_int32_entries); | 2187 number_of_int32_entries); |
| 2314 int layout_field = | 2188 int layout_field = |
| 2315 NumberOfInt64EntriesField::encode(number_of_int64_entries) | | 2189 NumberOfInt64EntriesField::encode(number_of_int64_entries) | |
| 2316 NumberOfCodePtrEntriesField::encode(number_of_code_ptr_entries) | | 2190 NumberOfCodePtrEntriesField::encode(number_of_code_ptr_entries) | |
| 2317 NumberOfHeapPtrEntriesField::encode(number_of_heap_ptr_entries) | | 2191 NumberOfHeapPtrEntriesField::encode(number_of_heap_ptr_entries) | |
| 2318 WeakObjectStateField::encode(NO_WEAK_OBJECTS); | 2192 WeakObjectStateField::encode(NO_WEAK_OBJECTS); |
| 2319 WRITE_INT_FIELD(this, kArrayLayoutOffset, layout_field); | 2193 Heap::write_int_field(this, kArrayLayoutOffset, layout_field); |
| 2320 } | 2194 } |
| 2321 | 2195 |
| 2322 | 2196 |
| 2323 int64_t ConstantPoolArray::get_int64_entry(int index) { | 2197 int64_t ConstantPoolArray::get_int64_entry(int index) { |
| 2324 ASSERT(map() == GetHeap()->constant_pool_array_map()); | 2198 ASSERT(map() == GetHeap()->constant_pool_array_map()); |
| 2325 ASSERT(index >= 0 && index < first_code_ptr_index()); | 2199 ASSERT(index >= 0 && index < first_code_ptr_index()); |
| 2326 return READ_INT64_FIELD(this, OffsetOfElementAt(index)); | 2200 return Heap::read_int64_field(this, OffsetOfElementAt(index)); |
| 2327 } | 2201 } |
| 2328 | 2202 |
| 2329 double ConstantPoolArray::get_int64_entry_as_double(int index) { | 2203 double ConstantPoolArray::get_int64_entry_as_double(int index) { |
| 2330 STATIC_ASSERT(kDoubleSize == kInt64Size); | 2204 STATIC_ASSERT(kDoubleSize == kInt64Size); |
| 2331 ASSERT(map() == GetHeap()->constant_pool_array_map()); | 2205 ASSERT(map() == GetHeap()->constant_pool_array_map()); |
| 2332 ASSERT(index >= 0 && index < first_code_ptr_index()); | 2206 ASSERT(index >= 0 && index < first_code_ptr_index()); |
| 2333 return READ_DOUBLE_FIELD(this, OffsetOfElementAt(index)); | 2207 return Heap::read_double_field(this, OffsetOfElementAt(index)); |
| 2334 } | 2208 } |
| 2335 | 2209 |
| 2336 | 2210 |
| 2337 Address ConstantPoolArray::get_code_ptr_entry(int index) { | 2211 Address ConstantPoolArray::get_code_ptr_entry(int index) { |
| 2338 ASSERT(map() == GetHeap()->constant_pool_array_map()); | 2212 ASSERT(map() == GetHeap()->constant_pool_array_map()); |
| 2339 ASSERT(index >= first_code_ptr_index() && index < first_heap_ptr_index()); | 2213 ASSERT(index >= first_code_ptr_index() && index < first_heap_ptr_index()); |
| 2340 return reinterpret_cast<Address>(READ_FIELD(this, OffsetOfElementAt(index))); | 2214 return reinterpret_cast<Address>( |
| 2215 Heap::read_field(this, OffsetOfElementAt(index))); |
| 2341 } | 2216 } |
| 2342 | 2217 |
| 2343 | 2218 |
| 2344 Object* ConstantPoolArray::get_heap_ptr_entry(int index) { | 2219 Object* ConstantPoolArray::get_heap_ptr_entry(int index) { |
| 2345 ASSERT(map() == GetHeap()->constant_pool_array_map()); | 2220 ASSERT(map() == GetHeap()->constant_pool_array_map()); |
| 2346 ASSERT(index >= first_heap_ptr_index() && index < first_int32_index()); | 2221 ASSERT(index >= first_heap_ptr_index() && index < first_int32_index()); |
| 2347 return READ_FIELD(this, OffsetOfElementAt(index)); | 2222 return Heap::read_field(this, OffsetOfElementAt(index)); |
| 2348 } | 2223 } |
| 2349 | 2224 |
| 2350 | 2225 |
| 2351 int32_t ConstantPoolArray::get_int32_entry(int index) { | 2226 int32_t ConstantPoolArray::get_int32_entry(int index) { |
| 2352 ASSERT(map() == GetHeap()->constant_pool_array_map()); | 2227 ASSERT(map() == GetHeap()->constant_pool_array_map()); |
| 2353 ASSERT(index >= first_int32_index() && index < length()); | 2228 ASSERT(index >= first_int32_index() && index < length()); |
| 2354 return READ_INT32_FIELD(this, OffsetOfElementAt(index)); | 2229 return Heap::read_int32_field(this, OffsetOfElementAt(index)); |
| 2355 } | 2230 } |
| 2356 | 2231 |
| 2357 | 2232 |
| 2358 void ConstantPoolArray::set(int index, Address value) { | 2233 void ConstantPoolArray::set(int index, Address value) { |
| 2359 ASSERT(map() == GetHeap()->constant_pool_array_map()); | 2234 ASSERT(map() == GetHeap()->constant_pool_array_map()); |
| 2360 ASSERT(index >= first_code_ptr_index() && index < first_heap_ptr_index()); | 2235 ASSERT(index >= first_code_ptr_index() && index < first_heap_ptr_index()); |
| 2361 WRITE_FIELD(this, OffsetOfElementAt(index), reinterpret_cast<Object*>(value)); | 2236 Heap::write_field(this, |
| 2237 OffsetOfElementAt(index), |
| 2238 reinterpret_cast<Object*>(value), |
| 2239 SKIP_WRITE_BARRIER); |
| 2362 } | 2240 } |
| 2363 | 2241 |
| 2364 | 2242 |
| 2365 void ConstantPoolArray::set(int index, Object* value) { | 2243 void ConstantPoolArray::set(int index, Object* value) { |
| 2366 ASSERT(map() == GetHeap()->constant_pool_array_map()); | 2244 ASSERT(map() == GetHeap()->constant_pool_array_map()); |
| 2367 ASSERT(index >= first_code_ptr_index() && index < first_int32_index()); | 2245 ASSERT(index >= first_code_ptr_index() && index < first_int32_index()); |
| 2368 WRITE_FIELD(this, OffsetOfElementAt(index), value); | 2246 Heap::write_field(this, |
| 2369 WRITE_BARRIER(GetHeap(), this, OffsetOfElementAt(index), value); | 2247 OffsetOfElementAt(index), |
| 2248 value, |
| 2249 UPDATE_WRITE_BARRIER); |
| 2370 } | 2250 } |
| 2371 | 2251 |
| 2372 | 2252 |
| 2373 void ConstantPoolArray::set(int index, int64_t value) { | 2253 void ConstantPoolArray::set(int index, int64_t value) { |
| 2374 ASSERT(map() == GetHeap()->constant_pool_array_map()); | 2254 ASSERT(map() == GetHeap()->constant_pool_array_map()); |
| 2375 ASSERT(index >= first_int64_index() && index < first_code_ptr_index()); | 2255 ASSERT(index >= first_int64_index() && index < first_code_ptr_index()); |
| 2376 WRITE_INT64_FIELD(this, OffsetOfElementAt(index), value); | 2256 Heap::write_int64_field(this, OffsetOfElementAt(index), value); |
| 2377 } | 2257 } |
| 2378 | 2258 |
| 2379 | 2259 |
| 2380 void ConstantPoolArray::set(int index, double value) { | 2260 void ConstantPoolArray::set(int index, double value) { |
| 2381 STATIC_ASSERT(kDoubleSize == kInt64Size); | 2261 STATIC_ASSERT(kDoubleSize == kInt64Size); |
| 2382 ASSERT(map() == GetHeap()->constant_pool_array_map()); | 2262 ASSERT(map() == GetHeap()->constant_pool_array_map()); |
| 2383 ASSERT(index >= first_int64_index() && index < first_code_ptr_index()); | 2263 ASSERT(index >= first_int64_index() && index < first_code_ptr_index()); |
| 2384 WRITE_DOUBLE_FIELD(this, OffsetOfElementAt(index), value); | 2264 Heap::write_double_field(this, OffsetOfElementAt(index), value); |
| 2385 } | 2265 } |
| 2386 | 2266 |
| 2387 | 2267 |
| 2388 void ConstantPoolArray::set(int index, int32_t value) { | 2268 void ConstantPoolArray::set(int index, int32_t value) { |
| 2389 ASSERT(map() == GetHeap()->constant_pool_array_map()); | 2269 ASSERT(map() == GetHeap()->constant_pool_array_map()); |
| 2390 ASSERT(index >= this->first_int32_index() && index < length()); | 2270 ASSERT(index >= this->first_int32_index() && index < length()); |
| 2391 WRITE_INT32_FIELD(this, OffsetOfElementAt(index), value); | 2271 Heap::write_int32_field(this, OffsetOfElementAt(index), value); |
| 2392 } | 2272 } |
| 2393 | 2273 |
| 2394 | 2274 |
| 2395 WriteBarrierMode HeapObject::GetWriteBarrierMode( | 2275 WriteBarrierMode HeapObject::GetWriteBarrierMode( |
| 2396 const DisallowHeapAllocation& promise) { | 2276 const DisallowHeapAllocation& promise) { |
| 2397 Heap* heap = GetHeap(); | 2277 Heap* heap = GetHeap(); |
| 2398 if (heap->incremental_marking()->IsMarking()) return UPDATE_WRITE_BARRIER; | 2278 if (heap->incremental_marking()->IsMarking()) return UPDATE_WRITE_BARRIER; |
| 2399 if (heap->InNewSpace(this)) return SKIP_WRITE_BARRIER; | 2279 if (heap->InNewSpace(this)) return SKIP_WRITE_BARRIER; |
| 2400 return UPDATE_WRITE_BARRIER; | 2280 return UPDATE_WRITE_BARRIER; |
| 2401 } | 2281 } |
| 2402 | 2282 |
| 2403 | 2283 |
| 2404 void FixedArray::set(int index, | 2284 void FixedArray::set(int index, |
| 2405 Object* value, | 2285 Object* value, |
| 2406 WriteBarrierMode mode) { | 2286 WriteBarrierMode mode) { |
| 2407 ASSERT(map() != GetHeap()->fixed_cow_array_map()); | 2287 ASSERT(map() != GetHeap()->fixed_cow_array_map()); |
| 2408 ASSERT(index >= 0 && index < this->length()); | 2288 ASSERT(index >= 0 && index < this->length()); |
| 2409 int offset = kHeaderSize + index * kPointerSize; | 2289 int offset = kHeaderSize + index * kPointerSize; |
| 2410 WRITE_FIELD(this, offset, value); | 2290 Heap::write_field(this, offset, value, mode); |
| 2411 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, offset, value, mode); | |
| 2412 } | 2291 } |
| 2413 | 2292 |
| 2414 | 2293 |
| 2415 void FixedArray::NoIncrementalWriteBarrierSet(FixedArray* array, | 2294 void FixedArray::NoIncrementalWriteBarrierSet(FixedArray* array, |
| 2416 int index, | 2295 int index, |
| 2417 Object* value) { | 2296 Object* value) { |
| 2418 ASSERT(array->map() != array->GetHeap()->fixed_cow_array_map()); | 2297 ASSERT(array->map() != array->GetHeap()->fixed_cow_array_map()); |
| 2419 ASSERT(index >= 0 && index < array->length()); | 2298 ASSERT(index >= 0 && index < array->length()); |
| 2420 int offset = kHeaderSize + index * kPointerSize; | 2299 int offset = kHeaderSize + index * kPointerSize; |
| 2421 WRITE_FIELD(array, offset, value); | 2300 Heap::write_field(array, offset, value, SKIP_WRITE_BARRIER); |
| 2422 Heap* heap = array->GetHeap(); | 2301 Heap* heap = array->GetHeap(); |
| 2423 if (heap->InNewSpace(value)) { | 2302 if (heap->InNewSpace(value)) { |
| 2424 heap->RecordWrite(array->address(), offset); | 2303 heap->RecordWrite(array->address(), offset); |
| 2425 } | 2304 } |
| 2426 } | 2305 } |
| 2427 | 2306 |
| 2428 | 2307 |
| 2429 void FixedArray::NoWriteBarrierSet(FixedArray* array, | 2308 void FixedArray::NoWriteBarrierSet(FixedArray* array, |
| 2430 int index, | 2309 int index, |
| 2431 Object* value) { | 2310 Object* value) { |
| 2432 ASSERT(array->map() != array->GetHeap()->fixed_cow_array_map()); | 2311 ASSERT(array->map() != array->GetHeap()->fixed_cow_array_map()); |
| 2433 ASSERT(index >= 0 && index < array->length()); | 2312 ASSERT(index >= 0 && index < array->length()); |
| 2434 ASSERT(!array->GetHeap()->InNewSpace(value)); | 2313 ASSERT(!array->GetHeap()->InNewSpace(value)); |
| 2435 WRITE_FIELD(array, kHeaderSize + index * kPointerSize, value); | 2314 Heap::write_field(array, |
| 2315 kHeaderSize + index * kPointerSize, |
| 2316 value, |
| 2317 SKIP_WRITE_BARRIER); |
| 2436 } | 2318 } |
| 2437 | 2319 |
| 2438 | 2320 |
| 2439 void FixedArray::set_undefined(int index) { | 2321 void FixedArray::set_undefined(int index) { |
| 2440 ASSERT(map() != GetHeap()->fixed_cow_array_map()); | 2322 ASSERT(map() != GetHeap()->fixed_cow_array_map()); |
| 2441 ASSERT(index >= 0 && index < this->length()); | 2323 ASSERT(index >= 0 && index < this->length()); |
| 2442 ASSERT(!GetHeap()->InNewSpace(GetHeap()->undefined_value())); | 2324 ASSERT(!GetHeap()->InNewSpace(GetHeap()->undefined_value())); |
| 2443 WRITE_FIELD(this, | 2325 Heap::write_field(this, |
| 2444 kHeaderSize + index * kPointerSize, | 2326 kHeaderSize + index * kPointerSize, |
| 2445 GetHeap()->undefined_value()); | 2327 GetHeap()->undefined_value(), |
| 2328 SKIP_WRITE_BARRIER); |
| 2446 } | 2329 } |
| 2447 | 2330 |
| 2448 | 2331 |
| 2449 void FixedArray::set_null(int index) { | 2332 void FixedArray::set_null(int index) { |
| 2450 ASSERT(index >= 0 && index < this->length()); | 2333 ASSERT(index >= 0 && index < this->length()); |
| 2451 ASSERT(!GetHeap()->InNewSpace(GetHeap()->null_value())); | 2334 ASSERT(!GetHeap()->InNewSpace(GetHeap()->null_value())); |
| 2452 WRITE_FIELD(this, | 2335 Heap::write_field(this, |
| 2453 kHeaderSize + index * kPointerSize, | 2336 kHeaderSize + index * kPointerSize, |
| 2454 GetHeap()->null_value()); | 2337 GetHeap()->null_value(), |
| 2338 SKIP_WRITE_BARRIER); |
| 2455 } | 2339 } |
| 2456 | 2340 |
| 2457 | 2341 |
| 2458 void FixedArray::set_the_hole(int index) { | 2342 void FixedArray::set_the_hole(int index) { |
| 2459 ASSERT(map() != GetHeap()->fixed_cow_array_map()); | 2343 ASSERT(map() != GetHeap()->fixed_cow_array_map()); |
| 2460 ASSERT(index >= 0 && index < this->length()); | 2344 ASSERT(index >= 0 && index < this->length()); |
| 2461 ASSERT(!GetHeap()->InNewSpace(GetHeap()->the_hole_value())); | 2345 ASSERT(!GetHeap()->InNewSpace(GetHeap()->the_hole_value())); |
| 2462 WRITE_FIELD(this, | 2346 Heap::write_field(this, |
| 2463 kHeaderSize + index * kPointerSize, | 2347 kHeaderSize + index * kPointerSize, |
| 2464 GetHeap()->the_hole_value()); | 2348 GetHeap()->the_hole_value(), |
| 2349 SKIP_WRITE_BARRIER); |
| 2465 } | 2350 } |
| 2466 | 2351 |
| 2467 | 2352 |
| 2468 void FixedArray::FillWithHoles(int from, int to) { | 2353 void FixedArray::FillWithHoles(int from, int to) { |
| 2469 for (int i = from; i < to; i++) { | 2354 for (int i = from; i < to; i++) { |
| 2470 set_the_hole(i); | 2355 set_the_hole(i); |
| 2471 } | 2356 } |
| 2472 } | 2357 } |
| 2473 | 2358 |
| 2474 | 2359 |
| 2475 Object** FixedArray::data_start() { | 2360 Object** FixedArray::data_start() { |
| 2476 return HeapObject::RawField(this, kHeaderSize); | 2361 return HeapObject::RawField(this, kHeaderSize); |
| 2477 } | 2362 } |
| 2478 | 2363 |
| 2479 | 2364 |
| 2480 bool DescriptorArray::IsEmpty() { | 2365 bool DescriptorArray::IsEmpty() { |
| 2481 ASSERT(length() >= kFirstIndex || | 2366 ASSERT(length() >= kFirstIndex || |
| 2482 this == GetHeap()->empty_descriptor_array()); | 2367 this == GetHeap()->empty_descriptor_array()); |
| 2483 return length() < kFirstIndex; | 2368 return length() < kFirstIndex; |
| 2484 } | 2369 } |
| 2485 | 2370 |
| 2486 | 2371 |
| 2487 void DescriptorArray::SetNumberOfDescriptors(int number_of_descriptors) { | 2372 void DescriptorArray::SetNumberOfDescriptors(int number_of_descriptors) { |
| 2488 WRITE_FIELD( | 2373 Heap::write_field( |
| 2489 this, kDescriptorLengthOffset, Smi::FromInt(number_of_descriptors)); | 2374 this, |
| 2375 kDescriptorLengthOffset, |
| 2376 Smi::FromInt(number_of_descriptors), |
| 2377 SKIP_WRITE_BARRIER); |
| 2490 } | 2378 } |
| 2491 | 2379 |
| 2492 | 2380 |
| 2493 // Perform a binary search in a fixed array. Low and high are entry indices. If | 2381 // Perform a binary search in a fixed array. Low and high are entry indices. If |
| 2494 // there are three entries in this array it should be called with low=0 and | 2382 // there are three entries in this array it should be called with low=0 and |
| 2495 // high=2. | 2383 // high=2. |
| 2496 template<SearchMode search_mode, typename T> | 2384 template<SearchMode search_mode, typename T> |
| 2497 int BinarySearch(T* array, Name* name, int low, int high, int valid_entries) { | 2385 int BinarySearch(T* array, Name* name, int low, int high, int valid_entries) { |
| 2498 uint32_t hash = name->Hash(); | 2386 uint32_t hash = name->Hash(); |
| 2499 int limit = high; | 2387 int limit = high; |
| (...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3006 SYNCHRONIZED_SMI_ACCESSORS(FixedArrayBase, length, kLengthOffset) | 2894 SYNCHRONIZED_SMI_ACCESSORS(FixedArrayBase, length, kLengthOffset) |
| 3007 | 2895 |
| 3008 SMI_ACCESSORS(FreeSpace, size, kSizeOffset) | 2896 SMI_ACCESSORS(FreeSpace, size, kSizeOffset) |
| 3009 NOBARRIER_SMI_ACCESSORS(FreeSpace, size, kSizeOffset) | 2897 NOBARRIER_SMI_ACCESSORS(FreeSpace, size, kSizeOffset) |
| 3010 | 2898 |
| 3011 SMI_ACCESSORS(String, length, kLengthOffset) | 2899 SMI_ACCESSORS(String, length, kLengthOffset) |
| 3012 SYNCHRONIZED_SMI_ACCESSORS(String, length, kLengthOffset) | 2900 SYNCHRONIZED_SMI_ACCESSORS(String, length, kLengthOffset) |
| 3013 | 2901 |
| 3014 | 2902 |
| 3015 uint32_t Name::hash_field() { | 2903 uint32_t Name::hash_field() { |
| 3016 return READ_UINT32_FIELD(this, kHashFieldOffset); | 2904 return Heap::read_uint32_field(this, kHashFieldOffset); |
| 3017 } | 2905 } |
| 3018 | 2906 |
| 3019 | 2907 |
| 3020 void Name::set_hash_field(uint32_t value) { | 2908 void Name::set_hash_field(uint32_t value) { |
| 3021 WRITE_UINT32_FIELD(this, kHashFieldOffset, value); | 2909 Heap::write_uint32_field(this, kHashFieldOffset, value); |
| 3022 #if V8_HOST_ARCH_64_BIT | 2910 #if V8_HOST_ARCH_64_BIT |
| 3023 WRITE_UINT32_FIELD(this, kHashFieldOffset + kIntSize, 0); | 2911 Heap::write_uint32_field(this, kHashFieldOffset + kIntSize, 0); |
| 3024 #endif | 2912 #endif |
| 3025 } | 2913 } |
| 3026 | 2914 |
| 3027 | 2915 |
| 3028 bool Name::Equals(Name* other) { | 2916 bool Name::Equals(Name* other) { |
| 3029 if (other == this) return true; | 2917 if (other == this) return true; |
| 3030 if ((this->IsInternalizedString() && other->IsInternalizedString()) || | 2918 if ((this->IsInternalizedString() && other->IsInternalizedString()) || |
| 3031 this->IsSymbol() || other->IsSymbol()) { | 2919 this->IsSymbol() || other->IsSymbol()) { |
| 3032 return false; | 2920 return false; |
| 3033 } | 2921 } |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3119 } | 3007 } |
| 3120 | 3008 |
| 3121 | 3009 |
| 3122 String* String::GetUnderlying() { | 3010 String* String::GetUnderlying() { |
| 3123 // Giving direct access to underlying string only makes sense if the | 3011 // Giving direct access to underlying string only makes sense if the |
| 3124 // wrapping string is already flattened. | 3012 // wrapping string is already flattened. |
| 3125 ASSERT(this->IsFlat()); | 3013 ASSERT(this->IsFlat()); |
| 3126 ASSERT(StringShape(this).IsIndirect()); | 3014 ASSERT(StringShape(this).IsIndirect()); |
| 3127 STATIC_ASSERT(ConsString::kFirstOffset == SlicedString::kParentOffset); | 3015 STATIC_ASSERT(ConsString::kFirstOffset == SlicedString::kParentOffset); |
| 3128 const int kUnderlyingOffset = SlicedString::kParentOffset; | 3016 const int kUnderlyingOffset = SlicedString::kParentOffset; |
| 3129 return String::cast(READ_FIELD(this, kUnderlyingOffset)); | 3017 return String::cast(Heap::read_field(this, kUnderlyingOffset)); |
| 3130 } | 3018 } |
| 3131 | 3019 |
| 3132 | 3020 |
| 3133 template<class Visitor> | 3021 template<class Visitor> |
| 3134 ConsString* String::VisitFlat(Visitor* visitor, | 3022 ConsString* String::VisitFlat(Visitor* visitor, |
| 3135 String* string, | 3023 String* string, |
| 3136 const int offset) { | 3024 const int offset) { |
| 3137 int slice_offset = offset; | 3025 int slice_offset = offset; |
| 3138 const int length = string->length(); | 3026 const int length = string->length(); |
| 3139 ASSERT(offset <= length); | 3027 ASSERT(offset <= length); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3179 default: | 3067 default: |
| 3180 UNREACHABLE(); | 3068 UNREACHABLE(); |
| 3181 return NULL; | 3069 return NULL; |
| 3182 } | 3070 } |
| 3183 } | 3071 } |
| 3184 } | 3072 } |
| 3185 | 3073 |
| 3186 | 3074 |
| 3187 uint16_t SeqOneByteString::SeqOneByteStringGet(int index) { | 3075 uint16_t SeqOneByteString::SeqOneByteStringGet(int index) { |
| 3188 ASSERT(index >= 0 && index < length()); | 3076 ASSERT(index >= 0 && index < length()); |
| 3189 return READ_BYTE_FIELD(this, kHeaderSize + index * kCharSize); | 3077 return Heap::read_byte_field(this, kHeaderSize + index * kCharSize); |
| 3190 } | 3078 } |
| 3191 | 3079 |
| 3192 | 3080 |
| 3193 void SeqOneByteString::SeqOneByteStringSet(int index, uint16_t value) { | 3081 void SeqOneByteString::SeqOneByteStringSet(int index, uint16_t value) { |
| 3194 ASSERT(index >= 0 && index < length() && value <= kMaxOneByteCharCode); | 3082 ASSERT(index >= 0 && index < length() && value <= kMaxOneByteCharCode); |
| 3195 WRITE_BYTE_FIELD(this, kHeaderSize + index * kCharSize, | 3083 Heap::write_byte_field(this, kHeaderSize + index * kCharSize, |
| 3196 static_cast<byte>(value)); | 3084 static_cast<byte>(value)); |
| 3197 } | 3085 } |
| 3198 | 3086 |
| 3199 | 3087 |
| 3200 Address SeqOneByteString::GetCharsAddress() { | 3088 Address SeqOneByteString::GetCharsAddress() { |
| 3201 return FIELD_ADDR(this, kHeaderSize); | 3089 return Heap::get_field_address(this, kHeaderSize); |
| 3202 } | 3090 } |
| 3203 | 3091 |
| 3204 | 3092 |
| 3205 uint8_t* SeqOneByteString::GetChars() { | 3093 uint8_t* SeqOneByteString::GetChars() { |
| 3206 return reinterpret_cast<uint8_t*>(GetCharsAddress()); | 3094 return reinterpret_cast<uint8_t*>(GetCharsAddress()); |
| 3207 } | 3095 } |
| 3208 | 3096 |
| 3209 | 3097 |
| 3210 Address SeqTwoByteString::GetCharsAddress() { | 3098 Address SeqTwoByteString::GetCharsAddress() { |
| 3211 return FIELD_ADDR(this, kHeaderSize); | 3099 return Heap::get_field_address(this, kHeaderSize); |
| 3212 } | 3100 } |
| 3213 | 3101 |
| 3214 | 3102 |
| 3215 uc16* SeqTwoByteString::GetChars() { | 3103 uc16* SeqTwoByteString::GetChars() { |
| 3216 return reinterpret_cast<uc16*>(FIELD_ADDR(this, kHeaderSize)); | 3104 return reinterpret_cast<uc16*>(Heap::get_field_address(this, kHeaderSize)); |
| 3217 } | 3105 } |
| 3218 | 3106 |
| 3219 | 3107 |
| 3220 uint16_t SeqTwoByteString::SeqTwoByteStringGet(int index) { | 3108 uint16_t SeqTwoByteString::SeqTwoByteStringGet(int index) { |
| 3221 ASSERT(index >= 0 && index < length()); | 3109 ASSERT(index >= 0 && index < length()); |
| 3222 return READ_SHORT_FIELD(this, kHeaderSize + index * kShortSize); | 3110 return Heap::read_short_field(this, kHeaderSize + index * kShortSize); |
| 3223 } | 3111 } |
| 3224 | 3112 |
| 3225 | 3113 |
| 3226 void SeqTwoByteString::SeqTwoByteStringSet(int index, uint16_t value) { | 3114 void SeqTwoByteString::SeqTwoByteStringSet(int index, uint16_t value) { |
| 3227 ASSERT(index >= 0 && index < length()); | 3115 ASSERT(index >= 0 && index < length()); |
| 3228 WRITE_SHORT_FIELD(this, kHeaderSize + index * kShortSize, value); | 3116 Heap::write_short_field(this, kHeaderSize + index * kShortSize, value); |
| 3229 } | 3117 } |
| 3230 | 3118 |
| 3231 | 3119 |
| 3232 int SeqTwoByteString::SeqTwoByteStringSize(InstanceType instance_type) { | 3120 int SeqTwoByteString::SeqTwoByteStringSize(InstanceType instance_type) { |
| 3233 return SizeFor(length()); | 3121 return SizeFor(length()); |
| 3234 } | 3122 } |
| 3235 | 3123 |
| 3236 | 3124 |
| 3237 int SeqOneByteString::SeqOneByteStringSize(InstanceType instance_type) { | 3125 int SeqOneByteString::SeqOneByteStringSize(InstanceType instance_type) { |
| 3238 return SizeFor(length()); | 3126 return SizeFor(length()); |
| 3239 } | 3127 } |
| 3240 | 3128 |
| 3241 | 3129 |
| 3242 String* SlicedString::parent() { | 3130 String* SlicedString::parent() { |
| 3243 return String::cast(READ_FIELD(this, kParentOffset)); | 3131 return String::cast(Heap::read_field(this, kParentOffset)); |
| 3244 } | 3132 } |
| 3245 | 3133 |
| 3246 | 3134 |
| 3247 void SlicedString::set_parent(String* parent, WriteBarrierMode mode) { | 3135 void SlicedString::set_parent(String* parent, WriteBarrierMode mode) { |
| 3248 ASSERT(parent->IsSeqString() || parent->IsExternalString()); | 3136 ASSERT(parent->IsSeqString() || parent->IsExternalString()); |
| 3249 WRITE_FIELD(this, kParentOffset, parent); | 3137 Heap::write_field(this, kParentOffset, parent, mode); |
| 3250 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kParentOffset, parent, mode); | |
| 3251 } | 3138 } |
| 3252 | 3139 |
| 3253 | 3140 |
| 3254 SMI_ACCESSORS(SlicedString, offset, kOffsetOffset) | 3141 SMI_ACCESSORS(SlicedString, offset, kOffsetOffset) |
| 3255 | 3142 |
| 3256 | 3143 |
| 3257 String* ConsString::first() { | 3144 String* ConsString::first() { |
| 3258 return String::cast(READ_FIELD(this, kFirstOffset)); | 3145 return String::cast(Heap::read_field(this, kFirstOffset)); |
| 3259 } | 3146 } |
| 3260 | 3147 |
| 3261 | 3148 |
| 3262 Object* ConsString::unchecked_first() { | 3149 Object* ConsString::unchecked_first() { |
| 3263 return READ_FIELD(this, kFirstOffset); | 3150 return Heap::read_field(this, kFirstOffset); |
| 3264 } | 3151 } |
| 3265 | 3152 |
| 3266 | 3153 |
| 3267 void ConsString::set_first(String* value, WriteBarrierMode mode) { | 3154 void ConsString::set_first(String* value, WriteBarrierMode mode) { |
| 3268 WRITE_FIELD(this, kFirstOffset, value); | 3155 Heap::write_field(this, kFirstOffset, value, mode); |
| 3269 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kFirstOffset, value, mode); | |
| 3270 } | 3156 } |
| 3271 | 3157 |
| 3272 | 3158 |
| 3273 String* ConsString::second() { | 3159 String* ConsString::second() { |
| 3274 return String::cast(READ_FIELD(this, kSecondOffset)); | 3160 return String::cast(Heap::read_field(this, kSecondOffset)); |
| 3275 } | 3161 } |
| 3276 | 3162 |
| 3277 | 3163 |
| 3278 Object* ConsString::unchecked_second() { | 3164 Object* ConsString::unchecked_second() { |
| 3279 return READ_FIELD(this, kSecondOffset); | 3165 return Heap::read_field(this, kSecondOffset); |
| 3280 } | 3166 } |
| 3281 | 3167 |
| 3282 | 3168 |
| 3283 void ConsString::set_second(String* value, WriteBarrierMode mode) { | 3169 void ConsString::set_second(String* value, WriteBarrierMode mode) { |
| 3284 WRITE_FIELD(this, kSecondOffset, value); | 3170 Heap::write_field(this, kSecondOffset, value, mode); |
| 3285 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kSecondOffset, value, mode); | |
| 3286 } | 3171 } |
| 3287 | 3172 |
| 3288 | 3173 |
| 3289 bool ExternalString::is_short() { | 3174 bool ExternalString::is_short() { |
| 3290 InstanceType type = map()->instance_type(); | 3175 InstanceType type = map()->instance_type(); |
| 3291 return (type & kShortExternalStringMask) == kShortExternalStringTag; | 3176 return (type & kShortExternalStringMask) == kShortExternalStringTag; |
| 3292 } | 3177 } |
| 3293 | 3178 |
| 3294 | 3179 |
| 3295 const ExternalAsciiString::Resource* ExternalAsciiString::resource() { | 3180 const ExternalAsciiString::Resource* ExternalAsciiString::resource() { |
| 3296 return *reinterpret_cast<Resource**>(FIELD_ADDR(this, kResourceOffset)); | 3181 return *reinterpret_cast<Resource**>( |
| 3182 Heap::get_field_address(this, kResourceOffset)); |
| 3297 } | 3183 } |
| 3298 | 3184 |
| 3299 | 3185 |
| 3300 void ExternalAsciiString::update_data_cache() { | 3186 void ExternalAsciiString::update_data_cache() { |
| 3301 if (is_short()) return; | 3187 if (is_short()) return; |
| 3302 const char** data_field = | 3188 const char** data_field = reinterpret_cast<const char**>( |
| 3303 reinterpret_cast<const char**>(FIELD_ADDR(this, kResourceDataOffset)); | 3189 Heap::get_field_address(this, kResourceDataOffset)); |
| 3304 *data_field = resource()->data(); | 3190 *data_field = resource()->data(); |
| 3305 } | 3191 } |
| 3306 | 3192 |
| 3307 | 3193 |
| 3308 void ExternalAsciiString::set_resource( | 3194 void ExternalAsciiString::set_resource( |
| 3309 const ExternalAsciiString::Resource* resource) { | 3195 const ExternalAsciiString::Resource* resource) { |
| 3310 ASSERT(IsAligned(reinterpret_cast<intptr_t>(resource), kPointerSize)); | 3196 ASSERT(IsAligned(reinterpret_cast<intptr_t>(resource), kPointerSize)); |
| 3311 *reinterpret_cast<const Resource**>( | 3197 *reinterpret_cast<const Resource**>( |
| 3312 FIELD_ADDR(this, kResourceOffset)) = resource; | 3198 Heap::get_field_address(this, kResourceOffset)) = resource; |
| 3313 if (resource != NULL) update_data_cache(); | 3199 if (resource != NULL) update_data_cache(); |
| 3314 } | 3200 } |
| 3315 | 3201 |
| 3316 | 3202 |
| 3317 const uint8_t* ExternalAsciiString::GetChars() { | 3203 const uint8_t* ExternalAsciiString::GetChars() { |
| 3318 return reinterpret_cast<const uint8_t*>(resource()->data()); | 3204 return reinterpret_cast<const uint8_t*>(resource()->data()); |
| 3319 } | 3205 } |
| 3320 | 3206 |
| 3321 | 3207 |
| 3322 uint16_t ExternalAsciiString::ExternalAsciiStringGet(int index) { | 3208 uint16_t ExternalAsciiString::ExternalAsciiStringGet(int index) { |
| 3323 ASSERT(index >= 0 && index < length()); | 3209 ASSERT(index >= 0 && index < length()); |
| 3324 return GetChars()[index]; | 3210 return GetChars()[index]; |
| 3325 } | 3211 } |
| 3326 | 3212 |
| 3327 | 3213 |
| 3328 const ExternalTwoByteString::Resource* ExternalTwoByteString::resource() { | 3214 const ExternalTwoByteString::Resource* ExternalTwoByteString::resource() { |
| 3329 return *reinterpret_cast<Resource**>(FIELD_ADDR(this, kResourceOffset)); | 3215 return *reinterpret_cast<Resource**>( |
| 3216 Heap::get_field_address(this, kResourceOffset)); |
| 3330 } | 3217 } |
| 3331 | 3218 |
| 3332 | 3219 |
| 3333 void ExternalTwoByteString::update_data_cache() { | 3220 void ExternalTwoByteString::update_data_cache() { |
| 3334 if (is_short()) return; | 3221 if (is_short()) return; |
| 3335 const uint16_t** data_field = | 3222 const uint16_t** data_field = reinterpret_cast<const uint16_t**>( |
| 3336 reinterpret_cast<const uint16_t**>(FIELD_ADDR(this, kResourceDataOffset)); | 3223 Heap::get_field_address(this, kResourceDataOffset)); |
| 3337 *data_field = resource()->data(); | 3224 *data_field = resource()->data(); |
| 3338 } | 3225 } |
| 3339 | 3226 |
| 3340 | 3227 |
| 3341 void ExternalTwoByteString::set_resource( | 3228 void ExternalTwoByteString::set_resource( |
| 3342 const ExternalTwoByteString::Resource* resource) { | 3229 const ExternalTwoByteString::Resource* resource) { |
| 3343 *reinterpret_cast<const Resource**>( | 3230 *reinterpret_cast<const Resource**>( |
| 3344 FIELD_ADDR(this, kResourceOffset)) = resource; | 3231 Heap::get_field_address(this, kResourceOffset)) = resource; |
| 3345 if (resource != NULL) update_data_cache(); | 3232 if (resource != NULL) update_data_cache(); |
| 3346 } | 3233 } |
| 3347 | 3234 |
| 3348 | 3235 |
| 3349 const uint16_t* ExternalTwoByteString::GetChars() { | 3236 const uint16_t* ExternalTwoByteString::GetChars() { |
| 3350 return resource()->data(); | 3237 return resource()->data(); |
| 3351 } | 3238 } |
| 3352 | 3239 |
| 3353 | 3240 |
| 3354 uint16_t ExternalTwoByteString::ExternalTwoByteStringGet(int index) { | 3241 uint16_t ExternalTwoByteString::ExternalTwoByteStringGet(int index) { |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3480 } | 3367 } |
| 3481 | 3368 |
| 3482 | 3369 |
| 3483 void JSFunctionResultCache::set_finger_index(int finger_index) { | 3370 void JSFunctionResultCache::set_finger_index(int finger_index) { |
| 3484 set(kFingerIndex, Smi::FromInt(finger_index)); | 3371 set(kFingerIndex, Smi::FromInt(finger_index)); |
| 3485 } | 3372 } |
| 3486 | 3373 |
| 3487 | 3374 |
| 3488 byte ByteArray::get(int index) { | 3375 byte ByteArray::get(int index) { |
| 3489 ASSERT(index >= 0 && index < this->length()); | 3376 ASSERT(index >= 0 && index < this->length()); |
| 3490 return READ_BYTE_FIELD(this, kHeaderSize + index * kCharSize); | 3377 return Heap::read_byte_field(this, kHeaderSize + index * kCharSize); |
| 3491 } | 3378 } |
| 3492 | 3379 |
| 3493 | 3380 |
| 3494 void ByteArray::set(int index, byte value) { | 3381 void ByteArray::set(int index, byte value) { |
| 3495 ASSERT(index >= 0 && index < this->length()); | 3382 ASSERT(index >= 0 && index < this->length()); |
| 3496 WRITE_BYTE_FIELD(this, kHeaderSize + index * kCharSize, value); | 3383 Heap::write_byte_field(this, kHeaderSize + index * kCharSize, value); |
| 3497 } | 3384 } |
| 3498 | 3385 |
| 3499 | 3386 |
| 3500 int ByteArray::get_int(int index) { | 3387 int ByteArray::get_int(int index) { |
| 3501 ASSERT(index >= 0 && (index * kIntSize) < this->length()); | 3388 ASSERT(index >= 0 && (index * kIntSize) < this->length()); |
| 3502 return READ_INT_FIELD(this, kHeaderSize + index * kIntSize); | 3389 return Heap::read_int_field(this, kHeaderSize + index * kIntSize); |
| 3503 } | 3390 } |
| 3504 | 3391 |
| 3505 | 3392 |
| 3506 ByteArray* ByteArray::FromDataStartAddress(Address address) { | 3393 ByteArray* ByteArray::FromDataStartAddress(Address address) { |
| 3507 ASSERT_TAG_ALIGNED(address); | 3394 ASSERT_TAG_ALIGNED(address); |
| 3508 return reinterpret_cast<ByteArray*>(address - kHeaderSize + kHeapObjectTag); | 3395 return reinterpret_cast<ByteArray*>(address - kHeaderSize + kHeapObjectTag); |
| 3509 } | 3396 } |
| 3510 | 3397 |
| 3511 | 3398 |
| 3512 Address ByteArray::GetDataStartAddress() { | 3399 Address ByteArray::GetDataStartAddress() { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 3535 | 3422 |
| 3536 | 3423 |
| 3537 void ExternalUint8ClampedArray::set(int index, uint8_t value) { | 3424 void ExternalUint8ClampedArray::set(int index, uint8_t value) { |
| 3538 ASSERT((index >= 0) && (index < this->length())); | 3425 ASSERT((index >= 0) && (index < this->length())); |
| 3539 uint8_t* ptr = external_uint8_clamped_pointer(); | 3426 uint8_t* ptr = external_uint8_clamped_pointer(); |
| 3540 ptr[index] = value; | 3427 ptr[index] = value; |
| 3541 } | 3428 } |
| 3542 | 3429 |
| 3543 | 3430 |
| 3544 void* ExternalArray::external_pointer() { | 3431 void* ExternalArray::external_pointer() { |
| 3545 intptr_t ptr = READ_INTPTR_FIELD(this, kExternalPointerOffset); | 3432 intptr_t ptr = Heap::read_intptr_field(this, kExternalPointerOffset); |
| 3546 return reinterpret_cast<void*>(ptr); | 3433 return reinterpret_cast<void*>(ptr); |
| 3547 } | 3434 } |
| 3548 | 3435 |
| 3549 | 3436 |
| 3550 void ExternalArray::set_external_pointer(void* value, WriteBarrierMode mode) { | 3437 void ExternalArray::set_external_pointer(void* value, WriteBarrierMode mode) { |
| 3551 intptr_t ptr = reinterpret_cast<intptr_t>(value); | 3438 intptr_t ptr = reinterpret_cast<intptr_t>(value); |
| 3552 WRITE_INTPTR_FIELD(this, kExternalPointerOffset, ptr); | 3439 Heap::write_intptr_field(this, kExternalPointerOffset, ptr); |
| 3553 } | 3440 } |
| 3554 | 3441 |
| 3555 | 3442 |
| 3556 int8_t ExternalInt8Array::get_scalar(int index) { | 3443 int8_t ExternalInt8Array::get_scalar(int index) { |
| 3557 ASSERT((index >= 0) && (index < this->length())); | 3444 ASSERT((index >= 0) && (index < this->length())); |
| 3558 int8_t* ptr = static_cast<int8_t*>(external_pointer()); | 3445 int8_t* ptr = static_cast<int8_t*>(external_pointer()); |
| 3559 return ptr[index]; | 3446 return ptr[index]; |
| 3560 } | 3447 } |
| 3561 | 3448 |
| 3562 | 3449 |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3713 | 3600 |
| 3714 | 3601 |
| 3715 void ExternalFloat64Array::set(int index, double value) { | 3602 void ExternalFloat64Array::set(int index, double value) { |
| 3716 ASSERT((index >= 0) && (index < this->length())); | 3603 ASSERT((index >= 0) && (index < this->length())); |
| 3717 double* ptr = static_cast<double*>(external_pointer()); | 3604 double* ptr = static_cast<double*>(external_pointer()); |
| 3718 ptr[index] = value; | 3605 ptr[index] = value; |
| 3719 } | 3606 } |
| 3720 | 3607 |
| 3721 | 3608 |
| 3722 void* FixedTypedArrayBase::DataPtr() { | 3609 void* FixedTypedArrayBase::DataPtr() { |
| 3723 return FIELD_ADDR(this, kDataOffset); | 3610 return Heap::get_field_address(this, kDataOffset); |
| 3724 } | 3611 } |
| 3725 | 3612 |
| 3726 | 3613 |
| 3727 int FixedTypedArrayBase::DataSize() { | 3614 int FixedTypedArrayBase::DataSize() { |
| 3728 InstanceType instance_type = map()->instance_type(); | 3615 InstanceType instance_type = map()->instance_type(); |
| 3729 int element_size; | 3616 int element_size; |
| 3730 switch (instance_type) { | 3617 switch (instance_type) { |
| 3731 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \ | 3618 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \ |
| 3732 case FIXED_##TYPE##_ARRAY_TYPE: \ | 3619 case FIXED_##TYPE##_ARRAY_TYPE: \ |
| 3733 element_size = size; \ | 3620 element_size = size; \ |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3774 } | 3661 } |
| 3775 | 3662 |
| 3776 | 3663 |
| 3777 double Float64ArrayTraits::defaultValue() { return OS::nan_value(); } | 3664 double Float64ArrayTraits::defaultValue() { return OS::nan_value(); } |
| 3778 | 3665 |
| 3779 | 3666 |
| 3780 template <class Traits> | 3667 template <class Traits> |
| 3781 typename Traits::ElementType FixedTypedArray<Traits>::get_scalar(int index) { | 3668 typename Traits::ElementType FixedTypedArray<Traits>::get_scalar(int index) { |
| 3782 ASSERT((index >= 0) && (index < this->length())); | 3669 ASSERT((index >= 0) && (index < this->length())); |
| 3783 ElementType* ptr = reinterpret_cast<ElementType*>( | 3670 ElementType* ptr = reinterpret_cast<ElementType*>( |
| 3784 FIELD_ADDR(this, kDataOffset)); | 3671 Heap::get_field_address(this, kDataOffset)); |
| 3785 return ptr[index]; | 3672 return ptr[index]; |
| 3786 } | 3673 } |
| 3787 | 3674 |
| 3788 | 3675 |
| 3789 template<> inline | 3676 template<> inline |
| 3790 FixedTypedArray<Float64ArrayTraits>::ElementType | 3677 FixedTypedArray<Float64ArrayTraits>::ElementType |
| 3791 FixedTypedArray<Float64ArrayTraits>::get_scalar(int index) { | 3678 FixedTypedArray<Float64ArrayTraits>::get_scalar(int index) { |
| 3792 ASSERT((index >= 0) && (index < this->length())); | 3679 ASSERT((index >= 0) && (index < this->length())); |
| 3793 return READ_DOUBLE_FIELD(this, ElementOffset(index)); | 3680 return Heap::read_double_field(this, ElementOffset(index)); |
| 3794 } | 3681 } |
| 3795 | 3682 |
| 3796 | 3683 |
| 3797 template <class Traits> | 3684 template <class Traits> |
| 3798 void FixedTypedArray<Traits>::set(int index, ElementType value) { | 3685 void FixedTypedArray<Traits>::set(int index, ElementType value) { |
| 3799 ASSERT((index >= 0) && (index < this->length())); | 3686 ASSERT((index >= 0) && (index < this->length())); |
| 3800 ElementType* ptr = reinterpret_cast<ElementType*>( | 3687 ElementType* ptr = reinterpret_cast<ElementType*>( |
| 3801 FIELD_ADDR(this, kDataOffset)); | 3688 Heap::get_field_address(this, kDataOffset)); |
| 3802 ptr[index] = value; | 3689 ptr[index] = value; |
| 3803 } | 3690 } |
| 3804 | 3691 |
| 3805 | 3692 |
| 3806 template<> inline | 3693 template<> inline |
| 3807 void FixedTypedArray<Float64ArrayTraits>::set( | 3694 void FixedTypedArray<Float64ArrayTraits>::set( |
| 3808 int index, Float64ArrayTraits::ElementType value) { | 3695 int index, Float64ArrayTraits::ElementType value) { |
| 3809 ASSERT((index >= 0) && (index < this->length())); | 3696 ASSERT((index >= 0) && (index < this->length())); |
| 3810 WRITE_DOUBLE_FIELD(this, ElementOffset(index), value); | 3697 Heap::write_double_field(this, ElementOffset(index), value); |
| 3811 } | 3698 } |
| 3812 | 3699 |
| 3813 | 3700 |
| 3814 template <class Traits> | 3701 template <class Traits> |
| 3815 typename Traits::ElementType FixedTypedArray<Traits>::from_int(int value) { | 3702 typename Traits::ElementType FixedTypedArray<Traits>::from_int(int value) { |
| 3816 return static_cast<ElementType>(value); | 3703 return static_cast<ElementType>(value); |
| 3817 } | 3704 } |
| 3818 | 3705 |
| 3819 | 3706 |
| 3820 template <> inline | 3707 template <> inline |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3924 return isolate->factory()->NewNumber(scalar); | 3811 return isolate->factory()->NewNumber(scalar); |
| 3925 } | 3812 } |
| 3926 | 3813 |
| 3927 | 3814 |
| 3928 Handle<Object> Float64ArrayTraits::ToHandle(Isolate* isolate, double scalar) { | 3815 Handle<Object> Float64ArrayTraits::ToHandle(Isolate* isolate, double scalar) { |
| 3929 return isolate->factory()->NewNumber(scalar); | 3816 return isolate->factory()->NewNumber(scalar); |
| 3930 } | 3817 } |
| 3931 | 3818 |
| 3932 | 3819 |
| 3933 int Map::visitor_id() { | 3820 int Map::visitor_id() { |
| 3934 return READ_BYTE_FIELD(this, kVisitorIdOffset); | 3821 return Heap::read_byte_field(this, kVisitorIdOffset); |
| 3935 } | 3822 } |
| 3936 | 3823 |
| 3937 | 3824 |
| 3938 void Map::set_visitor_id(int id) { | 3825 void Map::set_visitor_id(int id) { |
| 3939 ASSERT(0 <= id && id < 256); | 3826 ASSERT(0 <= id && id < 256); |
| 3940 WRITE_BYTE_FIELD(this, kVisitorIdOffset, static_cast<byte>(id)); | 3827 Heap::write_byte_field(this, kVisitorIdOffset, static_cast<byte>(id)); |
| 3941 } | 3828 } |
| 3942 | 3829 |
| 3943 | 3830 |
| 3944 int Map::instance_size() { | 3831 int Map::instance_size() { |
| 3945 return NOBARRIER_READ_BYTE_FIELD( | 3832 return Heap::nobarrier_read_byte_field( |
| 3946 this, kInstanceSizeOffset) << kPointerSizeLog2; | 3833 this, kInstanceSizeOffset) << kPointerSizeLog2; |
| 3947 } | 3834 } |
| 3948 | 3835 |
| 3949 | 3836 |
| 3950 int Map::inobject_properties() { | 3837 int Map::inobject_properties() { |
| 3951 return READ_BYTE_FIELD(this, kInObjectPropertiesOffset); | 3838 return Heap::read_byte_field(this, kInObjectPropertiesOffset); |
| 3952 } | 3839 } |
| 3953 | 3840 |
| 3954 | 3841 |
| 3955 int Map::pre_allocated_property_fields() { | 3842 int Map::pre_allocated_property_fields() { |
| 3956 return READ_BYTE_FIELD(this, kPreAllocatedPropertyFieldsOffset); | 3843 return Heap::read_byte_field(this, kPreAllocatedPropertyFieldsOffset); |
| 3957 } | 3844 } |
| 3958 | 3845 |
| 3959 | 3846 |
| 3960 int Map::GetInObjectPropertyOffset(int index) { | 3847 int Map::GetInObjectPropertyOffset(int index) { |
| 3961 // Adjust for the number of properties stored in the object. | 3848 // Adjust for the number of properties stored in the object. |
| 3962 index -= inobject_properties(); | 3849 index -= inobject_properties(); |
| 3963 ASSERT(index < 0); | 3850 ASSERT(index < 0); |
| 3964 return instance_size() + (index * kPointerSize); | 3851 return instance_size() + (index * kPointerSize); |
| 3965 } | 3852 } |
| 3966 | 3853 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4006 } | 3893 } |
| 4007 ASSERT(instance_type == CODE_TYPE); | 3894 ASSERT(instance_type == CODE_TYPE); |
| 4008 return reinterpret_cast<Code*>(this)->CodeSize(); | 3895 return reinterpret_cast<Code*>(this)->CodeSize(); |
| 4009 } | 3896 } |
| 4010 | 3897 |
| 4011 | 3898 |
| 4012 void Map::set_instance_size(int value) { | 3899 void Map::set_instance_size(int value) { |
| 4013 ASSERT_EQ(0, value & (kPointerSize - 1)); | 3900 ASSERT_EQ(0, value & (kPointerSize - 1)); |
| 4014 value >>= kPointerSizeLog2; | 3901 value >>= kPointerSizeLog2; |
| 4015 ASSERT(0 <= value && value < 256); | 3902 ASSERT(0 <= value && value < 256); |
| 4016 NOBARRIER_WRITE_BYTE_FIELD( | 3903 Heap::nobarrier_write_byte_field( |
| 4017 this, kInstanceSizeOffset, static_cast<byte>(value)); | 3904 this, kInstanceSizeOffset, static_cast<byte>(value)); |
| 4018 } | 3905 } |
| 4019 | 3906 |
| 4020 | 3907 |
| 4021 void Map::set_inobject_properties(int value) { | 3908 void Map::set_inobject_properties(int value) { |
| 4022 ASSERT(0 <= value && value < 256); | 3909 ASSERT(0 <= value && value < 256); |
| 4023 WRITE_BYTE_FIELD(this, kInObjectPropertiesOffset, static_cast<byte>(value)); | 3910 Heap::write_byte_field( |
| 3911 this, |
| 3912 kInObjectPropertiesOffset, |
| 3913 static_cast<byte>(value)); |
| 4024 } | 3914 } |
| 4025 | 3915 |
| 4026 | 3916 |
| 4027 void Map::set_pre_allocated_property_fields(int value) { | 3917 void Map::set_pre_allocated_property_fields(int value) { |
| 4028 ASSERT(0 <= value && value < 256); | 3918 ASSERT(0 <= value && value < 256); |
| 4029 WRITE_BYTE_FIELD(this, | 3919 Heap::write_byte_field(this, |
| 4030 kPreAllocatedPropertyFieldsOffset, | 3920 kPreAllocatedPropertyFieldsOffset, |
| 4031 static_cast<byte>(value)); | 3921 static_cast<byte>(value)); |
| 4032 } | 3922 } |
| 4033 | 3923 |
| 4034 | 3924 |
| 4035 InstanceType Map::instance_type() { | 3925 InstanceType Map::instance_type() { |
| 4036 return static_cast<InstanceType>(READ_BYTE_FIELD(this, kInstanceTypeOffset)); | 3926 return static_cast<InstanceType>( |
| 3927 Heap::read_byte_field(this, kInstanceTypeOffset)); |
| 4037 } | 3928 } |
| 4038 | 3929 |
| 4039 | 3930 |
| 4040 void Map::set_instance_type(InstanceType value) { | 3931 void Map::set_instance_type(InstanceType value) { |
| 4041 WRITE_BYTE_FIELD(this, kInstanceTypeOffset, value); | 3932 Heap::write_byte_field(this, kInstanceTypeOffset, value); |
| 4042 } | 3933 } |
| 4043 | 3934 |
| 4044 | 3935 |
| 4045 int Map::unused_property_fields() { | 3936 int Map::unused_property_fields() { |
| 4046 return READ_BYTE_FIELD(this, kUnusedPropertyFieldsOffset); | 3937 return Heap::read_byte_field(this, kUnusedPropertyFieldsOffset); |
| 4047 } | 3938 } |
| 4048 | 3939 |
| 4049 | 3940 |
| 4050 void Map::set_unused_property_fields(int value) { | 3941 void Map::set_unused_property_fields(int value) { |
| 4051 WRITE_BYTE_FIELD(this, kUnusedPropertyFieldsOffset, Min(value, 255)); | 3942 Heap::write_byte_field(this, kUnusedPropertyFieldsOffset, Min(value, 255)); |
| 4052 } | 3943 } |
| 4053 | 3944 |
| 4054 | 3945 |
| 4055 byte Map::bit_field() { | 3946 byte Map::bit_field() { |
| 4056 return READ_BYTE_FIELD(this, kBitFieldOffset); | 3947 return Heap::read_byte_field(this, kBitFieldOffset); |
| 4057 } | 3948 } |
| 4058 | 3949 |
| 4059 | 3950 |
| 4060 void Map::set_bit_field(byte value) { | 3951 void Map::set_bit_field(byte value) { |
| 4061 WRITE_BYTE_FIELD(this, kBitFieldOffset, value); | 3952 Heap::write_byte_field(this, kBitFieldOffset, value); |
| 4062 } | 3953 } |
| 4063 | 3954 |
| 4064 | 3955 |
| 4065 byte Map::bit_field2() { | 3956 byte Map::bit_field2() { |
| 4066 return READ_BYTE_FIELD(this, kBitField2Offset); | 3957 return Heap::read_byte_field(this, kBitField2Offset); |
| 4067 } | 3958 } |
| 4068 | 3959 |
| 4069 | 3960 |
| 4070 void Map::set_bit_field2(byte value) { | 3961 void Map::set_bit_field2(byte value) { |
| 4071 WRITE_BYTE_FIELD(this, kBitField2Offset, value); | 3962 Heap::write_byte_field(this, kBitField2Offset, value); |
| 4072 } | 3963 } |
| 4073 | 3964 |
| 4074 | 3965 |
| 4075 void Map::set_non_instance_prototype(bool value) { | 3966 void Map::set_non_instance_prototype(bool value) { |
| 4076 if (value) { | 3967 if (value) { |
| 4077 set_bit_field(bit_field() | (1 << kHasNonInstancePrototype)); | 3968 set_bit_field(bit_field() | (1 << kHasNonInstancePrototype)); |
| 4078 } else { | 3969 } else { |
| 4079 set_bit_field(bit_field() & ~(1 << kHasNonInstancePrototype)); | 3970 set_bit_field(bit_field() & ~(1 << kHasNonInstancePrototype)); |
| 4080 } | 3971 } |
| 4081 } | 3972 } |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4151 set_bit_field3(new_bit_field3); | 4042 set_bit_field3(new_bit_field3); |
| 4152 } | 4043 } |
| 4153 | 4044 |
| 4154 | 4045 |
| 4155 bool Map::is_dictionary_map() { | 4046 bool Map::is_dictionary_map() { |
| 4156 return DictionaryMap::decode(bit_field3()); | 4047 return DictionaryMap::decode(bit_field3()); |
| 4157 } | 4048 } |
| 4158 | 4049 |
| 4159 | 4050 |
| 4160 Code::Flags Code::flags() { | 4051 Code::Flags Code::flags() { |
| 4161 return static_cast<Flags>(READ_INT_FIELD(this, kFlagsOffset)); | 4052 return static_cast<Flags>(Heap::read_int_field(this, kFlagsOffset)); |
| 4162 } | 4053 } |
| 4163 | 4054 |
| 4164 | 4055 |
| 4165 void Map::set_owns_descriptors(bool is_shared) { | 4056 void Map::set_owns_descriptors(bool is_shared) { |
| 4166 set_bit_field3(OwnsDescriptors::update(bit_field3(), is_shared)); | 4057 set_bit_field3(OwnsDescriptors::update(bit_field3(), is_shared)); |
| 4167 } | 4058 } |
| 4168 | 4059 |
| 4169 | 4060 |
| 4170 bool Map::owns_descriptors() { | 4061 bool Map::owns_descriptors() { |
| 4171 return OwnsDescriptors::decode(bit_field3()); | 4062 return OwnsDescriptors::decode(bit_field3()); |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4312 for (int g = kGroupCount - 1; g > group; g--) { | 4203 for (int g = kGroupCount - 1; g > group; g--) { |
| 4313 if (starts.at(g) < starts.at(g + 1)) { | 4204 if (starts.at(g) < starts.at(g + 1)) { |
| 4314 copy(starts.at(g), starts.at(g + 1)); | 4205 copy(starts.at(g), starts.at(g + 1)); |
| 4315 } | 4206 } |
| 4316 } | 4207 } |
| 4317 } | 4208 } |
| 4318 | 4209 |
| 4319 | 4210 |
| 4320 void Code::set_flags(Code::Flags flags) { | 4211 void Code::set_flags(Code::Flags flags) { |
| 4321 STATIC_ASSERT(Code::NUMBER_OF_KINDS <= KindField::kMax + 1); | 4212 STATIC_ASSERT(Code::NUMBER_OF_KINDS <= KindField::kMax + 1); |
| 4322 WRITE_INT_FIELD(this, kFlagsOffset, flags); | 4213 Heap::write_int_field(this, kFlagsOffset, flags); |
| 4323 } | 4214 } |
| 4324 | 4215 |
| 4325 | 4216 |
| 4326 Code::Kind Code::kind() { | 4217 Code::Kind Code::kind() { |
| 4327 return ExtractKindFromFlags(flags()); | 4218 return ExtractKindFromFlags(flags()); |
| 4328 } | 4219 } |
| 4329 | 4220 |
| 4330 | 4221 |
| 4331 InlineCacheState Code::ic_state() { | 4222 InlineCacheState Code::ic_state() { |
| 4332 InlineCacheState result = ExtractICStateFromFlags(flags()); | 4223 InlineCacheState result = ExtractICStateFromFlags(flags()); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 4346 } | 4237 } |
| 4347 | 4238 |
| 4348 | 4239 |
| 4349 Code::StubType Code::type() { | 4240 Code::StubType Code::type() { |
| 4350 return ExtractTypeFromFlags(flags()); | 4241 return ExtractTypeFromFlags(flags()); |
| 4351 } | 4242 } |
| 4352 | 4243 |
| 4353 | 4244 |
| 4354 // For initialization. | 4245 // For initialization. |
| 4355 void Code::set_raw_kind_specific_flags1(int value) { | 4246 void Code::set_raw_kind_specific_flags1(int value) { |
| 4356 WRITE_INT_FIELD(this, kKindSpecificFlags1Offset, value); | 4247 Heap::write_int_field(this, kKindSpecificFlags1Offset, value); |
| 4357 } | 4248 } |
| 4358 | 4249 |
| 4359 | 4250 |
| 4360 void Code::set_raw_kind_specific_flags2(int value) { | 4251 void Code::set_raw_kind_specific_flags2(int value) { |
| 4361 WRITE_INT_FIELD(this, kKindSpecificFlags2Offset, value); | 4252 Heap::write_int_field(this, kKindSpecificFlags2Offset, value); |
| 4362 } | 4253 } |
| 4363 | 4254 |
| 4364 | 4255 |
| 4365 inline bool Code::is_crankshafted() { | 4256 inline bool Code::is_crankshafted() { |
| 4366 return IsCrankshaftedField::decode( | 4257 return IsCrankshaftedField::decode( |
| 4367 READ_UINT32_FIELD(this, kKindSpecificFlags2Offset)); | 4258 Heap::read_uint32_field(this, kKindSpecificFlags2Offset)); |
| 4368 } | 4259 } |
| 4369 | 4260 |
| 4370 | 4261 |
| 4371 inline void Code::set_is_crankshafted(bool value) { | 4262 inline void Code::set_is_crankshafted(bool value) { |
| 4372 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags2Offset); | 4263 int previous = Heap::read_uint32_field(this, kKindSpecificFlags2Offset); |
| 4373 int updated = IsCrankshaftedField::update(previous, value); | 4264 int updated = IsCrankshaftedField::update(previous, value); |
| 4374 WRITE_UINT32_FIELD(this, kKindSpecificFlags2Offset, updated); | 4265 Heap::write_uint32_field(this, kKindSpecificFlags2Offset, updated); |
| 4375 } | 4266 } |
| 4376 | 4267 |
| 4377 | 4268 |
| 4378 int Code::major_key() { | 4269 int Code::major_key() { |
| 4379 ASSERT(has_major_key()); | 4270 ASSERT(has_major_key()); |
| 4380 return StubMajorKeyField::decode( | 4271 return StubMajorKeyField::decode( |
| 4381 READ_UINT32_FIELD(this, kKindSpecificFlags2Offset)); | 4272 Heap::read_uint32_field(this, kKindSpecificFlags2Offset)); |
| 4382 } | 4273 } |
| 4383 | 4274 |
| 4384 | 4275 |
| 4385 void Code::set_major_key(int major) { | 4276 void Code::set_major_key(int major) { |
| 4386 ASSERT(has_major_key()); | 4277 ASSERT(has_major_key()); |
| 4387 ASSERT(0 <= major && major < 256); | 4278 ASSERT(0 <= major && major < 256); |
| 4388 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags2Offset); | 4279 int previous = Heap::read_uint32_field(this, kKindSpecificFlags2Offset); |
| 4389 int updated = StubMajorKeyField::update(previous, major); | 4280 int updated = StubMajorKeyField::update(previous, major); |
| 4390 WRITE_UINT32_FIELD(this, kKindSpecificFlags2Offset, updated); | 4281 Heap::write_uint32_field(this, kKindSpecificFlags2Offset, updated); |
| 4391 } | 4282 } |
| 4392 | 4283 |
| 4393 | 4284 |
| 4394 bool Code::has_major_key() { | 4285 bool Code::has_major_key() { |
| 4395 return kind() == STUB || | 4286 return kind() == STUB || |
| 4396 kind() == HANDLER || | 4287 kind() == HANDLER || |
| 4397 kind() == BINARY_OP_IC || | 4288 kind() == BINARY_OP_IC || |
| 4398 kind() == COMPARE_IC || | 4289 kind() == COMPARE_IC || |
| 4399 kind() == COMPARE_NIL_IC || | 4290 kind() == COMPARE_NIL_IC || |
| 4400 kind() == LOAD_IC || | 4291 kind() == LOAD_IC || |
| 4401 kind() == KEYED_LOAD_IC || | 4292 kind() == KEYED_LOAD_IC || |
| 4402 kind() == STORE_IC || | 4293 kind() == STORE_IC || |
| 4403 kind() == KEYED_STORE_IC || | 4294 kind() == KEYED_STORE_IC || |
| 4404 kind() == TO_BOOLEAN_IC; | 4295 kind() == TO_BOOLEAN_IC; |
| 4405 } | 4296 } |
| 4406 | 4297 |
| 4407 | 4298 |
| 4408 bool Code::optimizable() { | 4299 bool Code::optimizable() { |
| 4409 ASSERT_EQ(FUNCTION, kind()); | 4300 ASSERT_EQ(FUNCTION, kind()); |
| 4410 return READ_BYTE_FIELD(this, kOptimizableOffset) == 1; | 4301 return Heap::read_byte_field(this, kOptimizableOffset) == 1; |
| 4411 } | 4302 } |
| 4412 | 4303 |
| 4413 | 4304 |
| 4414 void Code::set_optimizable(bool value) { | 4305 void Code::set_optimizable(bool value) { |
| 4415 ASSERT_EQ(FUNCTION, kind()); | 4306 ASSERT_EQ(FUNCTION, kind()); |
| 4416 WRITE_BYTE_FIELD(this, kOptimizableOffset, value ? 1 : 0); | 4307 Heap::write_byte_field(this, kOptimizableOffset, value ? 1 : 0); |
| 4417 } | 4308 } |
| 4418 | 4309 |
| 4419 | 4310 |
| 4420 bool Code::has_deoptimization_support() { | 4311 bool Code::has_deoptimization_support() { |
| 4421 ASSERT_EQ(FUNCTION, kind()); | 4312 ASSERT_EQ(FUNCTION, kind()); |
| 4422 byte flags = READ_BYTE_FIELD(this, kFullCodeFlags); | 4313 byte flags = Heap::read_byte_field(this, kFullCodeFlags); |
| 4423 return FullCodeFlagsHasDeoptimizationSupportField::decode(flags); | 4314 return FullCodeFlagsHasDeoptimizationSupportField::decode(flags); |
| 4424 } | 4315 } |
| 4425 | 4316 |
| 4426 | 4317 |
| 4427 void Code::set_has_deoptimization_support(bool value) { | 4318 void Code::set_has_deoptimization_support(bool value) { |
| 4428 ASSERT_EQ(FUNCTION, kind()); | 4319 ASSERT_EQ(FUNCTION, kind()); |
| 4429 byte flags = READ_BYTE_FIELD(this, kFullCodeFlags); | 4320 byte flags = Heap::read_byte_field(this, kFullCodeFlags); |
| 4430 flags = FullCodeFlagsHasDeoptimizationSupportField::update(flags, value); | 4321 flags = FullCodeFlagsHasDeoptimizationSupportField::update(flags, value); |
| 4431 WRITE_BYTE_FIELD(this, kFullCodeFlags, flags); | 4322 Heap::write_byte_field(this, kFullCodeFlags, flags); |
| 4432 } | 4323 } |
| 4433 | 4324 |
| 4434 | 4325 |
| 4435 bool Code::has_debug_break_slots() { | 4326 bool Code::has_debug_break_slots() { |
| 4436 ASSERT_EQ(FUNCTION, kind()); | 4327 ASSERT_EQ(FUNCTION, kind()); |
| 4437 byte flags = READ_BYTE_FIELD(this, kFullCodeFlags); | 4328 byte flags = Heap::read_byte_field(this, kFullCodeFlags); |
| 4438 return FullCodeFlagsHasDebugBreakSlotsField::decode(flags); | 4329 return FullCodeFlagsHasDebugBreakSlotsField::decode(flags); |
| 4439 } | 4330 } |
| 4440 | 4331 |
| 4441 | 4332 |
| 4442 void Code::set_has_debug_break_slots(bool value) { | 4333 void Code::set_has_debug_break_slots(bool value) { |
| 4443 ASSERT_EQ(FUNCTION, kind()); | 4334 ASSERT_EQ(FUNCTION, kind()); |
| 4444 byte flags = READ_BYTE_FIELD(this, kFullCodeFlags); | 4335 byte flags = Heap::read_byte_field(this, kFullCodeFlags); |
| 4445 flags = FullCodeFlagsHasDebugBreakSlotsField::update(flags, value); | 4336 flags = FullCodeFlagsHasDebugBreakSlotsField::update(flags, value); |
| 4446 WRITE_BYTE_FIELD(this, kFullCodeFlags, flags); | 4337 Heap::write_byte_field(this, kFullCodeFlags, flags); |
| 4447 } | 4338 } |
| 4448 | 4339 |
| 4449 | 4340 |
| 4450 bool Code::is_compiled_optimizable() { | 4341 bool Code::is_compiled_optimizable() { |
| 4451 ASSERT_EQ(FUNCTION, kind()); | 4342 ASSERT_EQ(FUNCTION, kind()); |
| 4452 byte flags = READ_BYTE_FIELD(this, kFullCodeFlags); | 4343 byte flags = Heap::read_byte_field(this, kFullCodeFlags); |
| 4453 return FullCodeFlagsIsCompiledOptimizable::decode(flags); | 4344 return FullCodeFlagsIsCompiledOptimizable::decode(flags); |
| 4454 } | 4345 } |
| 4455 | 4346 |
| 4456 | 4347 |
| 4457 void Code::set_compiled_optimizable(bool value) { | 4348 void Code::set_compiled_optimizable(bool value) { |
| 4458 ASSERT_EQ(FUNCTION, kind()); | 4349 ASSERT_EQ(FUNCTION, kind()); |
| 4459 byte flags = READ_BYTE_FIELD(this, kFullCodeFlags); | 4350 byte flags = Heap::read_byte_field(this, kFullCodeFlags); |
| 4460 flags = FullCodeFlagsIsCompiledOptimizable::update(flags, value); | 4351 flags = FullCodeFlagsIsCompiledOptimizable::update(flags, value); |
| 4461 WRITE_BYTE_FIELD(this, kFullCodeFlags, flags); | 4352 Heap::write_byte_field(this, kFullCodeFlags, flags); |
| 4462 } | 4353 } |
| 4463 | 4354 |
| 4464 | 4355 |
| 4465 int Code::allow_osr_at_loop_nesting_level() { | 4356 int Code::allow_osr_at_loop_nesting_level() { |
| 4466 ASSERT_EQ(FUNCTION, kind()); | 4357 ASSERT_EQ(FUNCTION, kind()); |
| 4467 return READ_BYTE_FIELD(this, kAllowOSRAtLoopNestingLevelOffset); | 4358 return Heap::read_byte_field(this, kAllowOSRAtLoopNestingLevelOffset); |
| 4468 } | 4359 } |
| 4469 | 4360 |
| 4470 | 4361 |
| 4471 void Code::set_allow_osr_at_loop_nesting_level(int level) { | 4362 void Code::set_allow_osr_at_loop_nesting_level(int level) { |
| 4472 ASSERT_EQ(FUNCTION, kind()); | 4363 ASSERT_EQ(FUNCTION, kind()); |
| 4473 ASSERT(level >= 0 && level <= kMaxLoopNestingMarker); | 4364 ASSERT(level >= 0 && level <= kMaxLoopNestingMarker); |
| 4474 WRITE_BYTE_FIELD(this, kAllowOSRAtLoopNestingLevelOffset, level); | 4365 Heap::write_byte_field(this, kAllowOSRAtLoopNestingLevelOffset, level); |
| 4475 } | 4366 } |
| 4476 | 4367 |
| 4477 | 4368 |
| 4478 int Code::profiler_ticks() { | 4369 int Code::profiler_ticks() { |
| 4479 ASSERT_EQ(FUNCTION, kind()); | 4370 ASSERT_EQ(FUNCTION, kind()); |
| 4480 return READ_BYTE_FIELD(this, kProfilerTicksOffset); | 4371 return Heap::read_byte_field(this, kProfilerTicksOffset); |
| 4481 } | 4372 } |
| 4482 | 4373 |
| 4483 | 4374 |
| 4484 void Code::set_profiler_ticks(int ticks) { | 4375 void Code::set_profiler_ticks(int ticks) { |
| 4485 ASSERT_EQ(FUNCTION, kind()); | 4376 ASSERT_EQ(FUNCTION, kind()); |
| 4486 ASSERT(ticks < 256); | 4377 ASSERT(ticks < 256); |
| 4487 WRITE_BYTE_FIELD(this, kProfilerTicksOffset, ticks); | 4378 Heap::write_byte_field(this, kProfilerTicksOffset, ticks); |
| 4488 } | 4379 } |
| 4489 | 4380 |
| 4490 | 4381 |
| 4491 unsigned Code::stack_slots() { | 4382 unsigned Code::stack_slots() { |
| 4492 ASSERT(is_crankshafted()); | 4383 ASSERT(is_crankshafted()); |
| 4493 return StackSlotsField::decode( | 4384 return StackSlotsField::decode( |
| 4494 READ_UINT32_FIELD(this, kKindSpecificFlags1Offset)); | 4385 Heap::read_uint32_field(this, kKindSpecificFlags1Offset)); |
| 4495 } | 4386 } |
| 4496 | 4387 |
| 4497 | 4388 |
| 4498 void Code::set_stack_slots(unsigned slots) { | 4389 void Code::set_stack_slots(unsigned slots) { |
| 4499 CHECK(slots <= (1 << kStackSlotsBitCount)); | 4390 CHECK(slots <= (1 << kStackSlotsBitCount)); |
| 4500 ASSERT(is_crankshafted()); | 4391 ASSERT(is_crankshafted()); |
| 4501 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags1Offset); | 4392 int previous = Heap::read_uint32_field(this, kKindSpecificFlags1Offset); |
| 4502 int updated = StackSlotsField::update(previous, slots); | 4393 int updated = StackSlotsField::update(previous, slots); |
| 4503 WRITE_UINT32_FIELD(this, kKindSpecificFlags1Offset, updated); | 4394 Heap::write_uint32_field(this, kKindSpecificFlags1Offset, updated); |
| 4504 } | 4395 } |
| 4505 | 4396 |
| 4506 | 4397 |
| 4507 unsigned Code::safepoint_table_offset() { | 4398 unsigned Code::safepoint_table_offset() { |
| 4508 ASSERT(is_crankshafted()); | 4399 ASSERT(is_crankshafted()); |
| 4509 return SafepointTableOffsetField::decode( | 4400 return SafepointTableOffsetField::decode( |
| 4510 READ_UINT32_FIELD(this, kKindSpecificFlags2Offset)); | 4401 Heap::read_uint32_field(this, kKindSpecificFlags2Offset)); |
| 4511 } | 4402 } |
| 4512 | 4403 |
| 4513 | 4404 |
| 4514 void Code::set_safepoint_table_offset(unsigned offset) { | 4405 void Code::set_safepoint_table_offset(unsigned offset) { |
| 4515 CHECK(offset <= (1 << kSafepointTableOffsetBitCount)); | 4406 CHECK(offset <= (1 << kSafepointTableOffsetBitCount)); |
| 4516 ASSERT(is_crankshafted()); | 4407 ASSERT(is_crankshafted()); |
| 4517 ASSERT(IsAligned(offset, static_cast<unsigned>(kIntSize))); | 4408 ASSERT(IsAligned(offset, static_cast<unsigned>(kIntSize))); |
| 4518 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags2Offset); | 4409 int previous = Heap::read_uint32_field(this, kKindSpecificFlags2Offset); |
| 4519 int updated = SafepointTableOffsetField::update(previous, offset); | 4410 int updated = SafepointTableOffsetField::update(previous, offset); |
| 4520 WRITE_UINT32_FIELD(this, kKindSpecificFlags2Offset, updated); | 4411 Heap::write_uint32_field(this, kKindSpecificFlags2Offset, updated); |
| 4521 } | 4412 } |
| 4522 | 4413 |
| 4523 | 4414 |
| 4524 unsigned Code::back_edge_table_offset() { | 4415 unsigned Code::back_edge_table_offset() { |
| 4525 ASSERT_EQ(FUNCTION, kind()); | 4416 ASSERT_EQ(FUNCTION, kind()); |
| 4526 return BackEdgeTableOffsetField::decode( | 4417 return BackEdgeTableOffsetField::decode( |
| 4527 READ_UINT32_FIELD(this, kKindSpecificFlags2Offset)); | 4418 Heap::read_uint32_field(this, kKindSpecificFlags2Offset)); |
| 4528 } | 4419 } |
| 4529 | 4420 |
| 4530 | 4421 |
| 4531 void Code::set_back_edge_table_offset(unsigned offset) { | 4422 void Code::set_back_edge_table_offset(unsigned offset) { |
| 4532 ASSERT_EQ(FUNCTION, kind()); | 4423 ASSERT_EQ(FUNCTION, kind()); |
| 4533 ASSERT(IsAligned(offset, static_cast<unsigned>(kIntSize))); | 4424 ASSERT(IsAligned(offset, static_cast<unsigned>(kIntSize))); |
| 4534 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags2Offset); | 4425 int previous = Heap::read_uint32_field(this, kKindSpecificFlags2Offset); |
| 4535 int updated = BackEdgeTableOffsetField::update(previous, offset); | 4426 int updated = BackEdgeTableOffsetField::update(previous, offset); |
| 4536 WRITE_UINT32_FIELD(this, kKindSpecificFlags2Offset, updated); | 4427 Heap::write_uint32_field(this, kKindSpecificFlags2Offset, updated); |
| 4537 } | 4428 } |
| 4538 | 4429 |
| 4539 | 4430 |
| 4540 bool Code::back_edges_patched_for_osr() { | 4431 bool Code::back_edges_patched_for_osr() { |
| 4541 ASSERT_EQ(FUNCTION, kind()); | 4432 ASSERT_EQ(FUNCTION, kind()); |
| 4542 return BackEdgesPatchedForOSRField::decode( | 4433 return BackEdgesPatchedForOSRField::decode( |
| 4543 READ_UINT32_FIELD(this, kKindSpecificFlags2Offset)); | 4434 Heap::read_uint32_field(this, kKindSpecificFlags2Offset)); |
| 4544 } | 4435 } |
| 4545 | 4436 |
| 4546 | 4437 |
| 4547 void Code::set_back_edges_patched_for_osr(bool value) { | 4438 void Code::set_back_edges_patched_for_osr(bool value) { |
| 4548 ASSERT_EQ(FUNCTION, kind()); | 4439 ASSERT_EQ(FUNCTION, kind()); |
| 4549 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags2Offset); | 4440 int previous = Heap::read_uint32_field(this, kKindSpecificFlags2Offset); |
| 4550 int updated = BackEdgesPatchedForOSRField::update(previous, value); | 4441 int updated = BackEdgesPatchedForOSRField::update(previous, value); |
| 4551 WRITE_UINT32_FIELD(this, kKindSpecificFlags2Offset, updated); | 4442 Heap::write_uint32_field(this, kKindSpecificFlags2Offset, updated); |
| 4552 } | 4443 } |
| 4553 | 4444 |
| 4554 | 4445 |
| 4555 | 4446 |
| 4556 byte Code::to_boolean_state() { | 4447 byte Code::to_boolean_state() { |
| 4557 return extra_ic_state(); | 4448 return extra_ic_state(); |
| 4558 } | 4449 } |
| 4559 | 4450 |
| 4560 | 4451 |
| 4561 bool Code::has_function_cache() { | 4452 bool Code::has_function_cache() { |
| 4562 ASSERT(kind() == STUB); | 4453 ASSERT(kind() == STUB); |
| 4563 return HasFunctionCacheField::decode( | 4454 return HasFunctionCacheField::decode( |
| 4564 READ_UINT32_FIELD(this, kKindSpecificFlags1Offset)); | 4455 Heap::read_uint32_field(this, kKindSpecificFlags1Offset)); |
| 4565 } | 4456 } |
| 4566 | 4457 |
| 4567 | 4458 |
| 4568 void Code::set_has_function_cache(bool flag) { | 4459 void Code::set_has_function_cache(bool flag) { |
| 4569 ASSERT(kind() == STUB); | 4460 ASSERT(kind() == STUB); |
| 4570 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags1Offset); | 4461 int previous = Heap::read_uint32_field(this, kKindSpecificFlags1Offset); |
| 4571 int updated = HasFunctionCacheField::update(previous, flag); | 4462 int updated = HasFunctionCacheField::update(previous, flag); |
| 4572 WRITE_UINT32_FIELD(this, kKindSpecificFlags1Offset, updated); | 4463 Heap::write_uint32_field(this, kKindSpecificFlags1Offset, updated); |
| 4573 } | 4464 } |
| 4574 | 4465 |
| 4575 | 4466 |
| 4576 bool Code::marked_for_deoptimization() { | 4467 bool Code::marked_for_deoptimization() { |
| 4577 ASSERT(kind() == OPTIMIZED_FUNCTION); | 4468 ASSERT(kind() == OPTIMIZED_FUNCTION); |
| 4578 return MarkedForDeoptimizationField::decode( | 4469 return MarkedForDeoptimizationField::decode( |
| 4579 READ_UINT32_FIELD(this, kKindSpecificFlags1Offset)); | 4470 Heap::read_uint32_field(this, kKindSpecificFlags1Offset)); |
| 4580 } | 4471 } |
| 4581 | 4472 |
| 4582 | 4473 |
| 4583 void Code::set_marked_for_deoptimization(bool flag) { | 4474 void Code::set_marked_for_deoptimization(bool flag) { |
| 4584 ASSERT(kind() == OPTIMIZED_FUNCTION); | 4475 ASSERT(kind() == OPTIMIZED_FUNCTION); |
| 4585 ASSERT(!flag || AllowDeoptimization::IsAllowed(GetIsolate())); | 4476 ASSERT(!flag || AllowDeoptimization::IsAllowed(GetIsolate())); |
| 4586 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags1Offset); | 4477 int previous = Heap::read_uint32_field(this, kKindSpecificFlags1Offset); |
| 4587 int updated = MarkedForDeoptimizationField::update(previous, flag); | 4478 int updated = MarkedForDeoptimizationField::update(previous, flag); |
| 4588 WRITE_UINT32_FIELD(this, kKindSpecificFlags1Offset, updated); | 4479 Heap::write_uint32_field(this, kKindSpecificFlags1Offset, updated); |
| 4589 } | 4480 } |
| 4590 | 4481 |
| 4591 | 4482 |
| 4592 bool Code::is_weak_stub() { | 4483 bool Code::is_weak_stub() { |
| 4593 return CanBeWeakStub() && WeakStubField::decode( | 4484 return CanBeWeakStub() && WeakStubField::decode( |
| 4594 READ_UINT32_FIELD(this, kKindSpecificFlags1Offset)); | 4485 Heap::read_uint32_field(this, kKindSpecificFlags1Offset)); |
| 4595 } | 4486 } |
| 4596 | 4487 |
| 4597 | 4488 |
| 4598 void Code::mark_as_weak_stub() { | 4489 void Code::mark_as_weak_stub() { |
| 4599 ASSERT(CanBeWeakStub()); | 4490 ASSERT(CanBeWeakStub()); |
| 4600 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags1Offset); | 4491 int previous = Heap::read_uint32_field(this, kKindSpecificFlags1Offset); |
| 4601 int updated = WeakStubField::update(previous, true); | 4492 int updated = WeakStubField::update(previous, true); |
| 4602 WRITE_UINT32_FIELD(this, kKindSpecificFlags1Offset, updated); | 4493 Heap::write_uint32_field(this, kKindSpecificFlags1Offset, updated); |
| 4603 } | 4494 } |
| 4604 | 4495 |
| 4605 | 4496 |
| 4606 bool Code::is_invalidated_weak_stub() { | 4497 bool Code::is_invalidated_weak_stub() { |
| 4607 return is_weak_stub() && InvalidatedWeakStubField::decode( | 4498 return is_weak_stub() && InvalidatedWeakStubField::decode( |
| 4608 READ_UINT32_FIELD(this, kKindSpecificFlags1Offset)); | 4499 Heap::read_uint32_field(this, kKindSpecificFlags1Offset)); |
| 4609 } | 4500 } |
| 4610 | 4501 |
| 4611 | 4502 |
| 4612 void Code::mark_as_invalidated_weak_stub() { | 4503 void Code::mark_as_invalidated_weak_stub() { |
| 4613 ASSERT(is_inline_cache_stub()); | 4504 ASSERT(is_inline_cache_stub()); |
| 4614 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags1Offset); | 4505 int previous = Heap::read_uint32_field(this, kKindSpecificFlags1Offset); |
| 4615 int updated = InvalidatedWeakStubField::update(previous, true); | 4506 int updated = InvalidatedWeakStubField::update(previous, true); |
| 4616 WRITE_UINT32_FIELD(this, kKindSpecificFlags1Offset, updated); | 4507 Heap::write_uint32_field(this, kKindSpecificFlags1Offset, updated); |
| 4617 } | 4508 } |
| 4618 | 4509 |
| 4619 | 4510 |
| 4620 bool Code::is_inline_cache_stub() { | 4511 bool Code::is_inline_cache_stub() { |
| 4621 Kind kind = this->kind(); | 4512 Kind kind = this->kind(); |
| 4622 switch (kind) { | 4513 switch (kind) { |
| 4623 #define CASE(name) case name: return true; | 4514 #define CASE(name) case name: return true; |
| 4624 IC_KIND_LIST(CASE) | 4515 IC_KIND_LIST(CASE) |
| 4625 #undef CASE | 4516 #undef CASE |
| 4626 default: return false; | 4517 default: return false; |
| 4627 } | 4518 } |
| 4628 } | 4519 } |
| 4629 | 4520 |
| 4630 | 4521 |
| 4631 bool Code::is_keyed_stub() { | 4522 bool Code::is_keyed_stub() { |
| 4632 return is_keyed_load_stub() || is_keyed_store_stub(); | 4523 return is_keyed_load_stub() || is_keyed_store_stub(); |
| 4633 } | 4524 } |
| 4634 | 4525 |
| 4635 | 4526 |
| 4636 bool Code::is_debug_stub() { | 4527 bool Code::is_debug_stub() { |
| 4637 return ic_state() == DEBUG_STUB; | 4528 return ic_state() == DEBUG_STUB; |
| 4638 } | 4529 } |
| 4639 | 4530 |
| 4640 | 4531 |
| 4641 ConstantPoolArray* Code::constant_pool() { | 4532 ConstantPoolArray* Code::constant_pool() { |
| 4642 return ConstantPoolArray::cast(READ_FIELD(this, kConstantPoolOffset)); | 4533 return ConstantPoolArray::cast(Heap::read_field(this, kConstantPoolOffset)); |
| 4643 } | 4534 } |
| 4644 | 4535 |
| 4645 | 4536 |
| 4646 void Code::set_constant_pool(Object* value) { | 4537 void Code::set_constant_pool(Object* value) { |
| 4647 ASSERT(value->IsConstantPoolArray()); | 4538 ASSERT(value->IsConstantPoolArray()); |
| 4648 WRITE_FIELD(this, kConstantPoolOffset, value); | 4539 Heap::write_field(this, kConstantPoolOffset, value, UPDATE_WRITE_BARRIER); |
| 4649 WRITE_BARRIER(GetHeap(), this, kConstantPoolOffset, value); | |
| 4650 } | 4540 } |
| 4651 | 4541 |
| 4652 | 4542 |
| 4653 Code::Flags Code::ComputeFlags(Kind kind, | 4543 Code::Flags Code::ComputeFlags(Kind kind, |
| 4654 InlineCacheState ic_state, | 4544 InlineCacheState ic_state, |
| 4655 ExtraICState extra_ic_state, | 4545 ExtraICState extra_ic_state, |
| 4656 StubType type, | 4546 StubType type, |
| 4657 InlineCacheHolderFlag holder) { | 4547 InlineCacheHolderFlag holder) { |
| 4658 // Compute the bit mask. | 4548 // Compute the bit mask. |
| 4659 unsigned int bits = KindField::encode(kind) | 4549 unsigned int bits = KindField::encode(kind) |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4761 | 4651 |
| 4762 | 4652 |
| 4763 bool Code::IsWeakObjectInIC(Object* object) { | 4653 bool Code::IsWeakObjectInIC(Object* object) { |
| 4764 return object->IsMap() && Map::cast(object)->CanTransition() && | 4654 return object->IsMap() && Map::cast(object)->CanTransition() && |
| 4765 FLAG_collect_maps && | 4655 FLAG_collect_maps && |
| 4766 FLAG_weak_embedded_maps_in_ic; | 4656 FLAG_weak_embedded_maps_in_ic; |
| 4767 } | 4657 } |
| 4768 | 4658 |
| 4769 | 4659 |
| 4770 Object* Map::prototype() { | 4660 Object* Map::prototype() { |
| 4771 return READ_FIELD(this, kPrototypeOffset); | 4661 return Heap::read_field(this, kPrototypeOffset); |
| 4772 } | 4662 } |
| 4773 | 4663 |
| 4774 | 4664 |
| 4775 void Map::set_prototype(Object* value, WriteBarrierMode mode) { | 4665 void Map::set_prototype(Object* value, WriteBarrierMode mode) { |
| 4776 ASSERT(value->IsNull() || value->IsJSReceiver()); | 4666 ASSERT(value->IsNull() || value->IsJSReceiver()); |
| 4777 WRITE_FIELD(this, kPrototypeOffset, value); | 4667 Heap::write_field(this, kPrototypeOffset, value, mode); |
| 4778 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kPrototypeOffset, value, mode); | |
| 4779 } | 4668 } |
| 4780 | 4669 |
| 4781 | 4670 |
| 4782 // If the descriptor is using the empty transition array, install a new empty | 4671 // If the descriptor is using the empty transition array, install a new empty |
| 4783 // transition array that will have place for an element transition. | 4672 // transition array that will have place for an element transition. |
| 4784 static void EnsureHasTransitionArray(Handle<Map> map) { | 4673 static void EnsureHasTransitionArray(Handle<Map> map) { |
| 4785 Handle<TransitionArray> transitions; | 4674 Handle<TransitionArray> transitions; |
| 4786 if (!map->HasTransitionArray()) { | 4675 if (!map->HasTransitionArray()) { |
| 4787 transitions = TransitionArray::Allocate(map->GetIsolate(), 0); | 4676 transitions = TransitionArray::Allocate(map->GetIsolate(), 0); |
| 4788 transitions->set_back_pointer_storage(map->GetBackPointer()); | 4677 transitions->set_back_pointer_storage(map->GetBackPointer()); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 4802 } | 4691 } |
| 4803 | 4692 |
| 4804 | 4693 |
| 4805 ACCESSORS(Map, instance_descriptors, DescriptorArray, kDescriptorsOffset) | 4694 ACCESSORS(Map, instance_descriptors, DescriptorArray, kDescriptorsOffset) |
| 4806 | 4695 |
| 4807 | 4696 |
| 4808 void Map::set_bit_field3(uint32_t bits) { | 4697 void Map::set_bit_field3(uint32_t bits) { |
| 4809 // Ensure the upper 2 bits have the same value by sign extending it. This is | 4698 // Ensure the upper 2 bits have the same value by sign extending it. This is |
| 4810 // necessary to be able to use the 31st bit. | 4699 // necessary to be able to use the 31st bit. |
| 4811 int value = bits << 1; | 4700 int value = bits << 1; |
| 4812 WRITE_FIELD(this, kBitField3Offset, Smi::FromInt(value >> 1)); | 4701 Heap::write_field(this, |
| 4702 kBitField3Offset, |
| 4703 Smi::FromInt(value >> 1), |
| 4704 SKIP_WRITE_BARRIER); |
| 4813 } | 4705 } |
| 4814 | 4706 |
| 4815 | 4707 |
| 4816 uint32_t Map::bit_field3() { | 4708 uint32_t Map::bit_field3() { |
| 4817 Object* value = READ_FIELD(this, kBitField3Offset); | 4709 Object* value = Heap::read_field(this, kBitField3Offset); |
| 4818 return Smi::cast(value)->value(); | 4710 return Smi::cast(value)->value(); |
| 4819 } | 4711 } |
| 4820 | 4712 |
| 4821 | 4713 |
| 4822 void Map::AppendDescriptor(Descriptor* desc) { | 4714 void Map::AppendDescriptor(Descriptor* desc) { |
| 4823 DescriptorArray* descriptors = instance_descriptors(); | 4715 DescriptorArray* descriptors = instance_descriptors(); |
| 4824 int number_of_own_descriptors = NumberOfOwnDescriptors(); | 4716 int number_of_own_descriptors = NumberOfOwnDescriptors(); |
| 4825 ASSERT(descriptors->number_of_descriptors() == number_of_own_descriptors); | 4717 ASSERT(descriptors->number_of_descriptors() == number_of_own_descriptors); |
| 4826 descriptors->Append(desc); | 4718 descriptors->Append(desc); |
| 4827 SetNumberOfOwnDescriptors(number_of_own_descriptors + 1); | 4719 SetNumberOfOwnDescriptors(number_of_own_descriptors + 1); |
| 4828 } | 4720 } |
| 4829 | 4721 |
| 4830 | 4722 |
| 4831 Object* Map::GetBackPointer() { | 4723 Object* Map::GetBackPointer() { |
| 4832 Object* object = READ_FIELD(this, kTransitionsOrBackPointerOffset); | 4724 Object* object = Heap::read_field(this, kTransitionsOrBackPointerOffset); |
| 4833 if (object->IsDescriptorArray()) { | 4725 if (object->IsDescriptorArray()) { |
| 4834 return TransitionArray::cast(object)->back_pointer_storage(); | 4726 return TransitionArray::cast(object)->back_pointer_storage(); |
| 4835 } else { | 4727 } else { |
| 4836 ASSERT(object->IsMap() || object->IsUndefined()); | 4728 ASSERT(object->IsMap() || object->IsUndefined()); |
| 4837 return object; | 4729 return object; |
| 4838 } | 4730 } |
| 4839 } | 4731 } |
| 4840 | 4732 |
| 4841 | 4733 |
| 4842 bool Map::HasElementsTransition() { | 4734 bool Map::HasElementsTransition() { |
| 4843 return HasTransitionArray() && transitions()->HasElementsTransition(); | 4735 return HasTransitionArray() && transitions()->HasElementsTransition(); |
| 4844 } | 4736 } |
| 4845 | 4737 |
| 4846 | 4738 |
| 4847 bool Map::HasTransitionArray() { | 4739 bool Map::HasTransitionArray() { |
| 4848 Object* object = READ_FIELD(this, kTransitionsOrBackPointerOffset); | 4740 Object* object = Heap::read_field(this, kTransitionsOrBackPointerOffset); |
| 4849 return object->IsTransitionArray(); | 4741 return object->IsTransitionArray(); |
| 4850 } | 4742 } |
| 4851 | 4743 |
| 4852 | 4744 |
| 4853 Map* Map::elements_transition_map() { | 4745 Map* Map::elements_transition_map() { |
| 4854 int index = transitions()->Search(GetHeap()->elements_transition_symbol()); | 4746 int index = transitions()->Search(GetHeap()->elements_transition_symbol()); |
| 4855 return transitions()->GetTarget(index); | 4747 return transitions()->GetTarget(index); |
| 4856 } | 4748 } |
| 4857 | 4749 |
| 4858 | 4750 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4899 } | 4791 } |
| 4900 | 4792 |
| 4901 | 4793 |
| 4902 bool Map::HasPrototypeTransitions() { | 4794 bool Map::HasPrototypeTransitions() { |
| 4903 return HasTransitionArray() && transitions()->HasPrototypeTransitions(); | 4795 return HasTransitionArray() && transitions()->HasPrototypeTransitions(); |
| 4904 } | 4796 } |
| 4905 | 4797 |
| 4906 | 4798 |
| 4907 TransitionArray* Map::transitions() { | 4799 TransitionArray* Map::transitions() { |
| 4908 ASSERT(HasTransitionArray()); | 4800 ASSERT(HasTransitionArray()); |
| 4909 Object* object = READ_FIELD(this, kTransitionsOrBackPointerOffset); | 4801 Object* object = Heap::read_field(this, kTransitionsOrBackPointerOffset); |
| 4910 return TransitionArray::cast(object); | 4802 return TransitionArray::cast(object); |
| 4911 } | 4803 } |
| 4912 | 4804 |
| 4913 | 4805 |
| 4914 void Map::set_transitions(TransitionArray* transition_array, | 4806 void Map::set_transitions(TransitionArray* transition_array, |
| 4915 WriteBarrierMode mode) { | 4807 WriteBarrierMode mode) { |
| 4916 // Transition arrays are not shared. When one is replaced, it should not | 4808 // Transition arrays are not shared. When one is replaced, it should not |
| 4917 // keep referenced objects alive, so we zap it. | 4809 // keep referenced objects alive, so we zap it. |
| 4918 // When there is another reference to the array somewhere (e.g. a handle), | 4810 // When there is another reference to the array somewhere (e.g. a handle), |
| 4919 // not zapping turns from a waste of memory into a source of crashes. | 4811 // not zapping turns from a waste of memory into a source of crashes. |
| 4920 if (HasTransitionArray()) { | 4812 if (HasTransitionArray()) { |
| 4921 #ifdef DEBUG | 4813 #ifdef DEBUG |
| 4922 for (int i = 0; i < transitions()->number_of_transitions(); i++) { | 4814 for (int i = 0; i < transitions()->number_of_transitions(); i++) { |
| 4923 Map* target = transitions()->GetTarget(i); | 4815 Map* target = transitions()->GetTarget(i); |
| 4924 if (target->instance_descriptors() == instance_descriptors()) { | 4816 if (target->instance_descriptors() == instance_descriptors()) { |
| 4925 Name* key = transitions()->GetKey(i); | 4817 Name* key = transitions()->GetKey(i); |
| 4926 int new_target_index = transition_array->Search(key); | 4818 int new_target_index = transition_array->Search(key); |
| 4927 ASSERT(new_target_index != TransitionArray::kNotFound); | 4819 ASSERT(new_target_index != TransitionArray::kNotFound); |
| 4928 ASSERT(transition_array->GetTarget(new_target_index) == target); | 4820 ASSERT(transition_array->GetTarget(new_target_index) == target); |
| 4929 } | 4821 } |
| 4930 } | 4822 } |
| 4931 #endif | 4823 #endif |
| 4932 ASSERT(transitions() != transition_array); | 4824 ASSERT(transitions() != transition_array); |
| 4933 ZapTransitions(); | 4825 ZapTransitions(); |
| 4934 } | 4826 } |
| 4935 | 4827 |
| 4936 WRITE_FIELD(this, kTransitionsOrBackPointerOffset, transition_array); | 4828 Heap::write_field(this, |
| 4937 CONDITIONAL_WRITE_BARRIER( | 4829 kTransitionsOrBackPointerOffset, |
| 4938 GetHeap(), this, kTransitionsOrBackPointerOffset, transition_array, mode); | 4830 transition_array, |
| 4831 mode); |
| 4939 } | 4832 } |
| 4940 | 4833 |
| 4941 | 4834 |
| 4942 void Map::init_back_pointer(Object* undefined) { | 4835 void Map::init_back_pointer(Object* undefined) { |
| 4943 ASSERT(undefined->IsUndefined()); | 4836 ASSERT(undefined->IsUndefined()); |
| 4944 WRITE_FIELD(this, kTransitionsOrBackPointerOffset, undefined); | 4837 Heap::write_field(this, |
| 4838 kTransitionsOrBackPointerOffset, |
| 4839 undefined, |
| 4840 SKIP_WRITE_BARRIER); |
| 4945 } | 4841 } |
| 4946 | 4842 |
| 4947 | 4843 |
| 4948 void Map::SetBackPointer(Object* value, WriteBarrierMode mode) { | 4844 void Map::SetBackPointer(Object* value, WriteBarrierMode mode) { |
| 4949 ASSERT(instance_type() >= FIRST_JS_RECEIVER_TYPE); | 4845 ASSERT(instance_type() >= FIRST_JS_RECEIVER_TYPE); |
| 4950 ASSERT((value->IsUndefined() && GetBackPointer()->IsMap()) || | 4846 ASSERT((value->IsUndefined() && GetBackPointer()->IsMap()) || |
| 4951 (value->IsMap() && GetBackPointer()->IsUndefined())); | 4847 (value->IsMap() && GetBackPointer()->IsUndefined())); |
| 4952 Object* object = READ_FIELD(this, kTransitionsOrBackPointerOffset); | 4848 Object* object = Heap::read_field(this, kTransitionsOrBackPointerOffset); |
| 4953 if (object->IsTransitionArray()) { | 4849 if (object->IsTransitionArray()) { |
| 4954 TransitionArray::cast(object)->set_back_pointer_storage(value); | 4850 TransitionArray::cast(object)->set_back_pointer_storage(value); |
| 4955 } else { | 4851 } else { |
| 4956 WRITE_FIELD(this, kTransitionsOrBackPointerOffset, value); | 4852 Heap::write_field(this, kTransitionsOrBackPointerOffset, value, mode); |
| 4957 CONDITIONAL_WRITE_BARRIER( | |
| 4958 GetHeap(), this, kTransitionsOrBackPointerOffset, value, mode); | |
| 4959 } | 4853 } |
| 4960 } | 4854 } |
| 4961 | 4855 |
| 4962 | 4856 |
| 4963 ACCESSORS(Map, code_cache, Object, kCodeCacheOffset) | 4857 ACCESSORS(Map, code_cache, Object, kCodeCacheOffset) |
| 4964 ACCESSORS(Map, dependent_code, DependentCode, kDependentCodeOffset) | 4858 ACCESSORS(Map, dependent_code, DependentCode, kDependentCodeOffset) |
| 4965 ACCESSORS(Map, constructor, Object, kConstructorOffset) | 4859 ACCESSORS(Map, constructor, Object, kConstructorOffset) |
| 4966 | 4860 |
| 4967 ACCESSORS(JSFunction, shared, SharedFunctionInfo, kSharedFunctionInfoOffset) | 4861 ACCESSORS(JSFunction, shared, SharedFunctionInfo, kSharedFunctionInfoOffset) |
| 4968 ACCESSORS(JSFunction, literals_or_bindings, FixedArray, kLiteralsOffset) | 4862 ACCESSORS(JSFunction, literals_or_bindings, FixedArray, kLiteralsOffset) |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5161 kOptCountAndBailoutReasonOffset) | 5055 kOptCountAndBailoutReasonOffset) |
| 5162 SMI_ACCESSORS(SharedFunctionInfo, counters, kCountersOffset) | 5056 SMI_ACCESSORS(SharedFunctionInfo, counters, kCountersOffset) |
| 5163 SMI_ACCESSORS(SharedFunctionInfo, ast_node_count, kAstNodeCountOffset) | 5057 SMI_ACCESSORS(SharedFunctionInfo, ast_node_count, kAstNodeCountOffset) |
| 5164 SMI_ACCESSORS(SharedFunctionInfo, profiler_ticks, kProfilerTicksOffset) | 5058 SMI_ACCESSORS(SharedFunctionInfo, profiler_ticks, kProfilerTicksOffset) |
| 5165 | 5059 |
| 5166 #else | 5060 #else |
| 5167 | 5061 |
| 5168 #define PSEUDO_SMI_ACCESSORS_LO(holder, name, offset) \ | 5062 #define PSEUDO_SMI_ACCESSORS_LO(holder, name, offset) \ |
| 5169 STATIC_ASSERT(holder::offset % kPointerSize == 0); \ | 5063 STATIC_ASSERT(holder::offset % kPointerSize == 0); \ |
| 5170 int holder::name() { \ | 5064 int holder::name() { \ |
| 5171 int value = READ_INT_FIELD(this, offset); \ | 5065 int value = Heap::read_int_field(this, offset); \ |
| 5172 ASSERT(kHeapObjectTag == 1); \ | 5066 ASSERT(kHeapObjectTag == 1); \ |
| 5173 ASSERT((value & kHeapObjectTag) == 0); \ | 5067 ASSERT((value & kHeapObjectTag) == 0); \ |
| 5174 return value >> 1; \ | 5068 return value >> 1; \ |
| 5175 } \ | 5069 } \ |
| 5176 void holder::set_##name(int value) { \ | 5070 void holder::set_##name(int value) { \ |
| 5177 ASSERT(kHeapObjectTag == 1); \ | 5071 ASSERT(kHeapObjectTag == 1); \ |
| 5178 ASSERT((value & 0xC0000000) == 0xC0000000 || \ | 5072 ASSERT((value & 0xC0000000) == 0xC0000000 || \ |
| 5179 (value & 0xC0000000) == 0x000000000); \ | 5073 (value & 0xC0000000) == 0x000000000); \ |
| 5180 WRITE_INT_FIELD(this, \ | 5074 Heap::write_int_field(this, \ |
| 5181 offset, \ | 5075 offset, \ |
| 5182 (value << 1) & ~kHeapObjectTag); \ | 5076 (value << 1) & ~kHeapObjectTag); \ |
| 5183 } | 5077 } |
| 5184 | 5078 |
| 5185 #define PSEUDO_SMI_ACCESSORS_HI(holder, name, offset) \ | 5079 #define PSEUDO_SMI_ACCESSORS_HI(holder, name, offset) \ |
| 5186 STATIC_ASSERT(holder::offset % kPointerSize == kIntSize); \ | 5080 STATIC_ASSERT(holder::offset % kPointerSize == kIntSize); \ |
| 5187 INT_ACCESSORS(holder, name, offset) | 5081 INT_ACCESSORS(holder, name, offset) |
| 5188 | 5082 |
| 5189 | 5083 |
| 5190 PSEUDO_SMI_ACCESSORS_LO(SharedFunctionInfo, length, kLengthOffset) | 5084 PSEUDO_SMI_ACCESSORS_LO(SharedFunctionInfo, length, kLengthOffset) |
| (...skipping 27 matching lines...) Expand all Loading... |
| 5218 ast_node_count, | 5112 ast_node_count, |
| 5219 kAstNodeCountOffset) | 5113 kAstNodeCountOffset) |
| 5220 PSEUDO_SMI_ACCESSORS_HI(SharedFunctionInfo, | 5114 PSEUDO_SMI_ACCESSORS_HI(SharedFunctionInfo, |
| 5221 profiler_ticks, | 5115 profiler_ticks, |
| 5222 kProfilerTicksOffset) | 5116 kProfilerTicksOffset) |
| 5223 | 5117 |
| 5224 #endif | 5118 #endif |
| 5225 | 5119 |
| 5226 | 5120 |
| 5227 int SharedFunctionInfo::construction_count() { | 5121 int SharedFunctionInfo::construction_count() { |
| 5228 return READ_BYTE_FIELD(this, kConstructionCountOffset); | 5122 return Heap::read_byte_field(this, kConstructionCountOffset); |
| 5229 } | 5123 } |
| 5230 | 5124 |
| 5231 | 5125 |
| 5232 void SharedFunctionInfo::set_construction_count(int value) { | 5126 void SharedFunctionInfo::set_construction_count(int value) { |
| 5233 ASSERT(0 <= value && value < 256); | 5127 ASSERT(0 <= value && value < 256); |
| 5234 WRITE_BYTE_FIELD(this, kConstructionCountOffset, static_cast<byte>(value)); | 5128 Heap::write_byte_field( |
| 5129 this, |
| 5130 kConstructionCountOffset, |
| 5131 static_cast<byte>(value)); |
| 5235 } | 5132 } |
| 5236 | 5133 |
| 5237 | 5134 |
| 5238 BOOL_ACCESSORS(SharedFunctionInfo, | 5135 BOOL_ACCESSORS(SharedFunctionInfo, |
| 5239 compiler_hints, | 5136 compiler_hints, |
| 5240 live_objects_may_exist, | 5137 live_objects_may_exist, |
| 5241 kLiveObjectsMayExist) | 5138 kLiveObjectsMayExist) |
| 5242 | 5139 |
| 5243 | 5140 |
| 5244 bool SharedFunctionInfo::IsInobjectSlackTrackingInProgress() { | 5141 bool SharedFunctionInfo::IsInobjectSlackTrackingInProgress() { |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5330 } | 5227 } |
| 5331 | 5228 |
| 5332 | 5229 |
| 5333 void SharedFunctionInfo::set_start_position(int start_position) { | 5230 void SharedFunctionInfo::set_start_position(int start_position) { |
| 5334 set_start_position_and_type((start_position << kStartPositionShift) | 5231 set_start_position_and_type((start_position << kStartPositionShift) |
| 5335 | (start_position_and_type() & ~kStartPositionMask)); | 5232 | (start_position_and_type() & ~kStartPositionMask)); |
| 5336 } | 5233 } |
| 5337 | 5234 |
| 5338 | 5235 |
| 5339 Code* SharedFunctionInfo::code() { | 5236 Code* SharedFunctionInfo::code() { |
| 5340 return Code::cast(READ_FIELD(this, kCodeOffset)); | 5237 return Code::cast(Heap::read_field(this, kCodeOffset)); |
| 5341 } | 5238 } |
| 5342 | 5239 |
| 5343 | 5240 |
| 5344 void SharedFunctionInfo::set_code(Code* value, WriteBarrierMode mode) { | 5241 void SharedFunctionInfo::set_code(Code* value, WriteBarrierMode mode) { |
| 5345 ASSERT(value->kind() != Code::OPTIMIZED_FUNCTION); | 5242 ASSERT(value->kind() != Code::OPTIMIZED_FUNCTION); |
| 5346 WRITE_FIELD(this, kCodeOffset, value); | 5243 Heap::write_field(this, kCodeOffset, value, mode); |
| 5347 CONDITIONAL_WRITE_BARRIER(value->GetHeap(), this, kCodeOffset, value, mode); | |
| 5348 } | 5244 } |
| 5349 | 5245 |
| 5350 | 5246 |
| 5351 void SharedFunctionInfo::ReplaceCode(Code* value) { | 5247 void SharedFunctionInfo::ReplaceCode(Code* value) { |
| 5352 // If the GC metadata field is already used then the function was | 5248 // If the GC metadata field is already used then the function was |
| 5353 // enqueued as a code flushing candidate and we remove it now. | 5249 // enqueued as a code flushing candidate and we remove it now. |
| 5354 if (code()->gc_metadata() != NULL) { | 5250 if (code()->gc_metadata() != NULL) { |
| 5355 CodeFlusher* flusher = GetHeap()->mark_compact_collector()->code_flusher(); | 5251 CodeFlusher* flusher = GetHeap()->mark_compact_collector()->code_flusher(); |
| 5356 flusher->EvictCandidate(this); | 5252 flusher->EvictCandidate(this); |
| 5357 } | 5253 } |
| 5358 | 5254 |
| 5359 ASSERT(code()->gc_metadata() == NULL && value->gc_metadata() == NULL); | 5255 ASSERT(code()->gc_metadata() == NULL && value->gc_metadata() == NULL); |
| 5360 set_code(value); | 5256 set_code(value); |
| 5361 } | 5257 } |
| 5362 | 5258 |
| 5363 | 5259 |
| 5364 ScopeInfo* SharedFunctionInfo::scope_info() { | 5260 ScopeInfo* SharedFunctionInfo::scope_info() { |
| 5365 return reinterpret_cast<ScopeInfo*>(READ_FIELD(this, kScopeInfoOffset)); | 5261 return reinterpret_cast<ScopeInfo*>(Heap::read_field(this, kScopeInfoOffset)); |
| 5366 } | 5262 } |
| 5367 | 5263 |
| 5368 | 5264 |
| 5369 void SharedFunctionInfo::set_scope_info(ScopeInfo* value, | 5265 void SharedFunctionInfo::set_scope_info(ScopeInfo* value, |
| 5370 WriteBarrierMode mode) { | 5266 WriteBarrierMode mode) { |
| 5371 WRITE_FIELD(this, kScopeInfoOffset, reinterpret_cast<Object*>(value)); | 5267 Heap::write_field(this, |
| 5372 CONDITIONAL_WRITE_BARRIER(GetHeap(), | 5268 kScopeInfoOffset, |
| 5373 this, | 5269 reinterpret_cast<Object*>(value), |
| 5374 kScopeInfoOffset, | 5270 mode); |
| 5375 reinterpret_cast<Object*>(value), | |
| 5376 mode); | |
| 5377 } | 5271 } |
| 5378 | 5272 |
| 5379 | 5273 |
| 5380 bool SharedFunctionInfo::is_compiled() { | 5274 bool SharedFunctionInfo::is_compiled() { |
| 5381 return code() != | 5275 return code() != |
| 5382 GetIsolate()->builtins()->builtin(Builtins::kCompileUnoptimized); | 5276 GetIsolate()->builtins()->builtin(Builtins::kCompileUnoptimized); |
| 5383 } | 5277 } |
| 5384 | 5278 |
| 5385 | 5279 |
| 5386 bool SharedFunctionInfo::IsApiFunction() { | 5280 bool SharedFunctionInfo::IsApiFunction() { |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5514 } | 5408 } |
| 5515 | 5409 |
| 5516 | 5410 |
| 5517 bool JSFunction::IsInOptimizationQueue() { | 5411 bool JSFunction::IsInOptimizationQueue() { |
| 5518 return code() == GetIsolate()->builtins()->builtin( | 5412 return code() == GetIsolate()->builtins()->builtin( |
| 5519 Builtins::kInOptimizationQueue); | 5413 Builtins::kInOptimizationQueue); |
| 5520 } | 5414 } |
| 5521 | 5415 |
| 5522 | 5416 |
| 5523 Code* JSFunction::code() { | 5417 Code* JSFunction::code() { |
| 5524 return Code::cast( | 5418 return Code::cast(Code::GetObjectFromEntryAddress( |
| 5525 Code::GetObjectFromEntryAddress(FIELD_ADDR(this, kCodeEntryOffset))); | 5419 Heap::get_field_address(this, kCodeEntryOffset))); |
| 5526 } | 5420 } |
| 5527 | 5421 |
| 5528 | 5422 |
| 5529 void JSFunction::set_code(Code* value) { | 5423 void JSFunction::set_code(Code* value) { |
| 5530 ASSERT(!GetHeap()->InNewSpace(value)); | 5424 ASSERT(!GetHeap()->InNewSpace(value)); |
| 5531 Address entry = value->entry(); | 5425 Address entry = value->entry(); |
| 5532 WRITE_INTPTR_FIELD(this, kCodeEntryOffset, reinterpret_cast<intptr_t>(entry)); | 5426 Heap::write_intptr_field( |
| 5427 this, |
| 5428 kCodeEntryOffset, |
| 5429 reinterpret_cast<intptr_t>(entry)); |
| 5533 GetHeap()->incremental_marking()->RecordWriteOfCodeEntry( | 5430 GetHeap()->incremental_marking()->RecordWriteOfCodeEntry( |
| 5534 this, | 5431 this, |
| 5535 HeapObject::RawField(this, kCodeEntryOffset), | 5432 HeapObject::RawField(this, kCodeEntryOffset), |
| 5536 value); | 5433 value); |
| 5537 } | 5434 } |
| 5538 | 5435 |
| 5539 | 5436 |
| 5540 void JSFunction::set_code_no_write_barrier(Code* value) { | 5437 void JSFunction::set_code_no_write_barrier(Code* value) { |
| 5541 ASSERT(!GetHeap()->InNewSpace(value)); | 5438 ASSERT(!GetHeap()->InNewSpace(value)); |
| 5542 Address entry = value->entry(); | 5439 Address entry = value->entry(); |
| 5543 WRITE_INTPTR_FIELD(this, kCodeEntryOffset, reinterpret_cast<intptr_t>(entry)); | 5440 Heap::write_intptr_field( |
| 5441 this, |
| 5442 kCodeEntryOffset, |
| 5443 reinterpret_cast<intptr_t>(entry)); |
| 5544 } | 5444 } |
| 5545 | 5445 |
| 5546 | 5446 |
| 5547 void JSFunction::ReplaceCode(Code* code) { | 5447 void JSFunction::ReplaceCode(Code* code) { |
| 5548 bool was_optimized = IsOptimized(); | 5448 bool was_optimized = IsOptimized(); |
| 5549 bool is_optimized = code->kind() == Code::OPTIMIZED_FUNCTION; | 5449 bool is_optimized = code->kind() == Code::OPTIMIZED_FUNCTION; |
| 5550 | 5450 |
| 5551 if (was_optimized && is_optimized) { | 5451 if (was_optimized && is_optimized) { |
| 5552 shared()->EvictFromOptimizedCodeMap(this->code(), | 5452 shared()->EvictFromOptimizedCodeMap(this->code(), |
| 5553 "Replacing with another optimized code"); | 5453 "Replacing with another optimized code"); |
| 5554 } | 5454 } |
| 5555 | 5455 |
| 5556 set_code(code); | 5456 set_code(code); |
| 5557 | 5457 |
| 5558 // Add/remove the function from the list of optimized functions for this | 5458 // Add/remove the function from the list of optimized functions for this |
| 5559 // context based on the state change. | 5459 // context based on the state change. |
| 5560 if (!was_optimized && is_optimized) { | 5460 if (!was_optimized && is_optimized) { |
| 5561 context()->native_context()->AddOptimizedFunction(this); | 5461 context()->native_context()->AddOptimizedFunction(this); |
| 5562 } | 5462 } |
| 5563 if (was_optimized && !is_optimized) { | 5463 if (was_optimized && !is_optimized) { |
| 5564 // TODO(titzer): linear in the number of optimized functions; fix! | 5464 // TODO(titzer): linear in the number of optimized functions; fix! |
| 5565 context()->native_context()->RemoveOptimizedFunction(this); | 5465 context()->native_context()->RemoveOptimizedFunction(this); |
| 5566 } | 5466 } |
| 5567 } | 5467 } |
| 5568 | 5468 |
| 5569 | 5469 |
| 5570 Context* JSFunction::context() { | 5470 Context* JSFunction::context() { |
| 5571 return Context::cast(READ_FIELD(this, kContextOffset)); | 5471 return Context::cast(Heap::read_field(this, kContextOffset)); |
| 5572 } | 5472 } |
| 5573 | 5473 |
| 5574 | 5474 |
| 5575 void JSFunction::set_context(Object* value) { | 5475 void JSFunction::set_context(Object* value) { |
| 5576 ASSERT(value->IsUndefined() || value->IsContext()); | 5476 ASSERT(value->IsUndefined() || value->IsContext()); |
| 5577 WRITE_FIELD(this, kContextOffset, value); | 5477 Heap::write_field(this, kContextOffset, value, UPDATE_WRITE_BARRIER); |
| 5578 WRITE_BARRIER(GetHeap(), this, kContextOffset, value); | |
| 5579 } | 5478 } |
| 5580 | 5479 |
| 5581 ACCESSORS(JSFunction, prototype_or_initial_map, Object, | 5480 ACCESSORS(JSFunction, prototype_or_initial_map, Object, |
| 5582 kPrototypeOrInitialMapOffset) | 5481 kPrototypeOrInitialMapOffset) |
| 5583 | 5482 |
| 5584 | 5483 |
| 5585 Map* JSFunction::initial_map() { | 5484 Map* JSFunction::initial_map() { |
| 5586 return Map::cast(prototype_or_initial_map()); | 5485 return Map::cast(prototype_or_initial_map()); |
| 5587 } | 5486 } |
| 5588 | 5487 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5665 | 5564 |
| 5666 | 5565 |
| 5667 int JSFunction::NumberOfLiterals() { | 5566 int JSFunction::NumberOfLiterals() { |
| 5668 ASSERT(!shared()->bound()); | 5567 ASSERT(!shared()->bound()); |
| 5669 return literals()->length(); | 5568 return literals()->length(); |
| 5670 } | 5569 } |
| 5671 | 5570 |
| 5672 | 5571 |
| 5673 Object* JSBuiltinsObject::javascript_builtin(Builtins::JavaScript id) { | 5572 Object* JSBuiltinsObject::javascript_builtin(Builtins::JavaScript id) { |
| 5674 ASSERT(id < kJSBuiltinsCount); // id is unsigned. | 5573 ASSERT(id < kJSBuiltinsCount); // id is unsigned. |
| 5675 return READ_FIELD(this, OffsetOfFunctionWithId(id)); | 5574 return Heap::read_field(this, OffsetOfFunctionWithId(id)); |
| 5676 } | 5575 } |
| 5677 | 5576 |
| 5678 | 5577 |
| 5679 void JSBuiltinsObject::set_javascript_builtin(Builtins::JavaScript id, | 5578 void JSBuiltinsObject::set_javascript_builtin(Builtins::JavaScript id, |
| 5680 Object* value) { | 5579 Object* value) { |
| 5681 ASSERT(id < kJSBuiltinsCount); // id is unsigned. | 5580 ASSERT(id < kJSBuiltinsCount); // id is unsigned. |
| 5682 WRITE_FIELD(this, OffsetOfFunctionWithId(id), value); | 5581 Heap::write_field(this, |
| 5683 WRITE_BARRIER(GetHeap(), this, OffsetOfFunctionWithId(id), value); | 5582 OffsetOfFunctionWithId(id), |
| 5583 value, |
| 5584 UPDATE_WRITE_BARRIER); |
| 5684 } | 5585 } |
| 5685 | 5586 |
| 5686 | 5587 |
| 5687 Code* JSBuiltinsObject::javascript_builtin_code(Builtins::JavaScript id) { | 5588 Code* JSBuiltinsObject::javascript_builtin_code(Builtins::JavaScript id) { |
| 5688 ASSERT(id < kJSBuiltinsCount); // id is unsigned. | 5589 ASSERT(id < kJSBuiltinsCount); // id is unsigned. |
| 5689 return Code::cast(READ_FIELD(this, OffsetOfCodeWithId(id))); | 5590 return Code::cast(Heap::read_field(this, OffsetOfCodeWithId(id))); |
| 5690 } | 5591 } |
| 5691 | 5592 |
| 5692 | 5593 |
| 5693 void JSBuiltinsObject::set_javascript_builtin_code(Builtins::JavaScript id, | 5594 void JSBuiltinsObject::set_javascript_builtin_code(Builtins::JavaScript id, |
| 5694 Code* value) { | 5595 Code* value) { |
| 5695 ASSERT(id < kJSBuiltinsCount); // id is unsigned. | 5596 ASSERT(id < kJSBuiltinsCount); // id is unsigned. |
| 5696 WRITE_FIELD(this, OffsetOfCodeWithId(id), value); | 5597 Heap::write_field(this, OffsetOfCodeWithId(id), value, UPDATE_WRITE_BARRIER); |
| 5697 ASSERT(!GetHeap()->InNewSpace(value)); | 5598 ASSERT(!GetHeap()->InNewSpace(value)); |
| 5698 } | 5599 } |
| 5699 | 5600 |
| 5700 | 5601 |
| 5701 ACCESSORS(JSProxy, handler, Object, kHandlerOffset) | 5602 ACCESSORS(JSProxy, handler, Object, kHandlerOffset) |
| 5702 ACCESSORS(JSProxy, hash, Object, kHashOffset) | 5603 ACCESSORS(JSProxy, hash, Object, kHashOffset) |
| 5703 ACCESSORS(JSFunctionProxy, call_trap, Object, kCallTrapOffset) | 5604 ACCESSORS(JSFunctionProxy, call_trap, Object, kCallTrapOffset) |
| 5704 ACCESSORS(JSFunctionProxy, construct_trap, Object, kConstructTrapOffset) | 5605 ACCESSORS(JSFunctionProxy, construct_trap, Object, kConstructTrapOffset) |
| 5705 | 5606 |
| 5706 | 5607 |
| 5707 void JSProxy::InitializeBody(int object_size, Object* value) { | 5608 void JSProxy::InitializeBody(int object_size, Object* value) { |
| 5708 ASSERT(!value->IsHeapObject() || !GetHeap()->InNewSpace(value)); | 5609 ASSERT(!value->IsHeapObject() || !GetHeap()->InNewSpace(value)); |
| 5709 for (int offset = kHeaderSize; offset < object_size; offset += kPointerSize) { | 5610 for (int offset = kHeaderSize; offset < object_size; offset += kPointerSize) { |
| 5710 WRITE_FIELD(this, offset, value); | 5611 Heap::write_field(this, offset, value, SKIP_WRITE_BARRIER); |
| 5711 } | 5612 } |
| 5712 } | 5613 } |
| 5713 | 5614 |
| 5714 | 5615 |
| 5715 ACCESSORS(JSSet, table, Object, kTableOffset) | 5616 ACCESSORS(JSSet, table, Object, kTableOffset) |
| 5716 ACCESSORS(JSMap, table, Object, kTableOffset) | 5617 ACCESSORS(JSMap, table, Object, kTableOffset) |
| 5717 | 5618 |
| 5718 | 5619 |
| 5719 #define ORDERED_HASH_TABLE_ITERATOR_ACCESSORS(name, type, offset) \ | 5620 #define ORDERED_HASH_TABLE_ITERATOR_ACCESSORS(name, type, offset) \ |
| 5720 template<class Derived, class TableType> \ | 5621 template<class Derived, class TableType> \ |
| 5721 type* OrderedHashTableIterator<Derived, TableType>::name() { \ | 5622 type* OrderedHashTableIterator<Derived, TableType>::name() { \ |
| 5722 return type::cast(READ_FIELD(this, offset)); \ | 5623 return type::cast(Heap::read_field(this, offset)); \ |
| 5723 } \ | 5624 } \ |
| 5724 template<class Derived, class TableType> \ | 5625 template<class Derived, class TableType> \ |
| 5725 void OrderedHashTableIterator<Derived, TableType>::set_##name( \ | 5626 void OrderedHashTableIterator<Derived, TableType>::set_##name( \ |
| 5726 type* value, WriteBarrierMode mode) { \ | 5627 type* value, WriteBarrierMode mode) { \ |
| 5727 WRITE_FIELD(this, offset, value); \ | 5628 Heap::write_field(this, offset, value, mode); \ |
| 5728 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, offset, value, mode); \ | |
| 5729 } | 5629 } |
| 5730 | 5630 |
| 5731 ORDERED_HASH_TABLE_ITERATOR_ACCESSORS(table, Object, kTableOffset) | 5631 ORDERED_HASH_TABLE_ITERATOR_ACCESSORS(table, Object, kTableOffset) |
| 5732 ORDERED_HASH_TABLE_ITERATOR_ACCESSORS(index, Smi, kIndexOffset) | 5632 ORDERED_HASH_TABLE_ITERATOR_ACCESSORS(index, Smi, kIndexOffset) |
| 5733 ORDERED_HASH_TABLE_ITERATOR_ACCESSORS(count, Smi, kCountOffset) | 5633 ORDERED_HASH_TABLE_ITERATOR_ACCESSORS(count, Smi, kCountOffset) |
| 5734 ORDERED_HASH_TABLE_ITERATOR_ACCESSORS(kind, Smi, kKindOffset) | 5634 ORDERED_HASH_TABLE_ITERATOR_ACCESSORS(kind, Smi, kKindOffset) |
| 5735 ORDERED_HASH_TABLE_ITERATOR_ACCESSORS(next_iterator, Object, | 5635 ORDERED_HASH_TABLE_ITERATOR_ACCESSORS(next_iterator, Object, |
| 5736 kNextIteratorOffset) | 5636 kNextIteratorOffset) |
| 5737 ORDERED_HASH_TABLE_ITERATOR_ACCESSORS(previous_iterator, Object, | 5637 ORDERED_HASH_TABLE_ITERATOR_ACCESSORS(previous_iterator, Object, |
| 5738 kPreviousIteratorOffset) | 5638 kPreviousIteratorOffset) |
| 5739 | 5639 |
| 5740 #undef ORDERED_HASH_TABLE_ITERATOR_ACCESSORS | 5640 #undef ORDERED_HASH_TABLE_ITERATOR_ACCESSORS |
| 5741 | 5641 |
| 5742 | 5642 |
| 5743 ACCESSORS(JSWeakCollection, table, Object, kTableOffset) | 5643 ACCESSORS(JSWeakCollection, table, Object, kTableOffset) |
| 5744 ACCESSORS(JSWeakCollection, next, Object, kNextOffset) | 5644 ACCESSORS(JSWeakCollection, next, Object, kNextOffset) |
| 5745 | 5645 |
| 5746 | 5646 |
| 5747 Address Foreign::foreign_address() { | 5647 Address Foreign::foreign_address() { |
| 5748 return AddressFrom<Address>(READ_INTPTR_FIELD(this, kForeignAddressOffset)); | 5648 return AddressFrom<Address>( |
| 5649 Heap::read_intptr_field(this, kForeignAddressOffset)); |
| 5749 } | 5650 } |
| 5750 | 5651 |
| 5751 | 5652 |
| 5752 void Foreign::set_foreign_address(Address value) { | 5653 void Foreign::set_foreign_address(Address value) { |
| 5753 WRITE_INTPTR_FIELD(this, kForeignAddressOffset, OffsetFrom(value)); | 5654 Heap::write_intptr_field(this, kForeignAddressOffset, OffsetFrom(value)); |
| 5754 } | 5655 } |
| 5755 | 5656 |
| 5756 | 5657 |
| 5757 ACCESSORS(JSGeneratorObject, function, JSFunction, kFunctionOffset) | 5658 ACCESSORS(JSGeneratorObject, function, JSFunction, kFunctionOffset) |
| 5758 ACCESSORS(JSGeneratorObject, context, Context, kContextOffset) | 5659 ACCESSORS(JSGeneratorObject, context, Context, kContextOffset) |
| 5759 ACCESSORS(JSGeneratorObject, receiver, Object, kReceiverOffset) | 5660 ACCESSORS(JSGeneratorObject, receiver, Object, kReceiverOffset) |
| 5760 SMI_ACCESSORS(JSGeneratorObject, continuation, kContinuationOffset) | 5661 SMI_ACCESSORS(JSGeneratorObject, continuation, kContinuationOffset) |
| 5761 ACCESSORS(JSGeneratorObject, operand_stack, FixedArray, kOperandStackOffset) | 5662 ACCESSORS(JSGeneratorObject, operand_stack, FixedArray, kOperandStackOffset) |
| 5762 SMI_ACCESSORS(JSGeneratorObject, stack_handler_index, kStackHandlerIndexOffset) | 5663 SMI_ACCESSORS(JSGeneratorObject, stack_handler_index, kStackHandlerIndexOffset) |
| 5763 | 5664 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5826 INT_ACCESSORS(Code, instruction_size, kInstructionSizeOffset) | 5727 INT_ACCESSORS(Code, instruction_size, kInstructionSizeOffset) |
| 5827 INT_ACCESSORS(Code, prologue_offset, kPrologueOffset) | 5728 INT_ACCESSORS(Code, prologue_offset, kPrologueOffset) |
| 5828 ACCESSORS(Code, relocation_info, ByteArray, kRelocationInfoOffset) | 5729 ACCESSORS(Code, relocation_info, ByteArray, kRelocationInfoOffset) |
| 5829 ACCESSORS(Code, handler_table, FixedArray, kHandlerTableOffset) | 5730 ACCESSORS(Code, handler_table, FixedArray, kHandlerTableOffset) |
| 5830 ACCESSORS(Code, deoptimization_data, FixedArray, kDeoptimizationDataOffset) | 5731 ACCESSORS(Code, deoptimization_data, FixedArray, kDeoptimizationDataOffset) |
| 5831 ACCESSORS(Code, raw_type_feedback_info, Object, kTypeFeedbackInfoOffset) | 5732 ACCESSORS(Code, raw_type_feedback_info, Object, kTypeFeedbackInfoOffset) |
| 5832 ACCESSORS(Code, next_code_link, Object, kNextCodeLinkOffset) | 5733 ACCESSORS(Code, next_code_link, Object, kNextCodeLinkOffset) |
| 5833 | 5734 |
| 5834 | 5735 |
| 5835 void Code::WipeOutHeader() { | 5736 void Code::WipeOutHeader() { |
| 5836 WRITE_FIELD(this, kRelocationInfoOffset, NULL); | 5737 Heap::write_field(this, kRelocationInfoOffset, NULL, SKIP_WRITE_BARRIER); |
| 5837 WRITE_FIELD(this, kHandlerTableOffset, NULL); | 5738 Heap::write_field(this, kHandlerTableOffset, NULL, SKIP_WRITE_BARRIER); |
| 5838 WRITE_FIELD(this, kDeoptimizationDataOffset, NULL); | 5739 Heap::write_field(this, kDeoptimizationDataOffset, NULL, SKIP_WRITE_BARRIER); |
| 5839 WRITE_FIELD(this, kConstantPoolOffset, NULL); | 5740 Heap::write_field(this, kConstantPoolOffset, NULL, SKIP_WRITE_BARRIER); |
| 5840 // Do not wipe out e.g. a minor key. | 5741 // Do not wipe out e.g. a minor key. |
| 5841 if (!READ_FIELD(this, kTypeFeedbackInfoOffset)->IsSmi()) { | 5742 if (!Heap::read_field(this, kTypeFeedbackInfoOffset)->IsSmi()) { |
| 5842 WRITE_FIELD(this, kTypeFeedbackInfoOffset, NULL); | 5743 Heap::write_field(this, kTypeFeedbackInfoOffset, NULL, SKIP_WRITE_BARRIER); |
| 5843 } | 5744 } |
| 5844 } | 5745 } |
| 5845 | 5746 |
| 5846 | 5747 |
| 5847 Object* Code::type_feedback_info() { | 5748 Object* Code::type_feedback_info() { |
| 5848 ASSERT(kind() == FUNCTION); | 5749 ASSERT(kind() == FUNCTION); |
| 5849 return raw_type_feedback_info(); | 5750 return raw_type_feedback_info(); |
| 5850 } | 5751 } |
| 5851 | 5752 |
| 5852 | 5753 |
| 5853 void Code::set_type_feedback_info(Object* value, WriteBarrierMode mode) { | 5754 void Code::set_type_feedback_info(Object* value, WriteBarrierMode mode) { |
| 5854 ASSERT(kind() == FUNCTION); | 5755 ASSERT(kind() == FUNCTION); |
| 5855 set_raw_type_feedback_info(value, mode); | 5756 set_raw_type_feedback_info(value, mode); |
| 5856 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kTypeFeedbackInfoOffset, | |
| 5857 value, mode); | |
| 5858 } | 5757 } |
| 5859 | 5758 |
| 5860 | 5759 |
| 5861 int Code::stub_info() { | 5760 int Code::stub_info() { |
| 5862 ASSERT(kind() == COMPARE_IC || kind() == COMPARE_NIL_IC || | 5761 ASSERT(kind() == COMPARE_IC || kind() == COMPARE_NIL_IC || |
| 5863 kind() == BINARY_OP_IC || kind() == LOAD_IC); | 5762 kind() == BINARY_OP_IC || kind() == LOAD_IC); |
| 5864 return Smi::cast(raw_type_feedback_info())->value(); | 5763 return Smi::cast(raw_type_feedback_info())->value(); |
| 5865 } | 5764 } |
| 5866 | 5765 |
| 5867 | 5766 |
| 5868 void Code::set_stub_info(int value) { | 5767 void Code::set_stub_info(int value) { |
| 5869 ASSERT(kind() == COMPARE_IC || | 5768 ASSERT(kind() == COMPARE_IC || |
| 5870 kind() == COMPARE_NIL_IC || | 5769 kind() == COMPARE_NIL_IC || |
| 5871 kind() == BINARY_OP_IC || | 5770 kind() == BINARY_OP_IC || |
| 5872 kind() == STUB || | 5771 kind() == STUB || |
| 5873 kind() == LOAD_IC || | 5772 kind() == LOAD_IC || |
| 5874 kind() == KEYED_LOAD_IC || | 5773 kind() == KEYED_LOAD_IC || |
| 5875 kind() == STORE_IC || | 5774 kind() == STORE_IC || |
| 5876 kind() == KEYED_STORE_IC); | 5775 kind() == KEYED_STORE_IC); |
| 5877 set_raw_type_feedback_info(Smi::FromInt(value)); | 5776 set_raw_type_feedback_info(Smi::FromInt(value)); |
| 5878 } | 5777 } |
| 5879 | 5778 |
| 5880 | 5779 |
| 5881 ACCESSORS(Code, gc_metadata, Object, kGCMetadataOffset) | 5780 ACCESSORS(Code, gc_metadata, Object, kGCMetadataOffset) |
| 5882 INT_ACCESSORS(Code, ic_age, kICAgeOffset) | 5781 INT_ACCESSORS(Code, ic_age, kICAgeOffset) |
| 5883 | 5782 |
| 5884 | 5783 |
| 5885 byte* Code::instruction_start() { | 5784 byte* Code::instruction_start() { |
| 5886 return FIELD_ADDR(this, kHeaderSize); | 5785 return Heap::get_field_address(this, kHeaderSize); |
| 5887 } | 5786 } |
| 5888 | 5787 |
| 5889 | 5788 |
| 5890 byte* Code::instruction_end() { | 5789 byte* Code::instruction_end() { |
| 5891 return instruction_start() + instruction_size(); | 5790 return instruction_start() + instruction_size(); |
| 5892 } | 5791 } |
| 5893 | 5792 |
| 5894 | 5793 |
| 5895 int Code::body_size() { | 5794 int Code::body_size() { |
| 5896 return RoundUp(instruction_size(), kObjectAlignment); | 5795 return RoundUp(instruction_size(), kObjectAlignment); |
| 5897 } | 5796 } |
| 5898 | 5797 |
| 5899 | 5798 |
| 5900 ByteArray* Code::unchecked_relocation_info() { | 5799 ByteArray* Code::unchecked_relocation_info() { |
| 5901 return reinterpret_cast<ByteArray*>(READ_FIELD(this, kRelocationInfoOffset)); | 5800 return reinterpret_cast<ByteArray*>( |
| 5801 Heap::read_field(this, kRelocationInfoOffset)); |
| 5902 } | 5802 } |
| 5903 | 5803 |
| 5904 | 5804 |
| 5905 byte* Code::relocation_start() { | 5805 byte* Code::relocation_start() { |
| 5906 return unchecked_relocation_info()->GetDataStartAddress(); | 5806 return unchecked_relocation_info()->GetDataStartAddress(); |
| 5907 } | 5807 } |
| 5908 | 5808 |
| 5909 | 5809 |
| 5910 int Code::relocation_size() { | 5810 int Code::relocation_size() { |
| 5911 return unchecked_relocation_info()->length(); | 5811 return unchecked_relocation_info()->length(); |
| 5912 } | 5812 } |
| 5913 | 5813 |
| 5914 | 5814 |
| 5915 byte* Code::entry() { | 5815 byte* Code::entry() { |
| 5916 return instruction_start(); | 5816 return instruction_start(); |
| 5917 } | 5817 } |
| 5918 | 5818 |
| 5919 | 5819 |
| 5920 bool Code::contains(byte* inner_pointer) { | 5820 bool Code::contains(byte* inner_pointer) { |
| 5921 return (address() <= inner_pointer) && (inner_pointer <= address() + Size()); | 5821 return (address() <= inner_pointer) && (inner_pointer <= address() + Size()); |
| 5922 } | 5822 } |
| 5923 | 5823 |
| 5924 | 5824 |
| 5925 ACCESSORS(JSArray, length, Object, kLengthOffset) | 5825 ACCESSORS(JSArray, length, Object, kLengthOffset) |
| 5926 | 5826 |
| 5927 | 5827 |
| 5928 void* JSArrayBuffer::backing_store() { | 5828 void* JSArrayBuffer::backing_store() { |
| 5929 intptr_t ptr = READ_INTPTR_FIELD(this, kBackingStoreOffset); | 5829 intptr_t ptr = Heap::read_intptr_field(this, kBackingStoreOffset); |
| 5930 return reinterpret_cast<void*>(ptr); | 5830 return reinterpret_cast<void*>(ptr); |
| 5931 } | 5831 } |
| 5932 | 5832 |
| 5933 | 5833 |
| 5934 void JSArrayBuffer::set_backing_store(void* value, WriteBarrierMode mode) { | 5834 void JSArrayBuffer::set_backing_store(void* value, WriteBarrierMode mode) { |
| 5935 intptr_t ptr = reinterpret_cast<intptr_t>(value); | 5835 intptr_t ptr = reinterpret_cast<intptr_t>(value); |
| 5936 WRITE_INTPTR_FIELD(this, kBackingStoreOffset, ptr); | 5836 Heap::write_intptr_field(this, kBackingStoreOffset, ptr); |
| 5937 } | 5837 } |
| 5938 | 5838 |
| 5939 | 5839 |
| 5940 ACCESSORS(JSArrayBuffer, byte_length, Object, kByteLengthOffset) | 5840 ACCESSORS(JSArrayBuffer, byte_length, Object, kByteLengthOffset) |
| 5941 ACCESSORS_TO_SMI(JSArrayBuffer, flag, kFlagOffset) | 5841 ACCESSORS_TO_SMI(JSArrayBuffer, flag, kFlagOffset) |
| 5942 | 5842 |
| 5943 | 5843 |
| 5944 bool JSArrayBuffer::is_external() { | 5844 bool JSArrayBuffer::is_external() { |
| 5945 return BooleanBit::get(flag(), kIsExternalBit); | 5845 return BooleanBit::get(flag(), kIsExternalBit); |
| 5946 } | 5846 } |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6021 ASSERT(TypeTag() != NOT_COMPILED); | 5921 ASSERT(TypeTag() != NOT_COMPILED); |
| 6022 ASSERT(index >= kDataIndex); // Only implementation data can be set this way. | 5922 ASSERT(index >= kDataIndex); // Only implementation data can be set this way. |
| 6023 FixedArray::cast(data())->set(index, value); | 5923 FixedArray::cast(data())->set(index, value); |
| 6024 } | 5924 } |
| 6025 | 5925 |
| 6026 | 5926 |
| 6027 ElementsKind JSObject::GetElementsKind() { | 5927 ElementsKind JSObject::GetElementsKind() { |
| 6028 ElementsKind kind = map()->elements_kind(); | 5928 ElementsKind kind = map()->elements_kind(); |
| 6029 #if DEBUG | 5929 #if DEBUG |
| 6030 FixedArrayBase* fixed_array = | 5930 FixedArrayBase* fixed_array = |
| 6031 reinterpret_cast<FixedArrayBase*>(READ_FIELD(this, kElementsOffset)); | 5931 reinterpret_cast<FixedArrayBase*>(Heap::read_field(this, |
| 5932 kElementsOffset)); |
| 6032 | 5933 |
| 6033 // If a GC was caused while constructing this object, the elements | 5934 // If a GC was caused while constructing this object, the elements |
| 6034 // pointer may point to a one pointer filler map. | 5935 // pointer may point to a one pointer filler map. |
| 6035 if (ElementsAreSafeToExamine()) { | 5936 if (ElementsAreSafeToExamine()) { |
| 6036 Map* map = fixed_array->map(); | 5937 Map* map = fixed_array->map(); |
| 6037 ASSERT((IsFastSmiOrObjectElementsKind(kind) && | 5938 ASSERT((IsFastSmiOrObjectElementsKind(kind) && |
| 6038 (map == GetHeap()->fixed_array_map() || | 5939 (map == GetHeap()->fixed_array_map() || |
| 6039 map == GetHeap()->fixed_cow_array_map())) || | 5940 map == GetHeap()->fixed_cow_array_map())) || |
| 6040 (IsFastDoubleElementsKind(kind) && | 5941 (IsFastDoubleElementsKind(kind) && |
| 6041 (fixed_array->IsFixedDoubleArray() || | 5942 (fixed_array->IsFixedDoubleArray() || |
| (...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6632 return key; | 6533 return key; |
| 6633 } | 6534 } |
| 6634 | 6535 |
| 6635 | 6536 |
| 6636 void Map::ClearCodeCache(Heap* heap) { | 6537 void Map::ClearCodeCache(Heap* heap) { |
| 6637 // No write barrier is needed since empty_fixed_array is not in new space. | 6538 // No write barrier is needed since empty_fixed_array is not in new space. |
| 6638 // Please note this function is used during marking: | 6539 // Please note this function is used during marking: |
| 6639 // - MarkCompactCollector::MarkUnmarkedObject | 6540 // - MarkCompactCollector::MarkUnmarkedObject |
| 6640 // - IncrementalMarking::Step | 6541 // - IncrementalMarking::Step |
| 6641 ASSERT(!heap->InNewSpace(heap->empty_fixed_array())); | 6542 ASSERT(!heap->InNewSpace(heap->empty_fixed_array())); |
| 6642 WRITE_FIELD(this, kCodeCacheOffset, heap->empty_fixed_array()); | 6543 Heap::write_field(this, |
| 6544 kCodeCacheOffset, |
| 6545 heap->empty_fixed_array(), |
| 6546 SKIP_WRITE_BARRIER); |
| 6643 } | 6547 } |
| 6644 | 6548 |
| 6645 | 6549 |
| 6646 void JSArray::EnsureSize(Handle<JSArray> array, int required_size) { | 6550 void JSArray::EnsureSize(Handle<JSArray> array, int required_size) { |
| 6647 ASSERT(array->HasFastSmiOrObjectElements()); | 6551 ASSERT(array->HasFastSmiOrObjectElements()); |
| 6648 Handle<FixedArray> elts = handle(FixedArray::cast(array->elements())); | 6552 Handle<FixedArray> elts = handle(FixedArray::cast(array->elements())); |
| 6649 const int kArraySizeThatFitsComfortablyInNewSpace = 128; | 6553 const int kArraySizeThatFitsComfortablyInNewSpace = 128; |
| 6650 if (elts->length() < required_size) { | 6554 if (elts->length() < required_size) { |
| 6651 // Doubling in size would be overkill, but leave some slack to avoid | 6555 // Doubling in size would be overkill, but leave some slack to avoid |
| 6652 // constantly growing. | 6556 // constantly growing. |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6705 return Handle<Object>(Smi::FromInt(static_cast<int>(elements_kind)), isolate); | 6609 return Handle<Object>(Smi::FromInt(static_cast<int>(elements_kind)), isolate); |
| 6706 } | 6610 } |
| 6707 | 6611 |
| 6708 | 6612 |
| 6709 Object* TypeFeedbackInfo::RawUninitializedSentinel(Heap* heap) { | 6613 Object* TypeFeedbackInfo::RawUninitializedSentinel(Heap* heap) { |
| 6710 return heap->uninitialized_symbol(); | 6614 return heap->uninitialized_symbol(); |
| 6711 } | 6615 } |
| 6712 | 6616 |
| 6713 | 6617 |
| 6714 int TypeFeedbackInfo::ic_total_count() { | 6618 int TypeFeedbackInfo::ic_total_count() { |
| 6715 int current = Smi::cast(READ_FIELD(this, kStorage1Offset))->value(); | 6619 int current = Smi::cast(Heap::read_field(this, kStorage1Offset))->value(); |
| 6716 return ICTotalCountField::decode(current); | 6620 return ICTotalCountField::decode(current); |
| 6717 } | 6621 } |
| 6718 | 6622 |
| 6719 | 6623 |
| 6720 void TypeFeedbackInfo::set_ic_total_count(int count) { | 6624 void TypeFeedbackInfo::set_ic_total_count(int count) { |
| 6721 int value = Smi::cast(READ_FIELD(this, kStorage1Offset))->value(); | 6625 int value = Smi::cast(Heap::read_field(this, kStorage1Offset))->value(); |
| 6722 value = ICTotalCountField::update(value, | 6626 value = ICTotalCountField::update(value, |
| 6723 ICTotalCountField::decode(count)); | 6627 ICTotalCountField::decode(count)); |
| 6724 WRITE_FIELD(this, kStorage1Offset, Smi::FromInt(value)); | 6628 Heap::write_field(this, |
| 6629 kStorage1Offset, |
| 6630 Smi::FromInt(value), |
| 6631 SKIP_WRITE_BARRIER); |
| 6725 } | 6632 } |
| 6726 | 6633 |
| 6727 | 6634 |
| 6728 int TypeFeedbackInfo::ic_with_type_info_count() { | 6635 int TypeFeedbackInfo::ic_with_type_info_count() { |
| 6729 int current = Smi::cast(READ_FIELD(this, kStorage2Offset))->value(); | 6636 int current = Smi::cast(Heap::read_field(this, kStorage2Offset))->value(); |
| 6730 return ICsWithTypeInfoCountField::decode(current); | 6637 return ICsWithTypeInfoCountField::decode(current); |
| 6731 } | 6638 } |
| 6732 | 6639 |
| 6733 | 6640 |
| 6734 void TypeFeedbackInfo::change_ic_with_type_info_count(int delta) { | 6641 void TypeFeedbackInfo::change_ic_with_type_info_count(int delta) { |
| 6735 int value = Smi::cast(READ_FIELD(this, kStorage2Offset))->value(); | 6642 int value = Smi::cast(Heap::read_field(this, kStorage2Offset))->value(); |
| 6736 int new_count = ICsWithTypeInfoCountField::decode(value) + delta; | 6643 int new_count = ICsWithTypeInfoCountField::decode(value) + delta; |
| 6737 // We can get negative count here when the type-feedback info is | 6644 // We can get negative count here when the type-feedback info is |
| 6738 // shared between two code objects. The can only happen when | 6645 // shared between two code objects. The can only happen when |
| 6739 // the debugger made a shallow copy of code object (see Heap::CopyCode). | 6646 // the debugger made a shallow copy of code object (see Heap::CopyCode). |
| 6740 // Since we do not optimize when the debugger is active, we can skip | 6647 // Since we do not optimize when the debugger is active, we can skip |
| 6741 // this counter update. | 6648 // this counter update. |
| 6742 if (new_count >= 0) { | 6649 if (new_count >= 0) { |
| 6743 new_count &= ICsWithTypeInfoCountField::kMask; | 6650 new_count &= ICsWithTypeInfoCountField::kMask; |
| 6744 value = ICsWithTypeInfoCountField::update(value, new_count); | 6651 value = ICsWithTypeInfoCountField::update(value, new_count); |
| 6745 WRITE_FIELD(this, kStorage2Offset, Smi::FromInt(value)); | 6652 Heap::write_field(this, |
| 6653 kStorage2Offset, |
| 6654 Smi::FromInt(value), |
| 6655 SKIP_WRITE_BARRIER); |
| 6746 } | 6656 } |
| 6747 } | 6657 } |
| 6748 | 6658 |
| 6749 | 6659 |
| 6750 void TypeFeedbackInfo::initialize_storage() { | 6660 void TypeFeedbackInfo::initialize_storage() { |
| 6751 WRITE_FIELD(this, kStorage1Offset, Smi::FromInt(0)); | 6661 Heap::write_field(this, kStorage1Offset, Smi::FromInt(0), SKIP_WRITE_BARRIER); |
| 6752 WRITE_FIELD(this, kStorage2Offset, Smi::FromInt(0)); | 6662 Heap::write_field(this, kStorage2Offset, Smi::FromInt(0), SKIP_WRITE_BARRIER); |
| 6753 } | 6663 } |
| 6754 | 6664 |
| 6755 | 6665 |
| 6756 void TypeFeedbackInfo::change_own_type_change_checksum() { | 6666 void TypeFeedbackInfo::change_own_type_change_checksum() { |
| 6757 int value = Smi::cast(READ_FIELD(this, kStorage1Offset))->value(); | 6667 int value = Smi::cast(Heap::read_field(this, kStorage1Offset))->value(); |
| 6758 int checksum = OwnTypeChangeChecksum::decode(value); | 6668 int checksum = OwnTypeChangeChecksum::decode(value); |
| 6759 checksum = (checksum + 1) % (1 << kTypeChangeChecksumBits); | 6669 checksum = (checksum + 1) % (1 << kTypeChangeChecksumBits); |
| 6760 value = OwnTypeChangeChecksum::update(value, checksum); | 6670 value = OwnTypeChangeChecksum::update(value, checksum); |
| 6761 // Ensure packed bit field is in Smi range. | 6671 // Ensure packed bit field is in Smi range. |
| 6762 if (value > Smi::kMaxValue) value |= Smi::kMinValue; | 6672 if (value > Smi::kMaxValue) value |= Smi::kMinValue; |
| 6763 if (value < Smi::kMinValue) value &= ~Smi::kMinValue; | 6673 if (value < Smi::kMinValue) value &= ~Smi::kMinValue; |
| 6764 WRITE_FIELD(this, kStorage1Offset, Smi::FromInt(value)); | 6674 Heap::write_field(this, |
| 6675 kStorage1Offset, |
| 6676 Smi::FromInt(value), |
| 6677 SKIP_WRITE_BARRIER); |
| 6765 } | 6678 } |
| 6766 | 6679 |
| 6767 | 6680 |
| 6768 void TypeFeedbackInfo::set_inlined_type_change_checksum(int checksum) { | 6681 void TypeFeedbackInfo::set_inlined_type_change_checksum(int checksum) { |
| 6769 int value = Smi::cast(READ_FIELD(this, kStorage2Offset))->value(); | 6682 int value = Smi::cast(Heap::read_field(this, kStorage2Offset))->value(); |
| 6770 int mask = (1 << kTypeChangeChecksumBits) - 1; | 6683 int mask = (1 << kTypeChangeChecksumBits) - 1; |
| 6771 value = InlinedTypeChangeChecksum::update(value, checksum & mask); | 6684 value = InlinedTypeChangeChecksum::update(value, checksum & mask); |
| 6772 // Ensure packed bit field is in Smi range. | 6685 // Ensure packed bit field is in Smi range. |
| 6773 if (value > Smi::kMaxValue) value |= Smi::kMinValue; | 6686 if (value > Smi::kMaxValue) value |= Smi::kMinValue; |
| 6774 if (value < Smi::kMinValue) value &= ~Smi::kMinValue; | 6687 if (value < Smi::kMinValue) value &= ~Smi::kMinValue; |
| 6775 WRITE_FIELD(this, kStorage2Offset, Smi::FromInt(value)); | 6688 Heap::write_field(this, |
| 6689 kStorage2Offset, |
| 6690 Smi::FromInt(value), |
| 6691 SKIP_WRITE_BARRIER); |
| 6776 } | 6692 } |
| 6777 | 6693 |
| 6778 | 6694 |
| 6779 int TypeFeedbackInfo::own_type_change_checksum() { | 6695 int TypeFeedbackInfo::own_type_change_checksum() { |
| 6780 int value = Smi::cast(READ_FIELD(this, kStorage1Offset))->value(); | 6696 int value = Smi::cast(Heap::read_field(this, kStorage1Offset))->value(); |
| 6781 return OwnTypeChangeChecksum::decode(value); | 6697 return OwnTypeChangeChecksum::decode(value); |
| 6782 } | 6698 } |
| 6783 | 6699 |
| 6784 | 6700 |
| 6785 bool TypeFeedbackInfo::matches_inlined_type_change_checksum(int checksum) { | 6701 bool TypeFeedbackInfo::matches_inlined_type_change_checksum(int checksum) { |
| 6786 int value = Smi::cast(READ_FIELD(this, kStorage2Offset))->value(); | 6702 int value = Smi::cast(Heap::read_field(this, kStorage2Offset))->value(); |
| 6787 int mask = (1 << kTypeChangeChecksumBits) - 1; | 6703 int mask = (1 << kTypeChangeChecksumBits) - 1; |
| 6788 return InlinedTypeChangeChecksum::decode(value) == (checksum & mask); | 6704 return InlinedTypeChangeChecksum::decode(value) == (checksum & mask); |
| 6789 } | 6705 } |
| 6790 | 6706 |
| 6791 | 6707 |
| 6792 ACCESSORS(TypeFeedbackInfo, feedback_vector, FixedArray, | 6708 ACCESSORS(TypeFeedbackInfo, feedback_vector, FixedArray, |
| 6793 kFeedbackVectorOffset) | 6709 kFeedbackVectorOffset) |
| 6794 | 6710 |
| 6795 | 6711 |
| 6796 SMI_ACCESSORS(AliasedArgumentsEntry, aliased_context_slot, kAliasedContextSlot) | 6712 SMI_ACCESSORS(AliasedArgumentsEntry, aliased_context_slot, kAliasedContextSlot) |
| (...skipping 12 matching lines...) Expand all Loading... |
| 6809 } | 6725 } |
| 6810 | 6726 |
| 6811 | 6727 |
| 6812 int JSObject::BodyDescriptor::SizeOf(Map* map, HeapObject* object) { | 6728 int JSObject::BodyDescriptor::SizeOf(Map* map, HeapObject* object) { |
| 6813 return map->instance_size(); | 6729 return map->instance_size(); |
| 6814 } | 6730 } |
| 6815 | 6731 |
| 6816 | 6732 |
| 6817 void Foreign::ForeignIterateBody(ObjectVisitor* v) { | 6733 void Foreign::ForeignIterateBody(ObjectVisitor* v) { |
| 6818 v->VisitExternalReference( | 6734 v->VisitExternalReference( |
| 6819 reinterpret_cast<Address*>(FIELD_ADDR(this, kForeignAddressOffset))); | 6735 reinterpret_cast<Address*>( |
| 6736 Heap::get_field_address(this, kForeignAddressOffset))); |
| 6820 } | 6737 } |
| 6821 | 6738 |
| 6822 | 6739 |
| 6823 template<typename StaticVisitor> | 6740 template<typename StaticVisitor> |
| 6824 void Foreign::ForeignIterateBody() { | 6741 void Foreign::ForeignIterateBody() { |
| 6825 StaticVisitor::VisitExternalReference( | 6742 StaticVisitor::VisitExternalReference( |
| 6826 reinterpret_cast<Address*>(FIELD_ADDR(this, kForeignAddressOffset))); | 6743 reinterpret_cast<Address*>( |
| 6744 Heap::get_field_address(this, kForeignAddressOffset))); |
| 6827 } | 6745 } |
| 6828 | 6746 |
| 6829 | 6747 |
| 6830 void ExternalAsciiString::ExternalAsciiStringIterateBody(ObjectVisitor* v) { | 6748 void ExternalAsciiString::ExternalAsciiStringIterateBody(ObjectVisitor* v) { |
| 6831 typedef v8::String::ExternalAsciiStringResource Resource; | 6749 typedef v8::String::ExternalAsciiStringResource Resource; |
| 6832 v->VisitExternalAsciiString( | 6750 v->VisitExternalAsciiString(reinterpret_cast<Resource**>( |
| 6833 reinterpret_cast<Resource**>(FIELD_ADDR(this, kResourceOffset))); | 6751 Heap::get_field_address(this, kResourceOffset))); |
| 6834 } | 6752 } |
| 6835 | 6753 |
| 6836 | 6754 |
| 6837 template<typename StaticVisitor> | 6755 template<typename StaticVisitor> |
| 6838 void ExternalAsciiString::ExternalAsciiStringIterateBody() { | 6756 void ExternalAsciiString::ExternalAsciiStringIterateBody() { |
| 6839 typedef v8::String::ExternalAsciiStringResource Resource; | 6757 typedef v8::String::ExternalAsciiStringResource Resource; |
| 6840 StaticVisitor::VisitExternalAsciiString( | 6758 StaticVisitor::VisitExternalAsciiString(reinterpret_cast<Resource**>( |
| 6841 reinterpret_cast<Resource**>(FIELD_ADDR(this, kResourceOffset))); | 6759 Heap::get_field_address(this, kResourceOffset))); |
| 6842 } | 6760 } |
| 6843 | 6761 |
| 6844 | 6762 |
| 6845 void ExternalTwoByteString::ExternalTwoByteStringIterateBody(ObjectVisitor* v) { | 6763 void ExternalTwoByteString::ExternalTwoByteStringIterateBody(ObjectVisitor* v) { |
| 6846 typedef v8::String::ExternalStringResource Resource; | 6764 typedef v8::String::ExternalStringResource Resource; |
| 6847 v->VisitExternalTwoByteString( | 6765 v->VisitExternalTwoByteString(reinterpret_cast<Resource**>( |
| 6848 reinterpret_cast<Resource**>(FIELD_ADDR(this, kResourceOffset))); | 6766 Heap::get_field_address(this, kResourceOffset))); |
| 6849 } | 6767 } |
| 6850 | 6768 |
| 6851 | 6769 |
| 6852 template<typename StaticVisitor> | 6770 template<typename StaticVisitor> |
| 6853 void ExternalTwoByteString::ExternalTwoByteStringIterateBody() { | 6771 void ExternalTwoByteString::ExternalTwoByteStringIterateBody() { |
| 6854 typedef v8::String::ExternalStringResource Resource; | 6772 typedef v8::String::ExternalStringResource Resource; |
| 6855 StaticVisitor::VisitExternalTwoByteString( | 6773 StaticVisitor::VisitExternalTwoByteString(reinterpret_cast<Resource**>( |
| 6856 reinterpret_cast<Resource**>(FIELD_ADDR(this, kResourceOffset))); | 6774 Heap::get_field_address(this, kResourceOffset))); |
| 6857 } | 6775 } |
| 6858 | 6776 |
| 6859 | 6777 |
| 6860 template<int start_offset, int end_offset, int size> | 6778 template<int start_offset, int end_offset, int size> |
| 6861 void FixedBodyDescriptor<start_offset, end_offset, size>::IterateBody( | 6779 void FixedBodyDescriptor<start_offset, end_offset, size>::IterateBody( |
| 6862 HeapObject* obj, | 6780 HeapObject* obj, |
| 6863 ObjectVisitor* v) { | 6781 ObjectVisitor* v) { |
| 6864 v->VisitPointers(HeapObject::RawField(obj, start_offset), | 6782 v->VisitPointers(HeapObject::RawField(obj, start_offset), |
| 6865 HeapObject::RawField(obj, end_offset)); | 6783 HeapObject::RawField(obj, end_offset)); |
| 6866 } | 6784 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 6878 #undef TYPE_CHECKER | 6796 #undef TYPE_CHECKER |
| 6879 #undef CAST_ACCESSOR | 6797 #undef CAST_ACCESSOR |
| 6880 #undef INT_ACCESSORS | 6798 #undef INT_ACCESSORS |
| 6881 #undef ACCESSORS | 6799 #undef ACCESSORS |
| 6882 #undef ACCESSORS_TO_SMI | 6800 #undef ACCESSORS_TO_SMI |
| 6883 #undef SMI_ACCESSORS | 6801 #undef SMI_ACCESSORS |
| 6884 #undef SYNCHRONIZED_SMI_ACCESSORS | 6802 #undef SYNCHRONIZED_SMI_ACCESSORS |
| 6885 #undef NOBARRIER_SMI_ACCESSORS | 6803 #undef NOBARRIER_SMI_ACCESSORS |
| 6886 #undef BOOL_GETTER | 6804 #undef BOOL_GETTER |
| 6887 #undef BOOL_ACCESSORS | 6805 #undef BOOL_ACCESSORS |
| 6888 #undef FIELD_ADDR | |
| 6889 #undef READ_FIELD | |
| 6890 #undef NOBARRIER_READ_FIELD | |
| 6891 #undef WRITE_FIELD | |
| 6892 #undef NOBARRIER_WRITE_FIELD | |
| 6893 #undef WRITE_BARRIER | |
| 6894 #undef CONDITIONAL_WRITE_BARRIER | |
| 6895 #undef READ_DOUBLE_FIELD | |
| 6896 #undef WRITE_DOUBLE_FIELD | |
| 6897 #undef READ_INT_FIELD | |
| 6898 #undef WRITE_INT_FIELD | |
| 6899 #undef READ_INTPTR_FIELD | |
| 6900 #undef WRITE_INTPTR_FIELD | |
| 6901 #undef READ_UINT32_FIELD | |
| 6902 #undef WRITE_UINT32_FIELD | |
| 6903 #undef READ_SHORT_FIELD | |
| 6904 #undef WRITE_SHORT_FIELD | |
| 6905 #undef READ_BYTE_FIELD | |
| 6906 #undef WRITE_BYTE_FIELD | |
| 6907 #undef NOBARRIER_READ_BYTE_FIELD | |
| 6908 #undef NOBARRIER_WRITE_BYTE_FIELD | |
| 6909 | 6806 |
| 6910 } } // namespace v8::internal | 6807 } } // namespace v8::internal |
| 6911 | 6808 |
| 6912 #endif // V8_OBJECTS_INL_H_ | 6809 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |