OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 4694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4705 | 4705 |
4706 | 4706 |
4707 MaybeObject* JSObject::DefinePropertyAccessor(String* name, | 4707 MaybeObject* JSObject::DefinePropertyAccessor(String* name, |
4708 Object* getter, | 4708 Object* getter, |
4709 Object* setter, | 4709 Object* setter, |
4710 PropertyAttributes attributes) { | 4710 PropertyAttributes attributes) { |
4711 // We could assert that the property is configurable here, but we would need | 4711 // We could assert that the property is configurable here, but we would need |
4712 // to do a lookup, which seems to be a bit of overkill. | 4712 // to do a lookup, which seems to be a bit of overkill. |
4713 Heap* heap = GetHeap(); | 4713 Heap* heap = GetHeap(); |
4714 bool only_attribute_changes = getter->IsNull() && setter->IsNull(); | 4714 bool only_attribute_changes = getter->IsNull() && setter->IsNull(); |
4715 if (HasFastProperties() && !only_attribute_changes) { | 4715 if (HasFastProperties() && !only_attribute_changes && |
| 4716 (map()->NumberOfOwnDescriptors() < |
| 4717 DescriptorArray::kMaxNumberOfDescriptors)) { |
4716 MaybeObject* getterOk = heap->undefined_value(); | 4718 MaybeObject* getterOk = heap->undefined_value(); |
4717 if (!getter->IsNull()) { | 4719 if (!getter->IsNull()) { |
4718 getterOk = DefineFastAccessor(name, ACCESSOR_GETTER, getter, attributes); | 4720 getterOk = DefineFastAccessor(name, ACCESSOR_GETTER, getter, attributes); |
4719 if (getterOk->IsFailure()) return getterOk; | 4721 if (getterOk->IsFailure()) return getterOk; |
4720 } | 4722 } |
4721 | 4723 |
4722 MaybeObject* setterOk = heap->undefined_value(); | 4724 MaybeObject* setterOk = heap->undefined_value(); |
4723 if (getterOk != heap->null_value() && !setter->IsNull()) { | 4725 if (getterOk != heap->null_value() && !setter->IsNull()) { |
4724 setterOk = DefineFastAccessor(name, ACCESSOR_SETTER, setter, attributes); | 4726 setterOk = DefineFastAccessor(name, ACCESSOR_SETTER, setter, attributes); |
4725 if (setterOk->IsFailure()) return setterOk; | 4727 if (setterOk->IsFailure()) return setterOk; |
(...skipping 9132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13858 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); | 13860 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); |
13859 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); | 13861 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); |
13860 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); | 13862 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); |
13861 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); | 13863 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); |
13862 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); | 13864 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); |
13863 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); | 13865 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); |
13864 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); | 13866 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); |
13865 } | 13867 } |
13866 | 13868 |
13867 } } // namespace v8::internal | 13869 } } // namespace v8::internal |
OLD | NEW |