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 1818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1829 Handle<NameDictionary> dict(object->property_dictionary()); | 1829 Handle<NameDictionary> dict(object->property_dictionary()); |
1830 if (object->IsGlobalObject()) { | 1830 if (object->IsGlobalObject()) { |
1831 // In case name is an orphaned property reuse the cell. | 1831 // In case name is an orphaned property reuse the cell. |
1832 int entry = dict->FindEntry(name); | 1832 int entry = dict->FindEntry(name); |
1833 if (entry != NameDictionary::kNotFound) { | 1833 if (entry != NameDictionary::kNotFound) { |
1834 Handle<PropertyCell> cell(PropertyCell::cast(dict->ValueAt(entry))); | 1834 Handle<PropertyCell> cell(PropertyCell::cast(dict->ValueAt(entry))); |
1835 PropertyCell::SetValueInferType(cell, value); | 1835 PropertyCell::SetValueInferType(cell, value); |
1836 // Assign an enumeration index to the property and update | 1836 // Assign an enumeration index to the property and update |
1837 // SetNextEnumerationIndex. | 1837 // SetNextEnumerationIndex. |
1838 int index = dict->NextEnumerationIndex(); | 1838 int index = dict->NextEnumerationIndex(); |
1839 PropertyDetails details = PropertyDetails(attributes, NORMAL, index); | 1839 PropertyDetails details(attributes, FIELD, index); |
1840 dict->SetNextEnumerationIndex(index + 1); | 1840 dict->SetNextEnumerationIndex(index + 1); |
1841 dict->SetEntry(entry, name, cell, details); | 1841 dict->SetEntry(entry, name, cell, details); |
1842 return; | 1842 return; |
1843 } | 1843 } |
1844 Handle<PropertyCell> cell = isolate->factory()->NewPropertyCell(value); | 1844 Handle<PropertyCell> cell = isolate->factory()->NewPropertyCell(value); |
1845 PropertyCell::SetValueInferType(cell, value); | 1845 PropertyCell::SetValueInferType(cell, value); |
1846 value = cell; | 1846 value = cell; |
1847 } | 1847 } |
1848 PropertyDetails details = PropertyDetails(attributes, NORMAL, 0); | 1848 PropertyDetails details(attributes, FIELD, 0); |
1849 Handle<NameDictionary> result = | 1849 Handle<NameDictionary> result = |
1850 NameDictionary::Add(dict, name, value, details); | 1850 NameDictionary::Add(dict, name, value, details); |
1851 if (*dict != *result) object->set_properties(*result); | 1851 if (*dict != *result) object->set_properties(*result); |
1852 } | 1852 } |
1853 | 1853 |
1854 | 1854 |
1855 Context* JSObject::GetCreationContext() { | 1855 Context* JSObject::GetCreationContext() { |
1856 Object* constructor = this->map()->constructor(); | 1856 Object* constructor = this->map()->constructor(); |
1857 JSFunction* function; | 1857 JSFunction* function; |
1858 if (!constructor->IsJSFunction()) { | 1858 if (!constructor->IsJSFunction()) { |
(...skipping 989 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2848 return MaybeHandle<Map>(); | 2848 return MaybeHandle<Map>(); |
2849 } | 2849 } |
2850 break; | 2850 break; |
2851 | 2851 |
2852 case CONSTANT: | 2852 case CONSTANT: |
2853 case CALLBACKS: | 2853 case CALLBACKS: |
2854 if (old_type != new_type || old_value != new_value) { | 2854 if (old_type != new_type || old_value != new_value) { |
2855 return MaybeHandle<Map>(); | 2855 return MaybeHandle<Map>(); |
2856 } | 2856 } |
2857 break; | 2857 break; |
2858 | |
2859 case NORMAL: | |
2860 UNREACHABLE(); | |
2861 } | 2858 } |
2862 } | 2859 } |
2863 if (new_map->NumberOfOwnDescriptors() != old_nof) return MaybeHandle<Map>(); | 2860 if (new_map->NumberOfOwnDescriptors() != old_nof) return MaybeHandle<Map>(); |
2864 return handle(new_map); | 2861 return handle(new_map); |
2865 } | 2862 } |
2866 | 2863 |
2867 | 2864 |
2868 MaybeHandle<Object> JSObject::SetPropertyWithInterceptor(LookupIterator* it, | 2865 MaybeHandle<Object> JSObject::SetPropertyWithInterceptor(LookupIterator* it, |
2869 Handle<Object> value) { | 2866 Handle<Object> value) { |
2870 // TODO(rossberg): Support symbols in the API. | 2867 // TODO(rossberg): Support symbols in the API. |
(...skipping 1469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4340 Handle<NameDictionary> dictionary = | 4337 Handle<NameDictionary> dictionary = |
4341 NameDictionary::New(isolate, property_count); | 4338 NameDictionary::New(isolate, property_count); |
4342 | 4339 |
4343 Handle<DescriptorArray> descs(map->instance_descriptors()); | 4340 Handle<DescriptorArray> descs(map->instance_descriptors()); |
4344 for (int i = 0; i < real_size; i++) { | 4341 for (int i = 0; i < real_size; i++) { |
4345 PropertyDetails details = descs->GetDetails(i); | 4342 PropertyDetails details = descs->GetDetails(i); |
4346 switch (details.type()) { | 4343 switch (details.type()) { |
4347 case CONSTANT: { | 4344 case CONSTANT: { |
4348 Handle<Name> key(descs->GetKey(i)); | 4345 Handle<Name> key(descs->GetKey(i)); |
4349 Handle<Object> value(descs->GetConstant(i), isolate); | 4346 Handle<Object> value(descs->GetConstant(i), isolate); |
4350 PropertyDetails d = PropertyDetails( | 4347 PropertyDetails d(details.attributes(), FIELD, i + 1); |
4351 details.attributes(), NORMAL, i + 1); | |
4352 dictionary = NameDictionary::Add(dictionary, key, value, d); | 4348 dictionary = NameDictionary::Add(dictionary, key, value, d); |
4353 break; | 4349 break; |
4354 } | 4350 } |
4355 case FIELD: { | 4351 case FIELD: { |
4356 Handle<Name> key(descs->GetKey(i)); | 4352 Handle<Name> key(descs->GetKey(i)); |
4357 FieldIndex index = FieldIndex::ForDescriptor(*map, i); | 4353 FieldIndex index = FieldIndex::ForDescriptor(*map, i); |
4358 Handle<Object> value; | 4354 Handle<Object> value; |
4359 if (object->IsUnboxedDoubleField(index)) { | 4355 if (object->IsUnboxedDoubleField(index)) { |
4360 double old_value = object->RawFastDoublePropertyAt(index); | 4356 double old_value = object->RawFastDoublePropertyAt(index); |
4361 value = isolate->factory()->NewHeapNumber(old_value); | 4357 value = isolate->factory()->NewHeapNumber(old_value); |
4362 } else { | 4358 } else { |
4363 value = handle(object->RawFastPropertyAt(index), isolate); | 4359 value = handle(object->RawFastPropertyAt(index), isolate); |
4364 if (details.representation().IsDouble()) { | 4360 if (details.representation().IsDouble()) { |
4365 DCHECK(value->IsMutableHeapNumber()); | 4361 DCHECK(value->IsMutableHeapNumber()); |
4366 Handle<HeapNumber> old = Handle<HeapNumber>::cast(value); | 4362 Handle<HeapNumber> old = Handle<HeapNumber>::cast(value); |
4367 value = isolate->factory()->NewHeapNumber(old->value()); | 4363 value = isolate->factory()->NewHeapNumber(old->value()); |
4368 } | 4364 } |
4369 } | 4365 } |
4370 PropertyDetails d = | 4366 PropertyDetails d(details.attributes(), FIELD, i + 1); |
4371 PropertyDetails(details.attributes(), NORMAL, i + 1); | |
4372 dictionary = NameDictionary::Add(dictionary, key, value, d); | 4367 dictionary = NameDictionary::Add(dictionary, key, value, d); |
4373 break; | 4368 break; |
4374 } | 4369 } |
4375 case CALLBACKS: { | 4370 case CALLBACKS: { |
4376 Handle<Name> key(descs->GetKey(i)); | 4371 Handle<Name> key(descs->GetKey(i)); |
4377 Handle<Object> value(descs->GetCallbacksObject(i), isolate); | 4372 Handle<Object> value(descs->GetCallbacksObject(i), isolate); |
4378 PropertyDetails d = PropertyDetails( | 4373 PropertyDetails d(details.attributes(), CALLBACKS, i + 1); |
4379 details.attributes(), CALLBACKS, i + 1); | |
4380 dictionary = NameDictionary::Add(dictionary, key, value, d); | 4374 dictionary = NameDictionary::Add(dictionary, key, value, d); |
4381 break; | 4375 break; |
4382 } | 4376 } |
4383 case NORMAL: | |
4384 UNREACHABLE(); | |
4385 break; | |
4386 } | 4377 } |
4387 } | 4378 } |
4388 | 4379 |
4389 // Copy the next enumeration index from instance descriptor. | 4380 // Copy the next enumeration index from instance descriptor. |
4390 dictionary->SetNextEnumerationIndex(real_size + 1); | 4381 dictionary->SetNextEnumerationIndex(real_size + 1); |
4391 | 4382 |
4392 // From here on we cannot fail and we shouldn't GC anymore. | 4383 // From here on we cannot fail and we shouldn't GC anymore. |
4393 DisallowHeapAllocation no_allocation; | 4384 DisallowHeapAllocation no_allocation; |
4394 | 4385 |
4395 // Resize the object in the heap if necessary. | 4386 // Resize the object in the heap if necessary. |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4448 int instance_descriptor_length = iteration_order->length(); | 4439 int instance_descriptor_length = iteration_order->length(); |
4449 int number_of_fields = 0; | 4440 int number_of_fields = 0; |
4450 | 4441 |
4451 // Compute the length of the instance descriptor. | 4442 // Compute the length of the instance descriptor. |
4452 for (int i = 0; i < instance_descriptor_length; i++) { | 4443 for (int i = 0; i < instance_descriptor_length; i++) { |
4453 int index = Smi::cast(iteration_order->get(i))->value(); | 4444 int index = Smi::cast(iteration_order->get(i))->value(); |
4454 DCHECK(dictionary->IsKey(dictionary->KeyAt(index))); | 4445 DCHECK(dictionary->IsKey(dictionary->KeyAt(index))); |
4455 | 4446 |
4456 Object* value = dictionary->ValueAt(index); | 4447 Object* value = dictionary->ValueAt(index); |
4457 PropertyType type = dictionary->DetailsAt(index).type(); | 4448 PropertyType type = dictionary->DetailsAt(index).type(); |
4458 DCHECK(type != FIELD); | 4449 if (type == FIELD && !value->IsJSFunction()) { |
4459 if (type == NORMAL && !value->IsJSFunction()) { | |
4460 number_of_fields += 1; | 4450 number_of_fields += 1; |
4461 } | 4451 } |
4462 } | 4452 } |
4463 | 4453 |
4464 int inobject_props = object->map()->inobject_properties(); | 4454 int inobject_props = object->map()->inobject_properties(); |
4465 | 4455 |
4466 // Allocate new map. | 4456 // Allocate new map. |
4467 Handle<Map> new_map = Map::CopyDropDescriptors(handle(object->map())); | 4457 Handle<Map> new_map = Map::CopyDropDescriptors(handle(object->map())); |
4468 new_map->set_dictionary_map(false); | 4458 new_map->set_dictionary_map(false); |
4469 | 4459 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4520 key = factory->InternalizeString(handle(String::cast(k))); | 4510 key = factory->InternalizeString(handle(String::cast(k))); |
4521 } | 4511 } |
4522 | 4512 |
4523 PropertyDetails details = dictionary->DetailsAt(index); | 4513 PropertyDetails details = dictionary->DetailsAt(index); |
4524 int enumeration_index = details.dictionary_index(); | 4514 int enumeration_index = details.dictionary_index(); |
4525 PropertyType type = details.type(); | 4515 PropertyType type = details.type(); |
4526 | 4516 |
4527 if (value->IsJSFunction()) { | 4517 if (value->IsJSFunction()) { |
4528 ConstantDescriptor d(key, handle(value, isolate), details.attributes()); | 4518 ConstantDescriptor d(key, handle(value, isolate), details.attributes()); |
4529 descriptors->Set(enumeration_index - 1, &d); | 4519 descriptors->Set(enumeration_index - 1, &d); |
4530 } else if (type == NORMAL) { | 4520 } else if (type == FIELD) { |
4531 if (current_offset < inobject_props) { | 4521 if (current_offset < inobject_props) { |
4532 object->InObjectPropertyAtPut(current_offset, value, | 4522 object->InObjectPropertyAtPut(current_offset, value, |
4533 UPDATE_WRITE_BARRIER); | 4523 UPDATE_WRITE_BARRIER); |
4534 } else { | 4524 } else { |
4535 int offset = current_offset - inobject_props; | 4525 int offset = current_offset - inobject_props; |
4536 fields->set(offset, value); | 4526 fields->set(offset, value); |
4537 } | 4527 } |
4538 FieldDescriptor d(key, current_offset, details.attributes(), | 4528 FieldDescriptor d(key, current_offset, details.attributes(), |
4539 // TODO(verwaest): value->OptimalRepresentation(); | 4529 // TODO(verwaest): value->OptimalRepresentation(); |
4540 Representation::Tagged()); | 4530 Representation::Tagged()); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4596 Handle<FixedDoubleArray>::cast(array); | 4586 Handle<FixedDoubleArray>::cast(array); |
4597 if (double_array->is_the_hole(i)) { | 4587 if (double_array->is_the_hole(i)) { |
4598 value = factory->the_hole_value(); | 4588 value = factory->the_hole_value(); |
4599 } else { | 4589 } else { |
4600 value = factory->NewHeapNumber(double_array->get_scalar(i)); | 4590 value = factory->NewHeapNumber(double_array->get_scalar(i)); |
4601 } | 4591 } |
4602 } else { | 4592 } else { |
4603 value = handle(Handle<FixedArray>::cast(array)->get(i), isolate); | 4593 value = handle(Handle<FixedArray>::cast(array)->get(i), isolate); |
4604 } | 4594 } |
4605 if (!value->IsTheHole()) { | 4595 if (!value->IsTheHole()) { |
4606 PropertyDetails details = PropertyDetails(NONE, NORMAL, 0); | 4596 PropertyDetails details(NONE, FIELD, 0); |
4607 dictionary = | 4597 dictionary = |
4608 SeededNumberDictionary::AddNumberEntry(dictionary, i, value, details); | 4598 SeededNumberDictionary::AddNumberEntry(dictionary, i, value, details); |
4609 } | 4599 } |
4610 } | 4600 } |
4611 return dictionary; | 4601 return dictionary; |
4612 } | 4602 } |
4613 | 4603 |
4614 | 4604 |
4615 Handle<SeededNumberDictionary> JSObject::NormalizeElements( | 4605 Handle<SeededNumberDictionary> JSObject::NormalizeElements( |
4616 Handle<JSObject> object) { | 4606 Handle<JSObject> object) { |
(...skipping 2381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6998 return value->FitsRepresentation(details.representation()) && | 6988 return value->FitsRepresentation(details.representation()) && |
6999 GetFieldType(descriptor)->NowContains(value); | 6989 GetFieldType(descriptor)->NowContains(value); |
7000 | 6990 |
7001 case CONSTANT: | 6991 case CONSTANT: |
7002 DCHECK(GetConstant(descriptor) != value || | 6992 DCHECK(GetConstant(descriptor) != value || |
7003 value->FitsRepresentation(details.representation())); | 6993 value->FitsRepresentation(details.representation())); |
7004 return GetConstant(descriptor) == value; | 6994 return GetConstant(descriptor) == value; |
7005 | 6995 |
7006 case CALLBACKS: | 6996 case CALLBACKS: |
7007 return false; | 6997 return false; |
7008 | |
7009 case NORMAL: | |
7010 UNREACHABLE(); | |
7011 break; | |
7012 } | 6998 } |
7013 | 6999 |
7014 UNREACHABLE(); | 7000 UNREACHABLE(); |
7015 return false; | 7001 return false; |
7016 } | 7002 } |
7017 | 7003 |
7018 | 7004 |
7019 Handle<Map> Map::PrepareForDataProperty(Handle<Map> map, int descriptor, | 7005 Handle<Map> Map::PrepareForDataProperty(Handle<Map> map, int descriptor, |
7020 Handle<Object> value) { | 7006 Handle<Object> value) { |
7021 // Dictionaries can store any property value. | 7007 // Dictionaries can store any property value. |
(...skipping 5379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12401 PropertyDetails details = dictionary->DetailsAt(entry); | 12387 PropertyDetails details = dictionary->DetailsAt(entry); |
12402 if (details.type() == CALLBACKS && set_mode == SET_PROPERTY) { | 12388 if (details.type() == CALLBACKS && set_mode == SET_PROPERTY) { |
12403 return SetElementWithCallback(object, element, index, value, object, | 12389 return SetElementWithCallback(object, element, index, value, object, |
12404 strict_mode); | 12390 strict_mode); |
12405 } else { | 12391 } else { |
12406 dictionary->UpdateMaxNumberKey(index); | 12392 dictionary->UpdateMaxNumberKey(index); |
12407 // If a value has not been initialized we allow writing to it even if it | 12393 // If a value has not been initialized we allow writing to it even if it |
12408 // is read-only (a declared const that has not been initialized). If a | 12394 // is read-only (a declared const that has not been initialized). If a |
12409 // value is being defined we skip attribute checks completely. | 12395 // value is being defined we skip attribute checks completely. |
12410 if (set_mode == DEFINE_PROPERTY) { | 12396 if (set_mode == DEFINE_PROPERTY) { |
12411 details = PropertyDetails( | 12397 details = |
12412 attributes, NORMAL, details.dictionary_index()); | 12398 PropertyDetails(attributes, FIELD, details.dictionary_index()); |
12413 dictionary->DetailsAtPut(entry, details); | 12399 dictionary->DetailsAtPut(entry, details); |
12414 } else if (details.IsReadOnly() && !element->IsTheHole()) { | 12400 } else if (details.IsReadOnly() && !element->IsTheHole()) { |
12415 if (strict_mode == SLOPPY) { | 12401 if (strict_mode == SLOPPY) { |
12416 return isolate->factory()->undefined_value(); | 12402 return isolate->factory()->undefined_value(); |
12417 } else { | 12403 } else { |
12418 Handle<Object> number = isolate->factory()->NewNumberFromUint(index); | 12404 Handle<Object> number = isolate->factory()->NewNumberFromUint(index); |
12419 Handle<Object> args[2] = { number, object }; | 12405 Handle<Object> args[2] = { number, object }; |
12420 THROW_NEW_ERROR(isolate, NewTypeError("strict_read_only_property", | 12406 THROW_NEW_ERROR(isolate, NewTypeError("strict_read_only_property", |
12421 HandleVector(args, 2)), | 12407 HandleVector(args, 2)), |
12422 Object); | 12408 Object); |
(...skipping 30 matching lines...) Expand all Loading... |
12453 } else { | 12439 } else { |
12454 Handle<Object> number = isolate->factory()->NewNumberFromUint(index); | 12440 Handle<Object> number = isolate->factory()->NewNumberFromUint(index); |
12455 Handle<String> name = isolate->factory()->NumberToString(number); | 12441 Handle<String> name = isolate->factory()->NumberToString(number); |
12456 Handle<Object> args[1] = { name }; | 12442 Handle<Object> args[1] = { name }; |
12457 THROW_NEW_ERROR(isolate, NewTypeError("object_not_extensible", | 12443 THROW_NEW_ERROR(isolate, NewTypeError("object_not_extensible", |
12458 HandleVector(args, 1)), | 12444 HandleVector(args, 1)), |
12459 Object); | 12445 Object); |
12460 } | 12446 } |
12461 } | 12447 } |
12462 | 12448 |
12463 PropertyDetails details = PropertyDetails(attributes, NORMAL, 0); | 12449 PropertyDetails details(attributes, FIELD, 0); |
12464 Handle<SeededNumberDictionary> new_dictionary = | 12450 Handle<SeededNumberDictionary> new_dictionary = |
12465 SeededNumberDictionary::AddNumberEntry(dictionary, index, value, | 12451 SeededNumberDictionary::AddNumberEntry(dictionary, index, value, |
12466 details); | 12452 details); |
12467 if (*dictionary != *new_dictionary) { | 12453 if (*dictionary != *new_dictionary) { |
12468 if (is_arguments) { | 12454 if (is_arguments) { |
12469 elements->set(1, *new_dictionary); | 12455 elements->set(1, *new_dictionary); |
12470 } else { | 12456 } else { |
12471 object->set_elements(*new_dictionary); | 12457 object->set_elements(*new_dictionary); |
12472 } | 12458 } |
12473 dictionary = new_dictionary; | 12459 dictionary = new_dictionary; |
(...skipping 2111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14585 return bailout; | 14571 return bailout; |
14586 } else { | 14572 } else { |
14587 Handle<Object> result = SeededNumberDictionary::AddNumberEntry( | 14573 Handle<Object> result = SeededNumberDictionary::AddNumberEntry( |
14588 new_dict, key, value, details); | 14574 new_dict, key, value, details); |
14589 DCHECK(result.is_identical_to(new_dict)); | 14575 DCHECK(result.is_identical_to(new_dict)); |
14590 USE(result); | 14576 USE(result); |
14591 } | 14577 } |
14592 } | 14578 } |
14593 | 14579 |
14594 uint32_t result = pos; | 14580 uint32_t result = pos; |
14595 PropertyDetails no_details = PropertyDetails(NONE, NORMAL, 0); | 14581 PropertyDetails no_details(NONE, FIELD, 0); |
14596 while (undefs > 0) { | 14582 while (undefs > 0) { |
14597 if (pos > static_cast<uint32_t>(Smi::kMaxValue)) { | 14583 if (pos > static_cast<uint32_t>(Smi::kMaxValue)) { |
14598 // Adding an entry with the key beyond smi-range requires | 14584 // Adding an entry with the key beyond smi-range requires |
14599 // allocation. Bailout. | 14585 // allocation. Bailout. |
14600 return bailout; | 14586 return bailout; |
14601 } | 14587 } |
14602 HandleScope scope(isolate); | 14588 HandleScope scope(isolate); |
14603 Handle<Object> result = SeededNumberDictionary::AddNumberEntry( | 14589 Handle<Object> result = SeededNumberDictionary::AddNumberEntry( |
14604 new_dict, pos, isolate->factory()->undefined_value(), no_details); | 14590 new_dict, pos, isolate->factory()->undefined_value(), no_details); |
14605 DCHECK(result.is_identical_to(new_dict)); | 14591 DCHECK(result.is_identical_to(new_dict)); |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14971 | 14957 |
14972 Handle<PropertyCell> JSGlobalObject::EnsurePropertyCell( | 14958 Handle<PropertyCell> JSGlobalObject::EnsurePropertyCell( |
14973 Handle<JSGlobalObject> global, | 14959 Handle<JSGlobalObject> global, |
14974 Handle<Name> name) { | 14960 Handle<Name> name) { |
14975 DCHECK(!global->HasFastProperties()); | 14961 DCHECK(!global->HasFastProperties()); |
14976 int entry = global->property_dictionary()->FindEntry(name); | 14962 int entry = global->property_dictionary()->FindEntry(name); |
14977 if (entry == NameDictionary::kNotFound) { | 14963 if (entry == NameDictionary::kNotFound) { |
14978 Isolate* isolate = global->GetIsolate(); | 14964 Isolate* isolate = global->GetIsolate(); |
14979 Handle<PropertyCell> cell = isolate->factory()->NewPropertyCell( | 14965 Handle<PropertyCell> cell = isolate->factory()->NewPropertyCell( |
14980 isolate->factory()->the_hole_value()); | 14966 isolate->factory()->the_hole_value()); |
14981 PropertyDetails details(NONE, NORMAL, 0); | 14967 PropertyDetails details(NONE, FIELD, 0); |
14982 details = details.AsDeleted(); | 14968 details = details.AsDeleted(); |
14983 Handle<NameDictionary> dictionary = NameDictionary::Add( | 14969 Handle<NameDictionary> dictionary = NameDictionary::Add( |
14984 handle(global->property_dictionary()), name, cell, details); | 14970 handle(global->property_dictionary()), name, cell, details); |
14985 global->set_properties(*dictionary); | 14971 global->set_properties(*dictionary); |
14986 return cell; | 14972 return cell; |
14987 } else { | 14973 } else { |
14988 Object* value = global->property_dictionary()->ValueAt(entry); | 14974 Object* value = global->property_dictionary()->ValueAt(entry); |
14989 DCHECK(value->IsPropertyCell()); | 14975 DCHECK(value->IsPropertyCell()); |
14990 return handle(PropertyCell::cast(value)); | 14976 return handle(PropertyCell::cast(value)); |
14991 } | 14977 } |
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15451 if (entry != Dictionary::kNotFound) { | 15437 if (entry != Dictionary::kNotFound) { |
15452 dictionary->ValueAtPut(entry, *value); | 15438 dictionary->ValueAtPut(entry, *value); |
15453 return dictionary; | 15439 return dictionary; |
15454 } | 15440 } |
15455 | 15441 |
15456 // Check whether the dictionary should be extended. | 15442 // Check whether the dictionary should be extended. |
15457 dictionary = EnsureCapacity(dictionary, 1, key); | 15443 dictionary = EnsureCapacity(dictionary, 1, key); |
15458 #ifdef DEBUG | 15444 #ifdef DEBUG |
15459 USE(Shape::AsHandle(dictionary->GetIsolate(), key)); | 15445 USE(Shape::AsHandle(dictionary->GetIsolate(), key)); |
15460 #endif | 15446 #endif |
15461 PropertyDetails details = PropertyDetails(NONE, NORMAL, 0); | 15447 PropertyDetails details(NONE, FIELD, 0); |
15462 | 15448 |
15463 AddEntry(dictionary, key, value, details, dictionary->Hash(key)); | 15449 AddEntry(dictionary, key, value, details, dictionary->Hash(key)); |
15464 return dictionary; | 15450 return dictionary; |
15465 } | 15451 } |
15466 | 15452 |
15467 | 15453 |
15468 template<typename Derived, typename Shape, typename Key> | 15454 template<typename Derived, typename Shape, typename Key> |
15469 Handle<Derived> Dictionary<Derived, Shape, Key>::Add( | 15455 Handle<Derived> Dictionary<Derived, Shape, Key>::Add( |
15470 Handle<Derived> dictionary, | 15456 Handle<Derived> dictionary, |
15471 Key key, | 15457 Key key, |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15539 SLOW_DCHECK(dictionary->FindEntry(key) == kNotFound); | 15525 SLOW_DCHECK(dictionary->FindEntry(key) == kNotFound); |
15540 return Add(dictionary, key, value, details); | 15526 return Add(dictionary, key, value, details); |
15541 } | 15527 } |
15542 | 15528 |
15543 | 15529 |
15544 Handle<UnseededNumberDictionary> UnseededNumberDictionary::AddNumberEntry( | 15530 Handle<UnseededNumberDictionary> UnseededNumberDictionary::AddNumberEntry( |
15545 Handle<UnseededNumberDictionary> dictionary, | 15531 Handle<UnseededNumberDictionary> dictionary, |
15546 uint32_t key, | 15532 uint32_t key, |
15547 Handle<Object> value) { | 15533 Handle<Object> value) { |
15548 SLOW_DCHECK(dictionary->FindEntry(key) == kNotFound); | 15534 SLOW_DCHECK(dictionary->FindEntry(key) == kNotFound); |
15549 return Add(dictionary, key, value, PropertyDetails(NONE, NORMAL, 0)); | 15535 return Add(dictionary, key, value, PropertyDetails(NONE, FIELD, 0)); |
15550 } | 15536 } |
15551 | 15537 |
15552 | 15538 |
15553 Handle<SeededNumberDictionary> SeededNumberDictionary::AtNumberPut( | 15539 Handle<SeededNumberDictionary> SeededNumberDictionary::AtNumberPut( |
15554 Handle<SeededNumberDictionary> dictionary, | 15540 Handle<SeededNumberDictionary> dictionary, |
15555 uint32_t key, | 15541 uint32_t key, |
15556 Handle<Object> value) { | 15542 Handle<Object> value) { |
15557 dictionary->UpdateMaxNumberKey(key); | 15543 dictionary->UpdateMaxNumberKey(key); |
15558 return AtPut(dictionary, key, value); | 15544 return AtPut(dictionary, key, value); |
15559 } | 15545 } |
(...skipping 1283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16843 Handle<DependentCode> codes = | 16829 Handle<DependentCode> codes = |
16844 DependentCode::Insert(handle(cell->dependent_code(), info->isolate()), | 16830 DependentCode::Insert(handle(cell->dependent_code(), info->isolate()), |
16845 DependentCode::kPropertyCellChangedGroup, | 16831 DependentCode::kPropertyCellChangedGroup, |
16846 info->object_wrapper()); | 16832 info->object_wrapper()); |
16847 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); | 16833 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); |
16848 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( | 16834 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( |
16849 cell, info->zone()); | 16835 cell, info->zone()); |
16850 } | 16836 } |
16851 | 16837 |
16852 } } // namespace v8::internal | 16838 } } // namespace v8::internal |
OLD | NEW |