| 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 3531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3542 | 3542 |
| 3543 // We are storing the new map using release store after creating a filler for | 3543 // We are storing the new map using release store after creating a filler for |
| 3544 // the left-over space to avoid races with the sweeper thread. | 3544 // the left-over space to avoid races with the sweeper thread. |
| 3545 object->synchronized_set_map(*new_map); | 3545 object->synchronized_set_map(*new_map); |
| 3546 | 3546 |
| 3547 object->set_properties(*dictionary); | 3547 object->set_properties(*dictionary); |
| 3548 | 3548 |
| 3549 // Ensure that in-object space of slow-mode object does not contain random | 3549 // Ensure that in-object space of slow-mode object does not contain random |
| 3550 // garbage. | 3550 // garbage. |
| 3551 int inobject_properties = new_map->GetInObjectProperties(); | 3551 int inobject_properties = new_map->GetInObjectProperties(); |
| 3552 for (int i = 0; i < inobject_properties; i++) { | 3552 if (inobject_properties) { |
| 3553 FieldIndex index = FieldIndex::ForPropertyIndex(*new_map, i); | 3553 Heap* heap = isolate->heap(); |
| 3554 object->RawFastPropertyAtPut(index, Smi::kZero); | 3554 heap->ClearRecordedSlotRange( |
| 3555 object->address() + map->GetInObjectPropertyOffset(0), |
| 3556 object->address() + new_instance_size); |
| 3557 |
| 3558 for (int i = 0; i < inobject_properties; i++) { |
| 3559 FieldIndex index = FieldIndex::ForPropertyIndex(*new_map, i); |
| 3560 object->RawFastPropertyAtPut(index, Smi::kZero); |
| 3561 } |
| 3555 } | 3562 } |
| 3556 | 3563 |
| 3557 isolate->counters()->props_to_dictionary()->Increment(); | 3564 isolate->counters()->props_to_dictionary()->Increment(); |
| 3558 | 3565 |
| 3559 #ifdef DEBUG | 3566 #ifdef DEBUG |
| 3560 if (FLAG_trace_normalization) { | 3567 if (FLAG_trace_normalization) { |
| 3561 OFStream os(stdout); | 3568 OFStream os(stdout); |
| 3562 os << "Object properties have been normalized:\n"; | 3569 os << "Object properties have been normalized:\n"; |
| 3563 object->Print(os); | 3570 object->Print(os); |
| 3564 } | 3571 } |
| (...skipping 16849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 20414 // depend on this. | 20421 // depend on this. |
| 20415 return DICTIONARY_ELEMENTS; | 20422 return DICTIONARY_ELEMENTS; |
| 20416 } | 20423 } |
| 20417 DCHECK_LE(kind, LAST_ELEMENTS_KIND); | 20424 DCHECK_LE(kind, LAST_ELEMENTS_KIND); |
| 20418 return kind; | 20425 return kind; |
| 20419 } | 20426 } |
| 20420 } | 20427 } |
| 20421 | 20428 |
| 20422 } // namespace internal | 20429 } // namespace internal |
| 20423 } // namespace v8 | 20430 } // namespace v8 |
| OLD | NEW |