| OLD | NEW |
| 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 5220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5231 | 5231 |
| 5232 static Object* ArrayLengthRangeError() { | 5232 static Object* ArrayLengthRangeError() { |
| 5233 HandleScope scope; | 5233 HandleScope scope; |
| 5234 return Top::Throw(*Factory::NewRangeError("invalid_array_length", | 5234 return Top::Throw(*Factory::NewRangeError("invalid_array_length", |
| 5235 HandleVector<Object>(NULL, 0))); | 5235 HandleVector<Object>(NULL, 0))); |
| 5236 } | 5236 } |
| 5237 | 5237 |
| 5238 | 5238 |
| 5239 Object* JSObject::SetElementsLength(Object* len) { | 5239 Object* JSObject::SetElementsLength(Object* len) { |
| 5240 // We should never end in here with a pixel or external array. | 5240 // We should never end in here with a pixel or external array. |
| 5241 ASSERT(AllowsSetElementsLength()); | 5241 ASSERT(!HasPixelElements() && !HasExternalArrayElements()); |
| 5242 | 5242 |
| 5243 Object* smi_length = len->ToSmi(); | 5243 Object* smi_length = len->ToSmi(); |
| 5244 if (smi_length->IsSmi()) { | 5244 if (smi_length->IsSmi()) { |
| 5245 int value = Smi::cast(smi_length)->value(); | 5245 int value = Smi::cast(smi_length)->value(); |
| 5246 if (value < 0) return ArrayLengthRangeError(); | 5246 if (value < 0) return ArrayLengthRangeError(); |
| 5247 switch (GetElementsKind()) { | 5247 switch (GetElementsKind()) { |
| 5248 case FAST_ELEMENTS: { | 5248 case FAST_ELEMENTS: { |
| 5249 int old_capacity = FixedArray::cast(elements())->length(); | 5249 int old_capacity = FixedArray::cast(elements())->length(); |
| 5250 if (value <= old_capacity) { | 5250 if (value <= old_capacity) { |
| 5251 if (IsJSArray()) { | 5251 if (IsJSArray()) { |
| (...skipping 3042 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8294 if (break_point_objects()->IsUndefined()) return 0; | 8294 if (break_point_objects()->IsUndefined()) return 0; |
| 8295 // Single beak point. | 8295 // Single beak point. |
| 8296 if (!break_point_objects()->IsFixedArray()) return 1; | 8296 if (!break_point_objects()->IsFixedArray()) return 1; |
| 8297 // Multiple break points. | 8297 // Multiple break points. |
| 8298 return FixedArray::cast(break_point_objects())->length(); | 8298 return FixedArray::cast(break_point_objects())->length(); |
| 8299 } | 8299 } |
| 8300 #endif | 8300 #endif |
| 8301 | 8301 |
| 8302 | 8302 |
| 8303 } } // namespace v8::internal | 8303 } } // namespace v8::internal |
| OLD | NEW |