OLD | NEW |
---|---|
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 <sstream> | 5 #include <sstream> |
6 | 6 |
7 #include "src/v8.h" | 7 #include "src/v8.h" |
8 | 8 |
9 #include "src/accessors.h" | 9 #include "src/accessors.h" |
10 #include "src/allocation-site-scopes.h" | 10 #include "src/allocation-site-scopes.h" |
(...skipping 2453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2464 Handle<DescriptorArray> old_descriptors( | 2464 Handle<DescriptorArray> old_descriptors( |
2465 old_map->instance_descriptors(), isolate); | 2465 old_map->instance_descriptors(), isolate); |
2466 int old_nof = old_map->NumberOfOwnDescriptors(); | 2466 int old_nof = old_map->NumberOfOwnDescriptors(); |
2467 PropertyDetails old_details = old_descriptors->GetDetails(modify_index); | 2467 PropertyDetails old_details = old_descriptors->GetDetails(modify_index); |
2468 Representation old_representation = old_details.representation(); | 2468 Representation old_representation = old_details.representation(); |
2469 | 2469 |
2470 // It's fine to transition from None to anything but double without any | 2470 // It's fine to transition from None to anything but double without any |
2471 // modification to the object, because the default uninitialized value for | 2471 // modification to the object, because the default uninitialized value for |
2472 // representation None can be overwritten by both smi and tagged values. | 2472 // representation None can be overwritten by both smi and tagged values. |
2473 // Doubles, however, would require a box allocation. | 2473 // Doubles, however, would require a box allocation. |
2474 if (old_representation.IsNone() && | 2474 // Note that if the map has transitions that do not share descriptors we |
2475 !new_representation.IsNone() && | 2475 // can't use this shortcut because field type and representation must be |
2476 !new_representation.IsDouble()) { | 2476 // updated in all the transitions from this map. |
2477 if (old_representation.IsNone() && !new_representation.IsNone() && | |
2478 !new_representation.IsDouble() && | |
2479 (!old_map->HasTransitionArray() || | |
2480 old_map->transitions()->IsSimpleTransition())) { | |
Toon Verwaest
2014/11/12 22:52:48
What about instead updating the fieldtype in the e
Igor Sheludko
2014/11/13 10:00:41
Done, thanks!
| |
2477 DCHECK(old_details.type() == FIELD); | 2481 DCHECK(old_details.type() == FIELD); |
2478 DCHECK(old_descriptors->GetFieldType(modify_index)->NowIs( | 2482 DCHECK(old_descriptors->GetFieldType(modify_index)->NowIs( |
2479 HeapType::None())); | 2483 HeapType::None())); |
2480 if (FLAG_trace_generalization) { | 2484 if (FLAG_trace_generalization) { |
2481 old_map->PrintGeneralization( | 2485 old_map->PrintGeneralization( |
2482 stdout, "uninitialized field", | 2486 stdout, "uninitialized field", |
2483 modify_index, old_map->NumberOfOwnDescriptors(), | 2487 modify_index, old_map->NumberOfOwnDescriptors(), |
2484 old_map->NumberOfOwnDescriptors(), false, | 2488 old_map->NumberOfOwnDescriptors(), false, |
2485 old_representation, new_representation, | 2489 old_representation, new_representation, |
2486 old_descriptors->GetFieldType(modify_index), *new_field_type); | 2490 old_descriptors->GetFieldType(modify_index), *new_field_type); |
(...skipping 14285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
16772 Handle<DependentCode> codes = | 16776 Handle<DependentCode> codes = |
16773 DependentCode::Insert(handle(cell->dependent_code(), info->isolate()), | 16777 DependentCode::Insert(handle(cell->dependent_code(), info->isolate()), |
16774 DependentCode::kPropertyCellChangedGroup, | 16778 DependentCode::kPropertyCellChangedGroup, |
16775 info->object_wrapper()); | 16779 info->object_wrapper()); |
16776 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); | 16780 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); |
16777 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( | 16781 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( |
16778 cell, info->zone()); | 16782 cell, info->zone()); |
16779 } | 16783 } |
16780 | 16784 |
16781 } } // namespace v8::internal | 16785 } } // namespace v8::internal |
OLD | NEW |