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 <iomanip> | 5 #include <iomanip> |
6 #include <sstream> | 6 #include <sstream> |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/accessors.h" | 10 #include "src/accessors.h" |
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
558 enumeration_index = original_details.dictionary_index(); | 558 enumeration_index = original_details.dictionary_index(); |
559 DCHECK(enumeration_index > 0); | 559 DCHECK(enumeration_index > 0); |
560 } | 560 } |
561 | 561 |
562 details = PropertyDetails( | 562 details = PropertyDetails( |
563 details.attributes(), details.type(), enumeration_index); | 563 details.attributes(), details.type(), enumeration_index); |
564 | 564 |
565 if (object->IsGlobalObject()) { | 565 if (object->IsGlobalObject()) { |
566 Handle<PropertyCell> cell( | 566 Handle<PropertyCell> cell( |
567 PropertyCell::cast(property_dictionary->ValueAt(entry))); | 567 PropertyCell::cast(property_dictionary->ValueAt(entry))); |
568 PropertyCell::SetValueInferType(cell, value); | 568 if (details.type() != property_dictionary->DetailsAt(entry).type()) { |
| 569 Isolate* isolate = object->GetIsolate(); |
| 570 Handle<Object> hole = isolate->factory()->the_hole_value(); |
| 571 PropertyCell::SetValueInferType(cell, hole); |
| 572 cell = isolate->factory()->NewPropertyCell(value); |
| 573 property_dictionary->SetEntry(entry, name, cell, details); |
| 574 } else { |
| 575 PropertyCell::SetValueInferType(cell, value); |
| 576 } |
569 // Please note we have to update the property details. | 577 // Please note we have to update the property details. |
570 property_dictionary->DetailsAtPut(entry, details); | 578 property_dictionary->DetailsAtPut(entry, details); |
571 } else { | 579 } else { |
572 property_dictionary->SetEntry(entry, name, value, details); | 580 property_dictionary->SetEntry(entry, name, value, details); |
573 } | 581 } |
574 } | 582 } |
575 | 583 |
576 | 584 |
577 static MaybeHandle<JSObject> FindIndexedAllCanReadHolder( | 585 static MaybeHandle<JSObject> FindIndexedAllCanReadHolder( |
578 Isolate* isolate, Handle<JSObject> js_object, | 586 Isolate* isolate, Handle<JSObject> js_object, |
(...skipping 6825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7404 | 7412 |
7405 | 7413 |
7406 Handle<Map> Map::TransitionToAccessorProperty(Handle<Map> map, | 7414 Handle<Map> Map::TransitionToAccessorProperty(Handle<Map> map, |
7407 Handle<Name> name, | 7415 Handle<Name> name, |
7408 AccessorComponent component, | 7416 AccessorComponent component, |
7409 Handle<Object> accessor, | 7417 Handle<Object> accessor, |
7410 PropertyAttributes attributes) { | 7418 PropertyAttributes attributes) { |
7411 Isolate* isolate = name->GetIsolate(); | 7419 Isolate* isolate = name->GetIsolate(); |
7412 | 7420 |
7413 // Dictionary maps can always have additional data properties. | 7421 // Dictionary maps can always have additional data properties. |
7414 if (map->is_dictionary_map()) { | 7422 if (map->is_dictionary_map()) return map; |
7415 // For global objects, property cells are inlined. We need to change the | |
7416 // map. | |
7417 if (map->IsGlobalObjectMap()) return Copy(map, "GlobalAccessor"); | |
7418 return map; | |
7419 } | |
7420 | 7423 |
7421 // Migrate to the newest map before transitioning to the new property. | 7424 // Migrate to the newest map before transitioning to the new property. |
7422 map = Update(map); | 7425 map = Update(map); |
7423 | 7426 |
7424 PropertyNormalizationMode mode = map->is_prototype_map() | 7427 PropertyNormalizationMode mode = map->is_prototype_map() |
7425 ? KEEP_INOBJECT_PROPERTIES | 7428 ? KEEP_INOBJECT_PROPERTIES |
7426 : CLEAR_INOBJECT_PROPERTIES; | 7429 : CLEAR_INOBJECT_PROPERTIES; |
7427 | 7430 |
7428 int index = map->SearchTransition(kAccessor, *name, attributes); | 7431 int index = map->SearchTransition(kAccessor, *name, attributes); |
7429 if (index != TransitionArray::kNotFound) { | 7432 if (index != TransitionArray::kNotFound) { |
(...skipping 9706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
17136 CompilationInfo* info) { | 17139 CompilationInfo* info) { |
17137 Handle<DependentCode> codes = DependentCode::InsertCompilationInfo( | 17140 Handle<DependentCode> codes = DependentCode::InsertCompilationInfo( |
17138 handle(cell->dependent_code(), info->isolate()), | 17141 handle(cell->dependent_code(), info->isolate()), |
17139 DependentCode::kPropertyCellChangedGroup, info->object_wrapper()); | 17142 DependentCode::kPropertyCellChangedGroup, info->object_wrapper()); |
17140 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); | 17143 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); |
17141 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( | 17144 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( |
17142 cell, info->zone()); | 17145 cell, info->zone()); |
17143 } | 17146 } |
17144 | 17147 |
17145 } } // namespace v8::internal | 17148 } } // namespace v8::internal |
OLD | NEW |