| 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 10289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10300 SeededNumberDictionary* dictionary; | 10300 SeededNumberDictionary* dictionary; |
| 10301 MaybeObject* maybe_object = NormalizeElements(); | 10301 MaybeObject* maybe_object = NormalizeElements(); |
| 10302 if (!maybe_object->To(&dictionary)) return maybe_object; | 10302 if (!maybe_object->To(&dictionary)) return maybe_object; |
| 10303 // Make sure that we never go back to fast case. | 10303 // Make sure that we never go back to fast case. |
| 10304 dictionary->set_requires_slow_elements(); | 10304 dictionary->set_requires_slow_elements(); |
| 10305 } | 10305 } |
| 10306 | 10306 |
| 10307 // From here on, everything has to be handlified. | 10307 // From here on, everything has to be handlified. |
| 10308 Handle<String> name; | 10308 Handle<String> name; |
| 10309 Handle<Object> old_value(isolate->heap()->the_hole_value()); | 10309 Handle<Object> old_value(isolate->heap()->the_hole_value()); |
| 10310 Handle<Object> old_array_length; |
| 10310 PropertyAttributes old_attributes = ABSENT; | 10311 PropertyAttributes old_attributes = ABSENT; |
| 10311 bool preexists = false; | 10312 bool preexists = false; |
| 10312 if (FLAG_harmony_observation && map()->is_observed()) { | 10313 if (FLAG_harmony_observation && map()->is_observed()) { |
| 10313 name = isolate->factory()->Uint32ToString(index); | 10314 name = isolate->factory()->Uint32ToString(index); |
| 10314 preexists = self->HasLocalElement(index); | 10315 preexists = self->HasLocalElement(index); |
| 10315 if (preexists) { | 10316 if (preexists) { |
| 10316 old_attributes = self->GetLocalPropertyAttribute(*name); | 10317 old_attributes = self->GetLocalPropertyAttribute(*name); |
| 10317 // TODO(observe): only read & set old_value if we have a data property | 10318 // TODO(observe): only read & set old_value if we have a data property |
| 10318 old_value = Object::GetElement(self, index); | 10319 old_value = Object::GetElement(self, index); |
| 10320 } else if (self->IsJSArray()) { |
| 10321 // Store old array length in case adding an element grows the array. |
| 10322 old_array_length = handle(Handle<JSArray>::cast(self)->length()); |
| 10319 } | 10323 } |
| 10320 } | 10324 } |
| 10321 | 10325 |
| 10322 // Check for lookup interceptor | 10326 // Check for lookup interceptor |
| 10323 MaybeObject* result = self->HasIndexedInterceptor() | 10327 MaybeObject* result = self->HasIndexedInterceptor() |
| 10324 ? self->SetElementWithInterceptor( | 10328 ? self->SetElementWithInterceptor( |
| 10325 index, *value, attributes, strict_mode, check_prototype, set_mode) | 10329 index, *value, attributes, strict_mode, check_prototype, set_mode) |
| 10326 : self->SetElementWithoutInterceptor( | 10330 : self->SetElementWithoutInterceptor( |
| 10327 index, *value, attributes, strict_mode, check_prototype, set_mode); | 10331 index, *value, attributes, strict_mode, check_prototype, set_mode); |
| 10328 | 10332 |
| 10329 Handle<Object> hresult; | 10333 Handle<Object> hresult; |
| 10330 if (!result->ToHandle(&hresult)) return result; | 10334 if (!result->ToHandle(&hresult)) return result; |
| 10331 | 10335 |
| 10332 if (FLAG_harmony_observation && map()->is_observed()) { | 10336 if (FLAG_harmony_observation && map()->is_observed()) { |
| 10333 PropertyAttributes new_attributes = self->GetLocalPropertyAttribute(*name); | 10337 PropertyAttributes new_attributes = self->GetLocalPropertyAttribute(*name); |
| 10334 if (!preexists) { | 10338 if (!preexists) { |
| 10335 EnqueueChangeRecord(self, "new", name, old_value); | 10339 EnqueueChangeRecord(self, "new", name, old_value); |
| 10340 if (self->IsJSArray() && |
| 10341 !old_array_length->SameValue(Handle<JSArray>::cast(self)->length())) { |
| 10342 EnqueueChangeRecord(self, "updated", |
| 10343 isolate->factory()->length_symbol(), |
| 10344 old_array_length); |
| 10345 } |
| 10336 } else if (new_attributes != old_attributes || old_value->IsTheHole()) { | 10346 } else if (new_attributes != old_attributes || old_value->IsTheHole()) { |
| 10337 EnqueueChangeRecord(self, "reconfigured", name, old_value); | 10347 EnqueueChangeRecord(self, "reconfigured", name, old_value); |
| 10338 } else { | 10348 } else { |
| 10339 Handle<Object> newValue = Object::GetElement(self, index); | 10349 Handle<Object> new_value = Object::GetElement(self, index); |
| 10340 if (!newValue->SameValue(*old_value)) | 10350 if (!new_value->SameValue(*old_value)) |
| 10341 EnqueueChangeRecord(self, "updated", name, old_value); | 10351 EnqueueChangeRecord(self, "updated", name, old_value); |
| 10342 } | 10352 } |
| 10343 } | 10353 } |
| 10344 | 10354 |
| 10345 return *hresult; | 10355 return *hresult; |
| 10346 } | 10356 } |
| 10347 | 10357 |
| 10348 | 10358 |
| 10349 MaybeObject* JSObject::SetElementWithoutInterceptor(uint32_t index, | 10359 MaybeObject* JSObject::SetElementWithoutInterceptor(uint32_t index, |
| 10350 Object* value, | 10360 Object* value, |
| (...skipping 3496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13847 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); | 13857 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); |
| 13848 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); | 13858 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); |
| 13849 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); | 13859 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); |
| 13850 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); | 13860 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); |
| 13851 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); | 13861 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); |
| 13852 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); | 13862 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); |
| 13853 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); | 13863 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); |
| 13854 } | 13864 } |
| 13855 | 13865 |
| 13856 } } // namespace v8::internal | 13866 } } // namespace v8::internal |
| OLD | NEW |