OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 #include <stdlib.h> | 5 #include <stdlib.h> |
6 #include <utility> | 6 #include <utility> |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/compilation-cache.h" | 10 #include "src/compilation-cache.h" |
11 #include "src/execution.h" | 11 #include "src/execution.h" |
12 #include "src/factory.h" | 12 #include "src/factory.h" |
13 #include "src/field-type.h" | 13 #include "src/field-type.h" |
14 #include "src/global-handles.h" | 14 #include "src/global-handles.h" |
| 15 #include "src/heap/slots-buffer.h" |
15 #include "src/ic/ic.h" | 16 #include "src/ic/ic.h" |
16 #include "src/macro-assembler.h" | 17 #include "src/macro-assembler.h" |
17 #include "test/cctest/cctest.h" | 18 #include "test/cctest/cctest.h" |
18 #include "test/cctest/heap/utils-inl.h" | 19 #include "test/cctest/heap/utils-inl.h" |
19 | 20 |
20 using namespace v8::base; | 21 using namespace v8::base; |
21 using namespace v8::internal; | 22 using namespace v8::internal; |
22 | 23 |
23 #if V8_DOUBLE_FIELDS_UNBOXING | 24 #if V8_DOUBLE_FIELDS_UNBOXING |
24 | 25 |
(...skipping 1441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1466 | 1467 |
1467 // Check that everything is ready for triggering incremental write barrier | 1468 // Check that everything is ready for triggering incremental write barrier |
1468 // (i.e. that both |obj| and |obj_value| are black and the marking phase is | 1469 // (i.e. that both |obj| and |obj_value| are black and the marking phase is |
1469 // still active and |obj_value|'s page is indeed an evacuation candidate). | 1470 // still active and |obj_value|'s page is indeed an evacuation candidate). |
1470 IncrementalMarking* marking = heap->incremental_marking(); | 1471 IncrementalMarking* marking = heap->incremental_marking(); |
1471 CHECK(marking->IsMarking()); | 1472 CHECK(marking->IsMarking()); |
1472 CHECK(Marking::IsBlack(Marking::MarkBitFrom(*obj))); | 1473 CHECK(Marking::IsBlack(Marking::MarkBitFrom(*obj))); |
1473 CHECK(Marking::IsBlack(Marking::MarkBitFrom(*obj_value))); | 1474 CHECK(Marking::IsBlack(Marking::MarkBitFrom(*obj_value))); |
1474 CHECK(MarkCompactCollector::IsOnEvacuationCandidate(*obj_value)); | 1475 CHECK(MarkCompactCollector::IsOnEvacuationCandidate(*obj_value)); |
1475 | 1476 |
1476 // Trigger incremental write barrier, which should add a slot to remembered | 1477 // Trigger incremental write barrier, which should add a slot to |ec_page|'s |
1477 // set. | 1478 // slots buffer. |
1478 { | 1479 { |
| 1480 int slots_buffer_len = SlotsBuffer::SizeOfChain(ec_page->slots_buffer()); |
1479 FieldIndex index = FieldIndex::ForDescriptor(*map, tagged_descriptor); | 1481 FieldIndex index = FieldIndex::ForDescriptor(*map, tagged_descriptor); |
1480 obj->FastPropertyAtPut(index, *obj_value); | 1482 const int n = SlotsBuffer::kNumberOfElements + 10; |
| 1483 for (int i = 0; i < n; i++) { |
| 1484 obj->FastPropertyAtPut(index, *obj_value); |
| 1485 } |
| 1486 // Ensure that the slot was actually added to the |ec_page|'s slots buffer. |
| 1487 CHECK_EQ(slots_buffer_len + n, |
| 1488 SlotsBuffer::SizeOfChain(ec_page->slots_buffer())); |
1481 } | 1489 } |
1482 | 1490 |
1483 // Migrate |obj| to |new_map| which should shift fields and put the | 1491 // Migrate |obj| to |new_map| which should shift fields and put the |
1484 // |boom_value| to the slot that was earlier recorded by incremental write | 1492 // |boom_value| to the slot that was earlier recorded by incremental write |
1485 // barrier. | 1493 // barrier. |
1486 JSObject::MigrateToMap(obj, new_map); | 1494 JSObject::MigrateToMap(obj, new_map); |
1487 | 1495 |
1488 double boom_value = bit_cast<double>(UINT64_C(0xbaad0176a37c28e1)); | 1496 double boom_value = bit_cast<double>(UINT64_C(0xbaad0176a37c28e1)); |
1489 | 1497 |
1490 FieldIndex double_field_index = | 1498 FieldIndex double_field_index = |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1554 | 1562 |
1555 // TODO(ishell): add respective tests for property kind reconfiguring from | 1563 // TODO(ishell): add respective tests for property kind reconfiguring from |
1556 // accessor field to double, once accessor fields are supported by | 1564 // accessor field to double, once accessor fields are supported by |
1557 // Map::ReconfigureProperty(). | 1565 // Map::ReconfigureProperty(). |
1558 | 1566 |
1559 | 1567 |
1560 // TODO(ishell): add respective tests for fast property removal case once | 1568 // TODO(ishell): add respective tests for fast property removal case once |
1561 // Map::ReconfigureProperty() supports that. | 1569 // Map::ReconfigureProperty() supports that. |
1562 | 1570 |
1563 #endif | 1571 #endif |
OLD | NEW |