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