OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
904 return ThrowArrayLengthRangeError(array->GetHeap()); | 904 return ThrowArrayLengthRangeError(array->GetHeap()); |
905 } | 905 } |
906 } | 906 } |
907 | 907 |
908 // Fall-back case: The new length is not a number so make the array | 908 // Fall-back case: The new length is not a number so make the array |
909 // size one and set only element to length. | 909 // size one and set only element to length. |
910 FixedArray* new_backing_store; | 910 FixedArray* new_backing_store; |
911 MaybeObject* maybe_obj = array->GetHeap()->AllocateFixedArray(1); | 911 MaybeObject* maybe_obj = array->GetHeap()->AllocateFixedArray(1); |
912 if (!maybe_obj->To(&new_backing_store)) return maybe_obj; | 912 if (!maybe_obj->To(&new_backing_store)) return maybe_obj; |
913 new_backing_store->set(0, length); | 913 new_backing_store->set(0, length); |
914 array->SetContent(new_backing_store); | 914 { MaybeObject* result = array->SetContent(new_backing_store); |
| 915 if (result->IsFailure()) return result; |
| 916 } |
915 return array; | 917 return array; |
916 } | 918 } |
917 | 919 |
918 | 920 |
919 } } // namespace v8::internal | 921 } } // namespace v8::internal |
OLD | NEW |