| 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 // Restore raw pointers, | 115 // Restore raw pointers, |
| 116 object = *object_handle; | 116 object = *object_handle; |
| 117 value = *value_handle; | 117 value = *value_handle; |
| 118 | 118 |
| 119 if (uint32_v->Number() == number_v->Number()) { | 119 if (uint32_v->Number() == number_v->Number()) { |
| 120 if (object->IsJSArray()) { | 120 if (object->IsJSArray()) { |
| 121 return JSArray::cast(object)->SetElementsLength(*uint32_v); | 121 return JSArray::cast(object)->SetElementsLength(*uint32_v); |
| 122 } else { | 122 } else { |
| 123 // This means one of the object's prototypes is a JSArray and | 123 // This means one of the object's prototypes is a JSArray and |
| 124 // the object does not have a 'length' property. | 124 // the object does not have a 'length' property. |
| 125 return object->AddProperty(Heap::length_symbol(), value, NONE); | 125 // Calling SetProperty causes an infinite loop. |
| 126 return object->IgnoreAttributesAndSetLocalProperty(Heap::length_symbol(), |
| 127 value, NONE); |
| 126 } | 128 } |
| 127 } | 129 } |
| 128 | |
| 129 return Top::Throw(*Factory::NewRangeError("invalid_array_length", | 130 return Top::Throw(*Factory::NewRangeError("invalid_array_length", |
| 130 HandleVector<Object>(NULL, 0))); | 131 HandleVector<Object>(NULL, 0))); |
| 131 } | 132 } |
| 132 | 133 |
| 133 | 134 |
| 134 const AccessorDescriptor Accessors::ArrayLength = { | 135 const AccessorDescriptor Accessors::ArrayLength = { |
| 135 ArrayGetLength, | 136 ArrayGetLength, |
| 136 ArraySetLength, | 137 ArraySetLength, |
| 137 0 | 138 0 |
| 138 }; | 139 }; |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 } | 500 } |
| 500 | 501 |
| 501 | 502 |
| 502 const AccessorDescriptor Accessors::ObjectPrototype = { | 503 const AccessorDescriptor Accessors::ObjectPrototype = { |
| 503 ObjectGetPrototype, | 504 ObjectGetPrototype, |
| 504 ObjectSetPrototype, | 505 ObjectSetPrototype, |
| 505 0 | 506 0 |
| 506 }; | 507 }; |
| 507 | 508 |
| 508 } } // namespace v8::internal | 509 } } // namespace v8::internal |
| OLD | NEW |