| 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 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 } | 496 } |
| 497 | 497 |
| 498 static void ValidateImpl(JSObject* holder) { | 498 static void ValidateImpl(JSObject* holder) { |
| 499 FixedArrayBase* fixed_array_base = holder->elements(); | 499 FixedArrayBase* fixed_array_base = holder->elements(); |
| 500 // When objects are first allocated, its elements are Failures. | 500 // When objects are first allocated, its elements are Failures. |
| 501 if (fixed_array_base->IsFailure()) return; | 501 if (fixed_array_base->IsFailure()) return; |
| 502 if (!fixed_array_base->IsHeapObject()) return; | 502 if (!fixed_array_base->IsHeapObject()) return; |
| 503 Map* map = fixed_array_base->map(); | 503 Map* map = fixed_array_base->map(); |
| 504 // Arrays that have been shifted in place can't be verified. | 504 // Arrays that have been shifted in place can't be verified. |
| 505 Heap* heap = holder->GetHeap(); | 505 Heap* heap = holder->GetHeap(); |
| 506 if (map == heap->raw_unchecked_one_pointer_filler_map() || | 506 if (map == heap->one_pointer_filler_map() || |
| 507 map == heap->raw_unchecked_two_pointer_filler_map() || | 507 map == heap->two_pointer_filler_map() || |
| 508 map == heap->free_space_map()) { | 508 map == heap->free_space_map()) { |
| 509 return; | 509 return; |
| 510 } | 510 } |
| 511 int length = 0; | 511 int length = 0; |
| 512 if (holder->IsJSArray()) { | 512 if (holder->IsJSArray()) { |
| 513 Object* length_obj = JSArray::cast(holder)->length(); | 513 Object* length_obj = JSArray::cast(holder)->length(); |
| 514 if (length_obj->IsSmi()) { | 514 if (length_obj->IsSmi()) { |
| 515 length = Smi::cast(length_obj)->value(); | 515 length = Smi::cast(length_obj)->value(); |
| 516 } | 516 } |
| 517 } else { | 517 } else { |
| (...skipping 1162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1680 if (!maybe_obj->To(&new_backing_store)) return maybe_obj; | 1680 if (!maybe_obj->To(&new_backing_store)) return maybe_obj; |
| 1681 new_backing_store->set(0, length); | 1681 new_backing_store->set(0, length); |
| 1682 { MaybeObject* result = array->SetContent(new_backing_store); | 1682 { MaybeObject* result = array->SetContent(new_backing_store); |
| 1683 if (result->IsFailure()) return result; | 1683 if (result->IsFailure()) return result; |
| 1684 } | 1684 } |
| 1685 return array; | 1685 return array; |
| 1686 } | 1686 } |
| 1687 | 1687 |
| 1688 | 1688 |
| 1689 } } // namespace v8::internal | 1689 } } // namespace v8::internal |
| OLD | NEW |