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 9424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9435 return Failure::InternalError(); | 9435 return Failure::InternalError(); |
9436 | 9436 |
9437 // TODO(adamk): This loop can be very slow for arrays in dictionary mode. | 9437 // TODO(adamk): This loop can be very slow for arrays in dictionary mode. |
9438 // Find another way to iterate over arrays with dictionary elements. | 9438 // Find another way to iterate over arrays with dictionary elements. |
9439 for (uint32_t i = old_length - 1; i + 1 > new_length; --i) { | 9439 for (uint32_t i = old_length - 1; i + 1 > new_length; --i) { |
9440 PropertyAttributes attributes = self->GetLocalElementAttribute(i); | 9440 PropertyAttributes attributes = self->GetLocalElementAttribute(i); |
9441 if (attributes == ABSENT) continue; | 9441 if (attributes == ABSENT) continue; |
9442 // A non-configurable property will cause the truncation operation to | 9442 // A non-configurable property will cause the truncation operation to |
9443 // stop at this index. | 9443 // stop at this index. |
9444 if (attributes == DONT_DELETE) break; | 9444 if (attributes == DONT_DELETE) break; |
9445 // TODO(adamk): Don't fetch the old value if it's an accessor. | 9445 old_values.Add( |
9446 old_values.Add(Object::GetElement(self, i)); | 9446 self->GetLocalElementAccessorPair(i) == NULL |
| 9447 ? Object::GetElement(self, i) |
| 9448 : Handle<Object>::cast(isolate->factory()->the_hole_value())); |
9447 indices.Add(isolate->factory()->Uint32ToString(i)); | 9449 indices.Add(isolate->factory()->Uint32ToString(i)); |
9448 } | 9450 } |
9449 | 9451 |
9450 MaybeObject* result = | 9452 MaybeObject* result = |
9451 self->GetElementsAccessor()->SetLength(*self, *new_length_handle); | 9453 self->GetElementsAccessor()->SetLength(*self, *new_length_handle); |
9452 Handle<Object> hresult; | 9454 Handle<Object> hresult; |
9453 if (!result->ToHandle(&hresult, isolate)) return result; | 9455 if (!result->ToHandle(&hresult, isolate)) return result; |
9454 | 9456 |
9455 CHECK(self->length()->ToArrayIndex(&new_length)); | 9457 CHECK(self->length()->ToArrayIndex(&new_length)); |
9456 if (old_length != new_length) { | 9458 if (old_length != new_length) { |
(...skipping 4428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13885 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); | 13887 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); |
13886 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); | 13888 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); |
13887 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); | 13889 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); |
13888 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); | 13890 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); |
13889 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); | 13891 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); |
13890 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); | 13892 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); |
13891 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); | 13893 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); |
13892 } | 13894 } |
13893 | 13895 |
13894 } } // namespace v8::internal | 13896 } } // namespace v8::internal |
OLD | NEW |