| 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 8585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8596 indices->Add(index); | 8596 indices->Add(index); |
| 8597 } | 8597 } |
| 8598 } | 8598 } |
| 8599 } | 8599 } |
| 8600 break; | 8600 break; |
| 8601 } | 8601 } |
| 8602 default: { | 8602 default: { |
| 8603 int dense_elements_length; | 8603 int dense_elements_length; |
| 8604 switch (kind) { | 8604 switch (kind) { |
| 8605 case JSObject::EXTERNAL_PIXEL_ELEMENTS: { | 8605 case JSObject::EXTERNAL_PIXEL_ELEMENTS: { |
| 8606 dense_elements_length = | 8606 dense_elements_length = |
| 8607 ExternalPixelArray::cast(object->elements())->length(); | 8607 ExternalPixelArray::cast(object->elements())->length(); |
| 8608 break; | 8608 break; |
| 8609 } | 8609 } |
| 8610 case JSObject::EXTERNAL_BYTE_ELEMENTS: { | 8610 case JSObject::EXTERNAL_BYTE_ELEMENTS: { |
| 8611 dense_elements_length = | 8611 dense_elements_length = |
| 8612 ExternalByteArray::cast(object->elements())->length(); | 8612 ExternalByteArray::cast(object->elements())->length(); |
| 8613 break; | 8613 break; |
| 8614 } | 8614 } |
| 8615 case JSObject::EXTERNAL_UNSIGNED_BYTE_ELEMENTS: { | 8615 case JSObject::EXTERNAL_UNSIGNED_BYTE_ELEMENTS: { |
| 8616 dense_elements_length = | 8616 dense_elements_length = |
| 8617 ExternalUnsignedByteArray::cast(object->elements())->length(); | 8617 ExternalUnsignedByteArray::cast(object->elements())->length(); |
| 8618 break; | 8618 break; |
| 8619 } | 8619 } |
| 8620 case JSObject::EXTERNAL_SHORT_ELEMENTS: { | 8620 case JSObject::EXTERNAL_SHORT_ELEMENTS: { |
| 8621 dense_elements_length = | 8621 dense_elements_length = |
| 8622 ExternalShortArray::cast(object->elements())->length(); | 8622 ExternalShortArray::cast(object->elements())->length(); |
| 8623 break; | 8623 break; |
| 8624 } | 8624 } |
| 8625 case JSObject::EXTERNAL_UNSIGNED_SHORT_ELEMENTS: { | 8625 case JSObject::EXTERNAL_UNSIGNED_SHORT_ELEMENTS: { |
| 8626 dense_elements_length = | 8626 dense_elements_length = |
| 8627 ExternalUnsignedShortArray::cast(object->elements())->length(); | 8627 ExternalUnsignedShortArray::cast(object->elements())->length(); |
| 8628 break; | 8628 break; |
| 8629 } | 8629 } |
| 8630 case JSObject::EXTERNAL_INT_ELEMENTS: { | 8630 case JSObject::EXTERNAL_INT_ELEMENTS: { |
| 8631 dense_elements_length = | 8631 dense_elements_length = |
| 8632 ExternalIntArray::cast(object->elements())->length(); | 8632 ExternalIntArray::cast(object->elements())->length(); |
| 8633 break; | 8633 break; |
| 8634 } | 8634 } |
| 8635 case JSObject::EXTERNAL_UNSIGNED_INT_ELEMENTS: { | 8635 case JSObject::EXTERNAL_UNSIGNED_INT_ELEMENTS: { |
| 8636 dense_elements_length = | 8636 dense_elements_length = |
| 8637 ExternalUnsignedIntArray::cast(object->elements())->length(); | 8637 ExternalUnsignedIntArray::cast(object->elements())->length(); |
| 8638 break; | 8638 break; |
| 8639 } | 8639 } |
| 8640 case JSObject::EXTERNAL_FLOAT_ELEMENTS: { | 8640 case JSObject::EXTERNAL_FLOAT_ELEMENTS: { |
| 8641 dense_elements_length = | 8641 dense_elements_length = |
| 8642 ExternalFloatArray::cast(object->elements())->length(); | 8642 ExternalFloatArray::cast(object->elements())->length(); |
| 8643 break; |
| 8644 } |
| 8645 case JSObject::EXTERNAL_DOUBLE_ELEMENTS: { |
| 8646 dense_elements_length = |
| 8647 ExternalDoubleArray::cast(object->elements())->length(); |
| 8643 break; | 8648 break; |
| 8644 } | 8649 } |
| 8645 default: | 8650 default: |
| 8646 UNREACHABLE(); | 8651 UNREACHABLE(); |
| 8647 dense_elements_length = 0; | 8652 dense_elements_length = 0; |
| 8648 break; | 8653 break; |
| 8649 } | 8654 } |
| 8650 uint32_t length = static_cast<uint32_t>(dense_elements_length); | 8655 uint32_t length = static_cast<uint32_t>(dense_elements_length); |
| 8651 if (range <= length) { | 8656 if (range <= length) { |
| 8652 length = range; | 8657 length = range; |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8766 case JSObject::EXTERNAL_UNSIGNED_INT_ELEMENTS: { | 8771 case JSObject::EXTERNAL_UNSIGNED_INT_ELEMENTS: { |
| 8767 IterateExternalArrayElements<ExternalUnsignedIntArray, uint32_t>( | 8772 IterateExternalArrayElements<ExternalUnsignedIntArray, uint32_t>( |
| 8768 isolate, receiver, true, false, visitor); | 8773 isolate, receiver, true, false, visitor); |
| 8769 break; | 8774 break; |
| 8770 } | 8775 } |
| 8771 case JSObject::EXTERNAL_FLOAT_ELEMENTS: { | 8776 case JSObject::EXTERNAL_FLOAT_ELEMENTS: { |
| 8772 IterateExternalArrayElements<ExternalFloatArray, float>( | 8777 IterateExternalArrayElements<ExternalFloatArray, float>( |
| 8773 isolate, receiver, false, false, visitor); | 8778 isolate, receiver, false, false, visitor); |
| 8774 break; | 8779 break; |
| 8775 } | 8780 } |
| 8781 case JSObject::EXTERNAL_DOUBLE_ELEMENTS: { |
| 8782 IterateExternalArrayElements<ExternalDoubleArray, double>( |
| 8783 isolate, receiver, false, false, visitor); |
| 8784 break; |
| 8785 } |
| 8776 default: | 8786 default: |
| 8777 UNREACHABLE(); | 8787 UNREACHABLE(); |
| 8778 break; | 8788 break; |
| 8779 } | 8789 } |
| 8780 visitor->increase_index_offset(length); | 8790 visitor->increase_index_offset(length); |
| 8781 return true; | 8791 return true; |
| 8782 } | 8792 } |
| 8783 | 8793 |
| 8784 | 8794 |
| 8785 /** | 8795 /** |
| (...skipping 3189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11975 } else { | 11985 } else { |
| 11976 // Handle last resort GC and make sure to allow future allocations | 11986 // Handle last resort GC and make sure to allow future allocations |
| 11977 // to grow the heap without causing GCs (if possible). | 11987 // to grow the heap without causing GCs (if possible). |
| 11978 isolate->counters()->gc_last_resort_from_js()->Increment(); | 11988 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 11979 isolate->heap()->CollectAllGarbage(false); | 11989 isolate->heap()->CollectAllGarbage(false); |
| 11980 } | 11990 } |
| 11981 } | 11991 } |
| 11982 | 11992 |
| 11983 | 11993 |
| 11984 } } // namespace v8::internal | 11994 } } // namespace v8::internal |
| OLD | NEW |