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 1467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1478 ->heap(); | 1478 ->heap(); |
1479 SLOW_DCHECK(heap != NULL); | 1479 SLOW_DCHECK(heap != NULL); |
1480 return heap; | 1480 return heap; |
1481 } | 1481 } |
1482 | 1482 |
1483 | 1483 |
1484 Isolate* HeapObject::GetIsolate() const { | 1484 Isolate* HeapObject::GetIsolate() const { |
1485 return GetHeap()->isolate(); | 1485 return GetHeap()->isolate(); |
1486 } | 1486 } |
1487 | 1487 |
1488 | |
1489 Map* HeapObject::map() const { | 1488 Map* HeapObject::map() const { |
1490 return map_word().ToMap(); | 1489 return map_word().ToMap(); |
1491 } | 1490 } |
1492 | 1491 |
1493 | 1492 |
1494 void HeapObject::set_map(Map* value) { | 1493 void HeapObject::set_map(Map* value) { |
| 1494 if (value != nullptr) { |
| 1495 #ifdef VERIFY_HEAP |
| 1496 value->GetHeap()->VerifyObjectLayoutChange(this, value); |
| 1497 #endif |
| 1498 } |
1495 set_map_word(MapWord::FromMap(value)); | 1499 set_map_word(MapWord::FromMap(value)); |
1496 if (value != nullptr) { | 1500 if (value != nullptr) { |
1497 // TODO(1600) We are passing NULL as a slot because maps can never be on | 1501 // TODO(1600) We are passing NULL as a slot because maps can never be on |
1498 // evacuation candidate. | 1502 // evacuation candidate. |
1499 value->GetHeap()->incremental_marking()->RecordWrite(this, nullptr, value); | 1503 value->GetHeap()->incremental_marking()->RecordWrite(this, nullptr, value); |
1500 #ifdef VERIFY_HEAP | |
1501 value->GetHeap()->VerifyObjectLayoutChange(this, value); | |
1502 #endif | |
1503 } | 1504 } |
1504 } | 1505 } |
1505 | 1506 |
1506 | 1507 |
1507 Map* HeapObject::synchronized_map() { | 1508 Map* HeapObject::synchronized_map() { |
1508 return synchronized_map_word().ToMap(); | 1509 return synchronized_map_word().ToMap(); |
1509 } | 1510 } |
1510 | 1511 |
1511 | 1512 |
1512 void HeapObject::synchronized_set_map(Map* value) { | 1513 void HeapObject::synchronized_set_map(Map* value) { |
| 1514 if (value != nullptr) { |
| 1515 #ifdef VERIFY_HEAP |
| 1516 value->GetHeap()->VerifyObjectLayoutChange(this, value); |
| 1517 #endif |
| 1518 } |
1513 synchronized_set_map_word(MapWord::FromMap(value)); | 1519 synchronized_set_map_word(MapWord::FromMap(value)); |
1514 if (value != nullptr) { | 1520 if (value != nullptr) { |
1515 // TODO(1600) We are passing NULL as a slot because maps can never be on | 1521 // TODO(1600) We are passing NULL as a slot because maps can never be on |
1516 // evacuation candidate. | 1522 // evacuation candidate. |
1517 value->GetHeap()->incremental_marking()->RecordWrite(this, nullptr, value); | 1523 value->GetHeap()->incremental_marking()->RecordWrite(this, nullptr, value); |
1518 #ifdef VERIFY_HEAP | |
1519 value->GetHeap()->VerifyObjectLayoutChange(this, value); | |
1520 #endif | |
1521 } | 1524 } |
1522 } | 1525 } |
1523 | 1526 |
1524 | 1527 |
1525 void HeapObject::synchronized_set_map_no_write_barrier(Map* value) { | |
1526 synchronized_set_map_word(MapWord::FromMap(value)); | |
1527 } | |
1528 | |
1529 | |
1530 // Unsafe accessor omitting write barrier. | 1528 // Unsafe accessor omitting write barrier. |
1531 void HeapObject::set_map_no_write_barrier(Map* value) { | 1529 void HeapObject::set_map_no_write_barrier(Map* value) { |
| 1530 if (value != nullptr) { |
| 1531 #ifdef VERIFY_HEAP |
| 1532 value->GetHeap()->VerifyObjectLayoutChange(this, value); |
| 1533 #endif |
| 1534 } |
1532 set_map_word(MapWord::FromMap(value)); | 1535 set_map_word(MapWord::FromMap(value)); |
1533 } | 1536 } |
1534 | 1537 |
| 1538 void HeapObject::set_map_after_allocation(Map* value, WriteBarrierMode mode) { |
| 1539 set_map_word(MapWord::FromMap(value)); |
| 1540 if (mode != SKIP_WRITE_BARRIER) { |
| 1541 DCHECK(value != nullptr); |
| 1542 // TODO(1600) We are passing NULL as a slot because maps can never be on |
| 1543 // evacuation candidate. |
| 1544 value->GetHeap()->incremental_marking()->RecordWrite(this, nullptr, value); |
| 1545 } |
| 1546 } |
| 1547 |
1535 HeapObject** HeapObject::map_slot() { | 1548 HeapObject** HeapObject::map_slot() { |
1536 return reinterpret_cast<HeapObject**>(FIELD_ADDR(this, kMapOffset)); | 1549 return reinterpret_cast<HeapObject**>(FIELD_ADDR(this, kMapOffset)); |
1537 } | 1550 } |
1538 | 1551 |
1539 MapWord HeapObject::map_word() const { | 1552 MapWord HeapObject::map_word() const { |
1540 return MapWord( | 1553 return MapWord( |
1541 reinterpret_cast<uintptr_t>(NOBARRIER_READ_FIELD(this, kMapOffset))); | 1554 reinterpret_cast<uintptr_t>(NOBARRIER_READ_FIELD(this, kMapOffset))); |
1542 } | 1555 } |
1543 | 1556 |
1544 | 1557 |
(...skipping 6716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8261 #undef WRITE_BYTE_FIELD | 8274 #undef WRITE_BYTE_FIELD |
8262 #undef NOBARRIER_READ_BYTE_FIELD | 8275 #undef NOBARRIER_READ_BYTE_FIELD |
8263 #undef NOBARRIER_WRITE_BYTE_FIELD | 8276 #undef NOBARRIER_WRITE_BYTE_FIELD |
8264 | 8277 |
8265 } // namespace internal | 8278 } // namespace internal |
8266 } // namespace v8 | 8279 } // namespace v8 |
8267 | 8280 |
8268 #include "src/objects/object-macros-undef.h" | 8281 #include "src/objects/object-macros-undef.h" |
8269 | 8282 |
8270 #endif // V8_OBJECTS_INL_H_ | 8283 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |