OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 "src/objects.h" | 5 #include "src/objects.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 #include <iomanip> | 8 #include <iomanip> |
9 #include <memory> | 9 #include <memory> |
10 #include <sstream> | 10 #include <sstream> |
(...skipping 3550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3561 | 3561 |
3562 // We are storing the new map using release store after creating a filler for | 3562 // We are storing the new map using release store after creating a filler for |
3563 // the left-over space to avoid races with the sweeper thread. | 3563 // the left-over space to avoid races with the sweeper thread. |
3564 object->synchronized_set_map(*new_map); | 3564 object->synchronized_set_map(*new_map); |
3565 | 3565 |
3566 object->set_properties(*dictionary); | 3566 object->set_properties(*dictionary); |
3567 | 3567 |
3568 // Ensure that in-object space of slow-mode object does not contain random | 3568 // Ensure that in-object space of slow-mode object does not contain random |
3569 // garbage. | 3569 // garbage. |
3570 int inobject_properties = new_map->GetInObjectProperties(); | 3570 int inobject_properties = new_map->GetInObjectProperties(); |
3571 for (int i = 0; i < inobject_properties; i++) { | 3571 if (inobject_properties) { |
3572 FieldIndex index = FieldIndex::ForPropertyIndex(*new_map, i); | 3572 Heap* heap = isolate->heap(); |
3573 object->RawFastPropertyAtPut(index, Smi::kZero); | 3573 heap->ClearRecordedSlotRange( |
| 3574 object->address() + map->GetInObjectPropertyOffset(0), |
| 3575 object->address() + new_instance_size); |
| 3576 |
| 3577 for (int i = 0; i < inobject_properties; i++) { |
| 3578 FieldIndex index = FieldIndex::ForPropertyIndex(*new_map, i); |
| 3579 object->RawFastPropertyAtPut(index, Smi::kZero); |
| 3580 } |
3574 } | 3581 } |
3575 | 3582 |
3576 isolate->counters()->props_to_dictionary()->Increment(); | 3583 isolate->counters()->props_to_dictionary()->Increment(); |
3577 | 3584 |
3578 #ifdef DEBUG | 3585 #ifdef DEBUG |
3579 if (FLAG_trace_normalization) { | 3586 if (FLAG_trace_normalization) { |
3580 OFStream os(stdout); | 3587 OFStream os(stdout); |
3581 os << "Object properties have been normalized:\n"; | 3588 os << "Object properties have been normalized:\n"; |
3582 object->Print(os); | 3589 object->Print(os); |
3583 } | 3590 } |
(...skipping 16851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
20435 // depend on this. | 20442 // depend on this. |
20436 return DICTIONARY_ELEMENTS; | 20443 return DICTIONARY_ELEMENTS; |
20437 } | 20444 } |
20438 DCHECK_LE(kind, LAST_ELEMENTS_KIND); | 20445 DCHECK_LE(kind, LAST_ELEMENTS_KIND); |
20439 return kind; | 20446 return kind; |
20440 } | 20447 } |
20441 } | 20448 } |
20442 | 20449 |
20443 } // namespace internal | 20450 } // namespace internal |
20444 } // namespace v8 | 20451 } // namespace v8 |
OLD | NEW |