| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 5142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5153 JSArray* array = JSArray::cast(this); | 5153 JSArray* array = JSArray::cast(this); |
| 5154 Object* return_value = array->JSArrayUpdateLengthFromIndex(index, value); | 5154 Object* return_value = array->JSArrayUpdateLengthFromIndex(index, value); |
| 5155 if (return_value->IsFailure()) return return_value; | 5155 if (return_value->IsFailure()) return return_value; |
| 5156 } | 5156 } |
| 5157 | 5157 |
| 5158 // Attempt to put this object back in fast case. | 5158 // Attempt to put this object back in fast case. |
| 5159 if (ShouldConvertToFastElements()) { | 5159 if (ShouldConvertToFastElements()) { |
| 5160 uint32_t new_length = 0; | 5160 uint32_t new_length = 0; |
| 5161 if (IsJSArray()) { | 5161 if (IsJSArray()) { |
| 5162 CHECK(Array::IndexFromObject(JSArray::cast(this)->length(), &new_length)); | 5162 CHECK(Array::IndexFromObject(JSArray::cast(this)->length(), &new_length)); |
| 5163 JSArray::cast(this)->set_length(Smi::FromInt(new_length)); |
| 5163 } else { | 5164 } else { |
| 5164 new_length = Dictionary::cast(elements())->max_number_key() + 1; | 5165 new_length = Dictionary::cast(elements())->max_number_key() + 1; |
| 5165 } | 5166 } |
| 5166 Object* obj = Heap::AllocateFixedArrayWithHoles(new_length); | 5167 Object* obj = Heap::AllocateFixedArrayWithHoles(new_length); |
| 5167 if (obj->IsFailure()) return obj; | 5168 if (obj->IsFailure()) return obj; |
| 5168 SetFastElements(FixedArray::cast(obj)); | 5169 SetFastElements(FixedArray::cast(obj)); |
| 5169 #ifdef DEBUG | 5170 #ifdef DEBUG |
| 5170 if (FLAG_trace_normalization) { | 5171 if (FLAG_trace_normalization) { |
| 5171 PrintF("Object elements are fast case again:\n"); | 5172 PrintF("Object elements are fast case again:\n"); |
| 5172 Print(); | 5173 Print(); |
| (...skipping 1842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7015 // No break point. | 7016 // No break point. |
| 7016 if (break_point_objects()->IsUndefined()) return 0; | 7017 if (break_point_objects()->IsUndefined()) return 0; |
| 7017 // Single beak point. | 7018 // Single beak point. |
| 7018 if (!break_point_objects()->IsFixedArray()) return 1; | 7019 if (!break_point_objects()->IsFixedArray()) return 1; |
| 7019 // Multiple break points. | 7020 // Multiple break points. |
| 7020 return FixedArray::cast(break_point_objects())->length(); | 7021 return FixedArray::cast(break_point_objects())->length(); |
| 7021 } | 7022 } |
| 7022 | 7023 |
| 7023 | 7024 |
| 7024 } } // namespace v8::internal | 7025 } } // namespace v8::internal |
| OLD | NEW |