| 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 "src/objects.h" | 5 #include "src/objects.h" |
| 6 | 6 |
| 7 #include <iomanip> | 7 #include <iomanip> |
| 8 #include <sstream> | 8 #include <sstream> |
| 9 | 9 |
| 10 #include "src/accessors.h" | 10 #include "src/accessors.h" |
| (...skipping 4786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4797 // Allocate the fixed array for the fields. | 4797 // Allocate the fixed array for the fields. |
| 4798 Handle<FixedArray> fields = factory->NewFixedArray( | 4798 Handle<FixedArray> fields = factory->NewFixedArray( |
| 4799 number_of_allocated_fields); | 4799 number_of_allocated_fields); |
| 4800 | 4800 |
| 4801 // Fill in the instance descriptor and the fields. | 4801 // Fill in the instance descriptor and the fields. |
| 4802 int current_offset = 0; | 4802 int current_offset = 0; |
| 4803 for (int i = 0; i < instance_descriptor_length; i++) { | 4803 for (int i = 0; i < instance_descriptor_length; i++) { |
| 4804 int index = Smi::cast(iteration_order->get(i))->value(); | 4804 int index = Smi::cast(iteration_order->get(i))->value(); |
| 4805 Object* k = dictionary->KeyAt(index); | 4805 Object* k = dictionary->KeyAt(index); |
| 4806 DCHECK(dictionary->IsKey(k)); | 4806 DCHECK(dictionary->IsKey(k)); |
| 4807 // Dictionary keys are internalized upon insertion. |
| 4808 // TODO(jkummerow): Turn this into a DCHECK if it's not hit in the wild. |
| 4809 CHECK(k->IsUniqueName()); |
| 4810 Handle<Name> key(Name::cast(k), isolate); |
| 4807 | 4811 |
| 4808 Object* value = dictionary->ValueAt(index); | 4812 Object* value = dictionary->ValueAt(index); |
| 4809 Handle<Name> key; | |
| 4810 if (k->IsSymbol()) { | |
| 4811 key = handle(Symbol::cast(k)); | |
| 4812 } else { | |
| 4813 // Ensure the key is a unique name before writing into the | |
| 4814 // instance descriptor. | |
| 4815 key = factory->InternalizeString(handle(String::cast(k))); | |
| 4816 } | |
| 4817 | 4813 |
| 4818 PropertyDetails details = dictionary->DetailsAt(index); | 4814 PropertyDetails details = dictionary->DetailsAt(index); |
| 4819 int enumeration_index = details.dictionary_index(); | 4815 int enumeration_index = details.dictionary_index(); |
| 4820 PropertyType type = details.type(); | 4816 PropertyType type = details.type(); |
| 4821 | 4817 |
| 4822 if (value->IsJSFunction()) { | 4818 if (value->IsJSFunction()) { |
| 4823 DataConstantDescriptor d(key, handle(value, isolate), | 4819 DataConstantDescriptor d(key, handle(value, isolate), |
| 4824 details.attributes()); | 4820 details.attributes()); |
| 4825 descriptors->Set(enumeration_index - 1, &d); | 4821 descriptors->Set(enumeration_index - 1, &d); |
| 4826 } else if (type == DATA) { | 4822 } else if (type == DATA) { |
| (...skipping 11337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16164 if (cell->value() != *new_value) { | 16160 if (cell->value() != *new_value) { |
| 16165 cell->set_value(*new_value); | 16161 cell->set_value(*new_value); |
| 16166 Isolate* isolate = cell->GetIsolate(); | 16162 Isolate* isolate = cell->GetIsolate(); |
| 16167 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 16163 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
| 16168 isolate, DependentCode::kPropertyCellChangedGroup); | 16164 isolate, DependentCode::kPropertyCellChangedGroup); |
| 16169 } | 16165 } |
| 16170 } | 16166 } |
| 16171 | 16167 |
| 16172 } // namespace internal | 16168 } // namespace internal |
| 16173 } // namespace v8 | 16169 } // namespace v8 |
| OLD | NEW |