| 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 3733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3744 &attributes)->ToObjectUnchecked(); | 3744 &attributes)->ToObjectUnchecked(); |
| 3745 if (!lookup->IsUndefined()) { | 3745 if (!lookup->IsUndefined()) { |
| 3746 return StringDictionary::cast(lookup); | 3746 return StringDictionary::cast(lookup); |
| 3747 } | 3747 } |
| 3748 } | 3748 } |
| 3749 if (!create_if_absent) return GetHeap()->undefined_value(); | 3749 if (!create_if_absent) return GetHeap()->undefined_value(); |
| 3750 const int kInitialSize = 5; | 3750 const int kInitialSize = 5; |
| 3751 MaybeObject* dict_alloc = StringDictionary::Allocate(kInitialSize); | 3751 MaybeObject* dict_alloc = StringDictionary::Allocate(kInitialSize); |
| 3752 StringDictionary* dictionary; | 3752 StringDictionary* dictionary; |
| 3753 if (!dict_alloc->To<StringDictionary>(&dictionary)) return dict_alloc; | 3753 if (!dict_alloc->To<StringDictionary>(&dictionary)) return dict_alloc; |
| 3754 MaybeObject* store_result = | 3754 // Using AddProperty or SetPropertyPostInterceptor here could fail, because |
| 3755 SetPropertyPostInterceptor(GetHeap()->hidden_symbol(), | 3755 // object might be non-extensible. |
| 3756 dictionary, | 3756 return HasFastProperties() |
| 3757 DONT_ENUM, | 3757 ? AddFastProperty(GetHeap()->hidden_symbol(), dictionary, DONT_ENUM) |
| 3758 kNonStrictMode); | 3758 : AddSlowProperty(GetHeap()->hidden_symbol(), dictionary, DONT_ENUM); |
| 3759 if (store_result->IsFailure()) return store_result; | |
| 3760 return dictionary; | |
| 3761 } | 3759 } |
| 3762 | 3760 |
| 3763 | 3761 |
| 3764 MaybeObject* JSObject::SetHiddenPropertiesDictionary( | 3762 MaybeObject* JSObject::SetHiddenPropertiesDictionary( |
| 3765 StringDictionary* dictionary) { | 3763 StringDictionary* dictionary) { |
| 3766 ASSERT(!IsJSGlobalProxy()); | 3764 ASSERT(!IsJSGlobalProxy()); |
| 3767 ASSERT(HasHiddenProperties()); | 3765 ASSERT(HasHiddenProperties()); |
| 3768 if (HasFastProperties()) { | 3766 if (HasFastProperties()) { |
| 3769 // If the object has fast properties, check whether the first slot | 3767 // If the object has fast properties, check whether the first slot |
| 3770 // in the descriptor array matches the hidden symbol. Since the | 3768 // in the descriptor array matches the hidden symbol. Since the |
| (...skipping 9194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12965 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); | 12963 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); |
| 12966 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); | 12964 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); |
| 12967 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); | 12965 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); |
| 12968 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); | 12966 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); |
| 12969 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); | 12967 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); |
| 12970 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); | 12968 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); |
| 12971 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); | 12969 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); |
| 12972 } | 12970 } |
| 12973 | 12971 |
| 12974 } } // namespace v8::internal | 12972 } } // namespace v8::internal |
| OLD | NEW |