| 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 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 | 589 |
| 590 virtual ElementsKind kind() const V8_FINAL V8_OVERRIDE { | 590 virtual ElementsKind kind() const V8_FINAL V8_OVERRIDE { |
| 591 return ElementsTraits::Kind; | 591 return ElementsTraits::Kind; |
| 592 } | 592 } |
| 593 | 593 |
| 594 static void ValidateContents(Handle<JSObject> holder, int length) { | 594 static void ValidateContents(Handle<JSObject> holder, int length) { |
| 595 } | 595 } |
| 596 | 596 |
| 597 static void ValidateImpl(Handle<JSObject> holder) { | 597 static void ValidateImpl(Handle<JSObject> holder) { |
| 598 Handle<FixedArrayBase> fixed_array_base(holder->elements()); | 598 Handle<FixedArrayBase> fixed_array_base(holder->elements()); |
| 599 // When objects are first allocated, its elements are Failures. | |
| 600 if (fixed_array_base->IsFailure()) return; | |
| 601 if (!fixed_array_base->IsHeapObject()) return; | 599 if (!fixed_array_base->IsHeapObject()) return; |
| 602 // Arrays that have been shifted in place can't be verified. | 600 // Arrays that have been shifted in place can't be verified. |
| 603 if (fixed_array_base->IsFiller()) return; | 601 if (fixed_array_base->IsFiller()) return; |
| 604 int length = 0; | 602 int length = 0; |
| 605 if (holder->IsJSArray()) { | 603 if (holder->IsJSArray()) { |
| 606 Object* length_obj = Handle<JSArray>::cast(holder)->length(); | 604 Object* length_obj = Handle<JSArray>::cast(holder)->length(); |
| 607 if (length_obj->IsSmi()) { | 605 if (length_obj->IsSmi()) { |
| 608 length = Smi::cast(length_obj)->value(); | 606 length = Smi::cast(length_obj)->value(); |
| 609 } | 607 } |
| 610 } else { | 608 } else { |
| (...skipping 1405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2016 UNREACHABLE(); | 2014 UNREACHABLE(); |
| 2017 break; | 2015 break; |
| 2018 } | 2016 } |
| 2019 | 2017 |
| 2020 array->set_elements(*elms); | 2018 array->set_elements(*elms); |
| 2021 array->set_length(Smi::FromInt(number_of_elements)); | 2019 array->set_length(Smi::FromInt(number_of_elements)); |
| 2022 return array; | 2020 return array; |
| 2023 } | 2021 } |
| 2024 | 2022 |
| 2025 } } // namespace v8::internal | 2023 } } // namespace v8::internal |
| OLD | NEW |