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 3455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3466 | 3466 |
3467 PropertyDetails details = new_map->GetLastDescriptorDetails(); | 3467 PropertyDetails details = new_map->GetLastDescriptorDetails(); |
3468 int target_index = details.field_index() - new_map->GetInObjectProperties(); | 3468 int target_index = details.field_index() - new_map->GetInObjectProperties(); |
3469 bool have_space = old_map->unused_property_fields() > 0 || | 3469 bool have_space = old_map->unused_property_fields() > 0 || |
3470 (details.location() == kField && target_index >= 0 && | 3470 (details.location() == kField && target_index >= 0 && |
3471 object->properties()->length() > target_index); | 3471 object->properties()->length() > target_index); |
3472 // Either new_map adds an kDescriptor property, or a kField property for | 3472 // Either new_map adds an kDescriptor property, or a kField property for |
3473 // which there is still space, and which does not require a mutable double | 3473 // which there is still space, and which does not require a mutable double |
3474 // box (an out-of-object double). | 3474 // box (an out-of-object double). |
3475 if (details.location() == kDescriptor || | 3475 if (details.location() == kDescriptor || |
3476 (have_space && | 3476 (have_space && ((FLAG_unbox_double_fields && target_index < 0) || |
3477 ((FLAG_unbox_double_fields && object->properties()->length() == 0) || | 3477 !details.representation().IsDouble()))) { |
3478 !details.representation().IsDouble()))) { | |
3479 object->synchronized_set_map(*new_map); | 3478 object->synchronized_set_map(*new_map); |
3480 return; | 3479 return; |
3481 } | 3480 } |
3482 | 3481 |
3483 // If there is still space in the object, we need to allocate a mutable | 3482 // If there is still space in the object, we need to allocate a mutable |
3484 // double box. | 3483 // double box. |
3485 if (have_space) { | 3484 if (have_space) { |
3486 FieldIndex index = | 3485 FieldIndex index = |
3487 FieldIndex::ForDescriptor(*new_map, new_map->LastAdded()); | 3486 FieldIndex::ForDescriptor(*new_map, new_map->LastAdded()); |
3488 DCHECK(details.representation().IsDouble()); | 3487 DCHECK(details.representation().IsDouble()); |
(...skipping 17010 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
20499 // depend on this. | 20498 // depend on this. |
20500 return DICTIONARY_ELEMENTS; | 20499 return DICTIONARY_ELEMENTS; |
20501 } | 20500 } |
20502 DCHECK_LE(kind, LAST_ELEMENTS_KIND); | 20501 DCHECK_LE(kind, LAST_ELEMENTS_KIND); |
20503 return kind; | 20502 return kind; |
20504 } | 20503 } |
20505 } | 20504 } |
20506 | 20505 |
20507 } // namespace internal | 20506 } // namespace internal |
20508 } // namespace v8 | 20507 } // namespace v8 |
OLD | NEW |