| 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" |
| (...skipping 1133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1144 ec_page->SetFlag(MemoryChunk::FORCE_EVACUATION_CANDIDATE_FOR_TESTING); | 1144 ec_page->SetFlag(MemoryChunk::FORCE_EVACUATION_CANDIDATE_FOR_TESTING); |
| 1145 heap::SimulateIncrementalMarking(heap); | 1145 heap::SimulateIncrementalMarking(heap); |
| 1146 // Disable stress compaction mode in order to let GC do scavenge. | 1146 // Disable stress compaction mode in order to let GC do scavenge. |
| 1147 FLAG_stress_compaction = false; | 1147 FLAG_stress_compaction = false; |
| 1148 | 1148 |
| 1149 // Check that everything is ready for triggering incremental write barrier | 1149 // Check that everything is ready for triggering incremental write barrier |
| 1150 // during scavenge (i.e. that |obj| is black and incremental marking is | 1150 // during scavenge (i.e. that |obj| is black and incremental marking is |
| 1151 // in compacting mode and |obj_value|'s page is an evacuation candidate). | 1151 // in compacting mode and |obj_value|'s page is an evacuation candidate). |
| 1152 IncrementalMarking* marking = heap->incremental_marking(); | 1152 IncrementalMarking* marking = heap->incremental_marking(); |
| 1153 CHECK(marking->IsCompacting()); | 1153 CHECK(marking->IsCompacting()); |
| 1154 CHECK(Marking::IsBlack(Marking::MarkBitFrom(*obj))); | 1154 CHECK(Marking::IsBlack(ObjectMarking::MarkBitFrom(*obj))); |
| 1155 CHECK(MarkCompactCollector::IsOnEvacuationCandidate(*obj_value)); | 1155 CHECK(MarkCompactCollector::IsOnEvacuationCandidate(*obj_value)); |
| 1156 | 1156 |
| 1157 // Trigger GCs so that |obj| moves to old gen. | 1157 // Trigger GCs so that |obj| moves to old gen. |
| 1158 heap->CollectGarbage(i::NEW_SPACE); // in survivor space now | 1158 heap->CollectGarbage(i::NEW_SPACE); // in survivor space now |
| 1159 heap->CollectGarbage(i::NEW_SPACE); // in old gen now | 1159 heap->CollectGarbage(i::NEW_SPACE); // in old gen now |
| 1160 | 1160 |
| 1161 CHECK(isolate->heap()->old_space()->Contains(*obj)); | 1161 CHECK(isolate->heap()->old_space()->Contains(*obj)); |
| 1162 CHECK(isolate->heap()->old_space()->Contains(*obj_value)); | 1162 CHECK(isolate->heap()->old_space()->Contains(*obj_value)); |
| 1163 CHECK(MarkCompactCollector::IsOnEvacuationCandidate(*obj_value)); | 1163 CHECK(MarkCompactCollector::IsOnEvacuationCandidate(*obj_value)); |
| 1164 | 1164 |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1460 // Heap is ready, force |ec_page| to become an evacuation candidate and | 1460 // Heap is ready, force |ec_page| to become an evacuation candidate and |
| 1461 // simulate incremental marking. | 1461 // simulate incremental marking. |
| 1462 ec_page->SetFlag(MemoryChunk::FORCE_EVACUATION_CANDIDATE_FOR_TESTING); | 1462 ec_page->SetFlag(MemoryChunk::FORCE_EVACUATION_CANDIDATE_FOR_TESTING); |
| 1463 heap::SimulateIncrementalMarking(heap); | 1463 heap::SimulateIncrementalMarking(heap); |
| 1464 | 1464 |
| 1465 // Check that everything is ready for triggering incremental write barrier | 1465 // Check that everything is ready for triggering incremental write barrier |
| 1466 // (i.e. that both |obj| and |obj_value| are black and the marking phase is | 1466 // (i.e. that both |obj| and |obj_value| are black and the marking phase is |
| 1467 // still active and |obj_value|'s page is indeed an evacuation candidate). | 1467 // still active and |obj_value|'s page is indeed an evacuation candidate). |
| 1468 IncrementalMarking* marking = heap->incremental_marking(); | 1468 IncrementalMarking* marking = heap->incremental_marking(); |
| 1469 CHECK(marking->IsMarking()); | 1469 CHECK(marking->IsMarking()); |
| 1470 CHECK(Marking::IsBlack(Marking::MarkBitFrom(*obj))); | 1470 CHECK(Marking::IsBlack(ObjectMarking::MarkBitFrom(*obj))); |
| 1471 CHECK(Marking::IsBlack(Marking::MarkBitFrom(*obj_value))); | 1471 CHECK(Marking::IsBlack(ObjectMarking::MarkBitFrom(*obj_value))); |
| 1472 CHECK(MarkCompactCollector::IsOnEvacuationCandidate(*obj_value)); | 1472 CHECK(MarkCompactCollector::IsOnEvacuationCandidate(*obj_value)); |
| 1473 | 1473 |
| 1474 // Trigger incremental write barrier, which should add a slot to remembered | 1474 // Trigger incremental write barrier, which should add a slot to remembered |
| 1475 // set. | 1475 // set. |
| 1476 { | 1476 { |
| 1477 FieldIndex index = FieldIndex::ForDescriptor(*map, tagged_descriptor); | 1477 FieldIndex index = FieldIndex::ForDescriptor(*map, tagged_descriptor); |
| 1478 obj->FastPropertyAtPut(index, *obj_value); | 1478 obj->FastPropertyAtPut(index, *obj_value); |
| 1479 } | 1479 } |
| 1480 | 1480 |
| 1481 // Migrate |obj| to |new_map| which should shift fields and put the | 1481 // Migrate |obj| to |new_map| which should shift fields and put the |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1554 | 1554 |
| 1555 // TODO(ishell): add respective tests for property kind reconfiguring from | 1555 // TODO(ishell): add respective tests for property kind reconfiguring from |
| 1556 // accessor field to double, once accessor fields are supported by | 1556 // accessor field to double, once accessor fields are supported by |
| 1557 // Map::ReconfigureProperty(). | 1557 // Map::ReconfigureProperty(). |
| 1558 | 1558 |
| 1559 | 1559 |
| 1560 // TODO(ishell): add respective tests for fast property removal case once | 1560 // TODO(ishell): add respective tests for fast property removal case once |
| 1561 // Map::ReconfigureProperty() supports that. | 1561 // Map::ReconfigureProperty() supports that. |
| 1562 | 1562 |
| 1563 #endif | 1563 #endif |
| OLD | NEW |