OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 1623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1634 case FIXED_DOUBLE_ARRAY_TYPE: | 1634 case FIXED_DOUBLE_ARRAY_TYPE: |
1635 accumulator->Add("<FixedDoubleArray[%u]>", | 1635 accumulator->Add("<FixedDoubleArray[%u]>", |
1636 FixedDoubleArray::cast(this)->length()); | 1636 FixedDoubleArray::cast(this)->length()); |
1637 break; | 1637 break; |
1638 case BYTE_ARRAY_TYPE: | 1638 case BYTE_ARRAY_TYPE: |
1639 accumulator->Add("<ByteArray[%u]>", ByteArray::cast(this)->length()); | 1639 accumulator->Add("<ByteArray[%u]>", ByteArray::cast(this)->length()); |
1640 break; | 1640 break; |
1641 case FREE_SPACE_TYPE: | 1641 case FREE_SPACE_TYPE: |
1642 accumulator->Add("<FreeSpace[%u]>", FreeSpace::cast(this)->Size()); | 1642 accumulator->Add("<FreeSpace[%u]>", FreeSpace::cast(this)->Size()); |
1643 break; | 1643 break; |
1644 case EXTERNAL_PIXEL_ARRAY_TYPE: | 1644 #define TYPED_ARRAY_SHORT_PRINT(Type, type, TYPE, ctype, size) \ |
1645 accumulator->Add("<ExternalPixelArray[%u]>", | 1645 case EXTERNAL_##TYPE##_ARRAY_TYPE: \ |
1646 ExternalPixelArray::cast(this)->length()); | 1646 accumulator->Add("<External" #Type "Array[%u]>", \ |
| 1647 External##Type##Array::cast(this)->length()); \ |
| 1648 break; \ |
| 1649 case FIXED_##TYPE##_ARRAY_TYPE: \ |
| 1650 accumulator->Add("<Fixed" #Type "Array[%u]>", \ |
| 1651 Fixed##Type##Array::cast(this)->length()); \ |
1647 break; | 1652 break; |
1648 case EXTERNAL_BYTE_ARRAY_TYPE: | 1653 |
1649 accumulator->Add("<ExternalByteArray[%u]>", | 1654 TYPED_ARRAYS(TYPED_ARRAY_SHORT_PRINT) |
1650 ExternalByteArray::cast(this)->length()); | 1655 #undef TYPED_ARRAY_SHORT_PRINT |
1651 break; | 1656 |
1652 case EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE: | |
1653 accumulator->Add("<ExternalUnsignedByteArray[%u]>", | |
1654 ExternalUnsignedByteArray::cast(this)->length()); | |
1655 break; | |
1656 case EXTERNAL_SHORT_ARRAY_TYPE: | |
1657 accumulator->Add("<ExternalShortArray[%u]>", | |
1658 ExternalShortArray::cast(this)->length()); | |
1659 break; | |
1660 case EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE: | |
1661 accumulator->Add("<ExternalUnsignedShortArray[%u]>", | |
1662 ExternalUnsignedShortArray::cast(this)->length()); | |
1663 break; | |
1664 case EXTERNAL_INT_ARRAY_TYPE: | |
1665 accumulator->Add("<ExternalIntArray[%u]>", | |
1666 ExternalIntArray::cast(this)->length()); | |
1667 break; | |
1668 case EXTERNAL_UNSIGNED_INT_ARRAY_TYPE: | |
1669 accumulator->Add("<ExternalUnsignedIntArray[%u]>", | |
1670 ExternalUnsignedIntArray::cast(this)->length()); | |
1671 break; | |
1672 case EXTERNAL_FLOAT_ARRAY_TYPE: | |
1673 accumulator->Add("<ExternalFloatArray[%u]>", | |
1674 ExternalFloatArray::cast(this)->length()); | |
1675 break; | |
1676 case EXTERNAL_DOUBLE_ARRAY_TYPE: | |
1677 accumulator->Add("<ExternalDoubleArray[%u]>", | |
1678 ExternalDoubleArray::cast(this)->length()); | |
1679 break; | |
1680 case FIXED_UINT8_ARRAY_TYPE: | |
1681 accumulator->Add("<FixedUint8Array[%u]>", | |
1682 FixedUint8Array::cast(this)->length()); | |
1683 break; | |
1684 case SHARED_FUNCTION_INFO_TYPE: { | 1657 case SHARED_FUNCTION_INFO_TYPE: { |
1685 SharedFunctionInfo* shared = SharedFunctionInfo::cast(this); | 1658 SharedFunctionInfo* shared = SharedFunctionInfo::cast(this); |
1686 SmartArrayPointer<char> debug_name = | 1659 SmartArrayPointer<char> debug_name = |
1687 shared->DebugName()->ToCString(); | 1660 shared->DebugName()->ToCString(); |
1688 if (debug_name[0] != 0) { | 1661 if (debug_name[0] != 0) { |
1689 accumulator->Add("<SharedFunctionInfo %s>", debug_name.get()); | 1662 accumulator->Add("<SharedFunctionInfo %s>", debug_name.get()); |
1690 } else { | 1663 } else { |
1691 accumulator->Add("<SharedFunctionInfo>"); | 1664 accumulator->Add("<SharedFunctionInfo>"); |
1692 } | 1665 } |
1693 break; | 1666 break; |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1850 break; | 1823 break; |
1851 case CELL_TYPE: | 1824 case CELL_TYPE: |
1852 Cell::BodyDescriptor::IterateBody(this, v); | 1825 Cell::BodyDescriptor::IterateBody(this, v); |
1853 break; | 1826 break; |
1854 case PROPERTY_CELL_TYPE: | 1827 case PROPERTY_CELL_TYPE: |
1855 PropertyCell::BodyDescriptor::IterateBody(this, v); | 1828 PropertyCell::BodyDescriptor::IterateBody(this, v); |
1856 break; | 1829 break; |
1857 case SYMBOL_TYPE: | 1830 case SYMBOL_TYPE: |
1858 Symbol::BodyDescriptor::IterateBody(this, v); | 1831 Symbol::BodyDescriptor::IterateBody(this, v); |
1859 break; | 1832 break; |
| 1833 |
1860 case HEAP_NUMBER_TYPE: | 1834 case HEAP_NUMBER_TYPE: |
1861 case FILLER_TYPE: | 1835 case FILLER_TYPE: |
1862 case BYTE_ARRAY_TYPE: | 1836 case BYTE_ARRAY_TYPE: |
1863 case FREE_SPACE_TYPE: | 1837 case FREE_SPACE_TYPE: |
1864 case EXTERNAL_PIXEL_ARRAY_TYPE: | |
1865 case EXTERNAL_BYTE_ARRAY_TYPE: | |
1866 case EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE: | |
1867 case EXTERNAL_SHORT_ARRAY_TYPE: | |
1868 case EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE: | |
1869 case EXTERNAL_INT_ARRAY_TYPE: | |
1870 case EXTERNAL_UNSIGNED_INT_ARRAY_TYPE: | |
1871 case EXTERNAL_FLOAT_ARRAY_TYPE: | |
1872 case EXTERNAL_DOUBLE_ARRAY_TYPE: | |
1873 case FIXED_INT8_ARRAY_TYPE: | |
1874 case FIXED_UINT8_ARRAY_TYPE: | |
1875 case FIXED_INT16_ARRAY_TYPE: | |
1876 case FIXED_UINT16_ARRAY_TYPE: | |
1877 case FIXED_INT32_ARRAY_TYPE: | |
1878 case FIXED_UINT32_ARRAY_TYPE: | |
1879 case FIXED_FLOAT32_ARRAY_TYPE: | |
1880 case FIXED_FLOAT64_ARRAY_TYPE: | |
1881 case FIXED_UINT8_CLAMPED_ARRAY_TYPE: | |
1882 break; | 1838 break; |
| 1839 |
| 1840 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \ |
| 1841 case EXTERNAL_##TYPE##_ARRAY_TYPE: \ |
| 1842 case FIXED_##TYPE##_ARRAY_TYPE: \ |
| 1843 break; |
| 1844 |
| 1845 TYPED_ARRAYS(TYPED_ARRAY_CASE) |
| 1846 #undef TYPED_ARRAY_CASE |
| 1847 |
1883 case SHARED_FUNCTION_INFO_TYPE: { | 1848 case SHARED_FUNCTION_INFO_TYPE: { |
1884 SharedFunctionInfo::BodyDescriptor::IterateBody(this, v); | 1849 SharedFunctionInfo::BodyDescriptor::IterateBody(this, v); |
1885 break; | 1850 break; |
1886 } | 1851 } |
1887 | 1852 |
1888 #define MAKE_STRUCT_CASE(NAME, Name, name) \ | 1853 #define MAKE_STRUCT_CASE(NAME, Name, name) \ |
1889 case NAME##_TYPE: | 1854 case NAME##_TYPE: |
1890 STRUCT_LIST(MAKE_STRUCT_CASE) | 1855 STRUCT_LIST(MAKE_STRUCT_CASE) |
1891 #undef MAKE_STRUCT_CASE | 1856 #undef MAKE_STRUCT_CASE |
1892 if (type == ALLOCATION_SITE_TYPE) { | 1857 if (type == ALLOCATION_SITE_TYPE) { |
(...skipping 3482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5375 | 5340 |
5376 // Check if the object is among the named properties. | 5341 // Check if the object is among the named properties. |
5377 Object* key = SlowReverseLookup(obj); | 5342 Object* key = SlowReverseLookup(obj); |
5378 if (!key->IsUndefined()) { | 5343 if (!key->IsUndefined()) { |
5379 return true; | 5344 return true; |
5380 } | 5345 } |
5381 | 5346 |
5382 // Check if the object is among the indexed properties. | 5347 // Check if the object is among the indexed properties. |
5383 ElementsKind kind = GetElementsKind(); | 5348 ElementsKind kind = GetElementsKind(); |
5384 switch (kind) { | 5349 switch (kind) { |
5385 case EXTERNAL_PIXEL_ELEMENTS: | 5350 // Raw pixels and external arrays do not reference other |
5386 case EXTERNAL_BYTE_ELEMENTS: | 5351 // objects. |
5387 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | 5352 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \ |
5388 case EXTERNAL_SHORT_ELEMENTS: | 5353 case EXTERNAL_##TYPE##_ELEMENTS: \ |
5389 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: | 5354 case TYPE##_ELEMENTS: \ |
5390 case EXTERNAL_INT_ELEMENTS: | 5355 break; |
5391 case EXTERNAL_UNSIGNED_INT_ELEMENTS: | 5356 |
5392 case EXTERNAL_FLOAT_ELEMENTS: | 5357 TYPED_ARRAYS(TYPED_ARRAY_CASE) |
5393 case EXTERNAL_DOUBLE_ELEMENTS: | 5358 #undef TYPED_ARRAY_CASE |
| 5359 |
5394 case FAST_DOUBLE_ELEMENTS: | 5360 case FAST_DOUBLE_ELEMENTS: |
5395 case FAST_HOLEY_DOUBLE_ELEMENTS: | 5361 case FAST_HOLEY_DOUBLE_ELEMENTS: |
5396 case UINT8_ELEMENTS: | |
5397 case INT8_ELEMENTS: | |
5398 case UINT16_ELEMENTS: | |
5399 case INT16_ELEMENTS: | |
5400 case UINT32_ELEMENTS: | |
5401 case INT32_ELEMENTS: | |
5402 case FLOAT32_ELEMENTS: | |
5403 case FLOAT64_ELEMENTS: | |
5404 case UINT8_CLAMPED_ELEMENTS: | |
5405 // Raw pixels and external arrays do not reference other | |
5406 // objects. | |
5407 break; | 5362 break; |
5408 case FAST_SMI_ELEMENTS: | 5363 case FAST_SMI_ELEMENTS: |
5409 case FAST_HOLEY_SMI_ELEMENTS: | 5364 case FAST_HOLEY_SMI_ELEMENTS: |
5410 break; | 5365 break; |
5411 case FAST_ELEMENTS: | 5366 case FAST_ELEMENTS: |
5412 case FAST_HOLEY_ELEMENTS: | 5367 case FAST_HOLEY_ELEMENTS: |
5413 case DICTIONARY_ELEMENTS: { | 5368 case DICTIONARY_ELEMENTS: { |
5414 FixedArray* elements = FixedArray::cast(this->elements()); | 5369 FixedArray* elements = FixedArray::cast(this->elements()); |
5415 if (ReferencesObjectFromElements(elements, kind, obj)) return true; | 5370 if (ReferencesObjectFromElements(elements, kind, obj)) return true; |
5416 break; | 5371 break; |
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5876 element_dictionary->ValueAtPut(i, *result); | 5831 element_dictionary->ValueAtPut(i, *result); |
5877 } | 5832 } |
5878 } | 5833 } |
5879 } | 5834 } |
5880 } | 5835 } |
5881 break; | 5836 break; |
5882 } | 5837 } |
5883 case NON_STRICT_ARGUMENTS_ELEMENTS: | 5838 case NON_STRICT_ARGUMENTS_ELEMENTS: |
5884 UNIMPLEMENTED(); | 5839 UNIMPLEMENTED(); |
5885 break; | 5840 break; |
5886 case EXTERNAL_PIXEL_ELEMENTS: | 5841 |
5887 case EXTERNAL_BYTE_ELEMENTS: | 5842 |
5888 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | 5843 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \ |
5889 case EXTERNAL_SHORT_ELEMENTS: | 5844 case EXTERNAL_##TYPE##_ELEMENTS: \ |
5890 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: | 5845 case TYPE##_ELEMENTS: \ |
5891 case EXTERNAL_INT_ELEMENTS: | 5846 |
5892 case EXTERNAL_UNSIGNED_INT_ELEMENTS: | 5847 TYPED_ARRAYS(TYPED_ARRAY_CASE) |
5893 case EXTERNAL_FLOAT_ELEMENTS: | 5848 #undef TYPED_ARRAY_CASE |
5894 case EXTERNAL_DOUBLE_ELEMENTS: | 5849 |
5895 case FAST_DOUBLE_ELEMENTS: | 5850 case FAST_DOUBLE_ELEMENTS: |
5896 case FAST_HOLEY_DOUBLE_ELEMENTS: | 5851 case FAST_HOLEY_DOUBLE_ELEMENTS: |
5897 case UINT8_ELEMENTS: | |
5898 case INT8_ELEMENTS: | |
5899 case UINT16_ELEMENTS: | |
5900 case INT16_ELEMENTS: | |
5901 case UINT32_ELEMENTS: | |
5902 case INT32_ELEMENTS: | |
5903 case FLOAT32_ELEMENTS: | |
5904 case FLOAT64_ELEMENTS: | |
5905 case UINT8_CLAMPED_ELEMENTS: | |
5906 // No contained objects, nothing to do. | 5852 // No contained objects, nothing to do. |
5907 break; | 5853 break; |
5908 } | 5854 } |
5909 } | 5855 } |
5910 | 5856 |
5911 return copy; | 5857 return copy; |
5912 } | 5858 } |
5913 | 5859 |
5914 | 5860 |
5915 Handle<JSObject> JSObject::DeepWalk( | 5861 Handle<JSObject> JSObject::DeepWalk( |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6124 PropertyAttributes attributes, | 6070 PropertyAttributes attributes, |
6125 v8::AccessControl access_control) { | 6071 v8::AccessControl access_control) { |
6126 switch (object->GetElementsKind()) { | 6072 switch (object->GetElementsKind()) { |
6127 case FAST_SMI_ELEMENTS: | 6073 case FAST_SMI_ELEMENTS: |
6128 case FAST_ELEMENTS: | 6074 case FAST_ELEMENTS: |
6129 case FAST_DOUBLE_ELEMENTS: | 6075 case FAST_DOUBLE_ELEMENTS: |
6130 case FAST_HOLEY_SMI_ELEMENTS: | 6076 case FAST_HOLEY_SMI_ELEMENTS: |
6131 case FAST_HOLEY_ELEMENTS: | 6077 case FAST_HOLEY_ELEMENTS: |
6132 case FAST_HOLEY_DOUBLE_ELEMENTS: | 6078 case FAST_HOLEY_DOUBLE_ELEMENTS: |
6133 break; | 6079 break; |
6134 case EXTERNAL_PIXEL_ELEMENTS: | 6080 |
6135 case EXTERNAL_BYTE_ELEMENTS: | 6081 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \ |
6136 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | 6082 case EXTERNAL_##TYPE##_ELEMENTS: \ |
6137 case EXTERNAL_SHORT_ELEMENTS: | 6083 case TYPE##_ELEMENTS: \ |
6138 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: | 6084 |
6139 case EXTERNAL_INT_ELEMENTS: | 6085 TYPED_ARRAYS(TYPED_ARRAY_CASE) |
6140 case EXTERNAL_UNSIGNED_INT_ELEMENTS: | 6086 #undef TYPED_ARRAY_CASE |
6141 case EXTERNAL_FLOAT_ELEMENTS: | |
6142 case EXTERNAL_DOUBLE_ELEMENTS: | |
6143 case UINT8_ELEMENTS: | |
6144 case INT8_ELEMENTS: | |
6145 case UINT16_ELEMENTS: | |
6146 case INT16_ELEMENTS: | |
6147 case UINT32_ELEMENTS: | |
6148 case INT32_ELEMENTS: | |
6149 case FLOAT32_ELEMENTS: | |
6150 case FLOAT64_ELEMENTS: | |
6151 case UINT8_CLAMPED_ELEMENTS: | |
6152 // Ignore getters and setters on pixel and external array elements. | 6087 // Ignore getters and setters on pixel and external array elements. |
6153 return; | 6088 return; |
| 6089 |
6154 case DICTIONARY_ELEMENTS: | 6090 case DICTIONARY_ELEMENTS: |
6155 if (UpdateGetterSetterInDictionary(object->element_dictionary(), | 6091 if (UpdateGetterSetterInDictionary(object->element_dictionary(), |
6156 index, | 6092 index, |
6157 *getter, | 6093 *getter, |
6158 *setter, | 6094 *setter, |
6159 attributes)) { | 6095 attributes)) { |
6160 return; | 6096 return; |
6161 } | 6097 } |
6162 break; | 6098 break; |
6163 case NON_STRICT_ARGUMENTS_ELEMENTS: { | 6099 case NON_STRICT_ARGUMENTS_ELEMENTS: { |
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6591 | 6527 |
6592 // Accessors overwrite previous callbacks (cf. with getters/setters). | 6528 // Accessors overwrite previous callbacks (cf. with getters/setters). |
6593 switch (object->GetElementsKind()) { | 6529 switch (object->GetElementsKind()) { |
6594 case FAST_SMI_ELEMENTS: | 6530 case FAST_SMI_ELEMENTS: |
6595 case FAST_ELEMENTS: | 6531 case FAST_ELEMENTS: |
6596 case FAST_DOUBLE_ELEMENTS: | 6532 case FAST_DOUBLE_ELEMENTS: |
6597 case FAST_HOLEY_SMI_ELEMENTS: | 6533 case FAST_HOLEY_SMI_ELEMENTS: |
6598 case FAST_HOLEY_ELEMENTS: | 6534 case FAST_HOLEY_ELEMENTS: |
6599 case FAST_HOLEY_DOUBLE_ELEMENTS: | 6535 case FAST_HOLEY_DOUBLE_ELEMENTS: |
6600 break; | 6536 break; |
6601 case EXTERNAL_PIXEL_ELEMENTS: | 6537 |
6602 case EXTERNAL_BYTE_ELEMENTS: | 6538 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \ |
6603 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | 6539 case EXTERNAL_##TYPE##_ELEMENTS: \ |
6604 case EXTERNAL_SHORT_ELEMENTS: | 6540 case TYPE##_ELEMENTS: \ |
6605 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: | 6541 |
6606 case EXTERNAL_INT_ELEMENTS: | 6542 TYPED_ARRAYS(TYPED_ARRAY_CASE) |
6607 case EXTERNAL_UNSIGNED_INT_ELEMENTS: | 6543 #undef TYPED_ARRAY_CASE |
6608 case EXTERNAL_FLOAT_ELEMENTS: | |
6609 case EXTERNAL_DOUBLE_ELEMENTS: | |
6610 case UINT8_ELEMENTS: | |
6611 case INT8_ELEMENTS: | |
6612 case UINT16_ELEMENTS: | |
6613 case INT16_ELEMENTS: | |
6614 case UINT32_ELEMENTS: | |
6615 case INT32_ELEMENTS: | |
6616 case FLOAT32_ELEMENTS: | |
6617 case FLOAT64_ELEMENTS: | |
6618 case UINT8_CLAMPED_ELEMENTS: | |
6619 // Ignore getters and setters on pixel and external array | 6544 // Ignore getters and setters on pixel and external array |
6620 // elements. | 6545 // elements. |
6621 return factory->undefined_value(); | 6546 return factory->undefined_value(); |
| 6547 |
6622 case DICTIONARY_ELEMENTS: | 6548 case DICTIONARY_ELEMENTS: |
6623 break; | 6549 break; |
6624 case NON_STRICT_ARGUMENTS_ELEMENTS: | 6550 case NON_STRICT_ARGUMENTS_ELEMENTS: |
6625 UNIMPLEMENTED(); | 6551 UNIMPLEMENTED(); |
6626 break; | 6552 break; |
6627 } | 6553 } |
6628 | 6554 |
6629 SetElementCallback(object, index, info, info->property_attributes()); | 6555 SetElementCallback(object, index, info, info->property_attributes()); |
6630 } else { | 6556 } else { |
6631 // Lookup the name. | 6557 // Lookup the name. |
(...skipping 6081 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12713 switch (object->GetElementsKind()) { | 12639 switch (object->GetElementsKind()) { |
12714 case FAST_SMI_ELEMENTS: | 12640 case FAST_SMI_ELEMENTS: |
12715 case FAST_ELEMENTS: | 12641 case FAST_ELEMENTS: |
12716 case FAST_HOLEY_SMI_ELEMENTS: | 12642 case FAST_HOLEY_SMI_ELEMENTS: |
12717 case FAST_HOLEY_ELEMENTS: | 12643 case FAST_HOLEY_ELEMENTS: |
12718 return SetFastElement(object, index, value, strict_mode, check_prototype); | 12644 return SetFastElement(object, index, value, strict_mode, check_prototype); |
12719 case FAST_DOUBLE_ELEMENTS: | 12645 case FAST_DOUBLE_ELEMENTS: |
12720 case FAST_HOLEY_DOUBLE_ELEMENTS: | 12646 case FAST_HOLEY_DOUBLE_ELEMENTS: |
12721 return SetFastDoubleElement(object, index, value, strict_mode, | 12647 return SetFastDoubleElement(object, index, value, strict_mode, |
12722 check_prototype); | 12648 check_prototype); |
12723 case EXTERNAL_PIXEL_ELEMENTS: { | 12649 |
12724 ExternalPixelArray* pixels = ExternalPixelArray::cast(object->elements()); | 12650 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \ |
12725 return handle(pixels->SetValue(index, *value), isolate); | 12651 case EXTERNAL_##TYPE##_ELEMENTS: { \ |
| 12652 Handle<External##Type##Array> array( \ |
| 12653 External##Type##Array::cast(object->elements())); \ |
| 12654 return External##Type##Array::SetValue(array, index, value); \ |
| 12655 } \ |
| 12656 case TYPE##_ELEMENTS: { \ |
| 12657 Handle<Fixed##Type##Array> array( \ |
| 12658 Fixed##Type##Array::cast(object->elements())); \ |
| 12659 return Fixed##Type##Array::SetValue(array, index, value); \ |
12726 } | 12660 } |
12727 case EXTERNAL_BYTE_ELEMENTS: { | 12661 |
12728 Handle<ExternalByteArray> array( | 12662 TYPED_ARRAYS(TYPED_ARRAY_CASE) |
12729 ExternalByteArray::cast(object->elements())); | 12663 |
12730 return ExternalByteArray::SetValue(array, index, value); | 12664 #undef TYPED_ARRAY_CASE |
12731 } | 12665 |
12732 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: { | |
12733 Handle<ExternalUnsignedByteArray> array( | |
12734 ExternalUnsignedByteArray::cast(object->elements())); | |
12735 return ExternalUnsignedByteArray::SetValue(array, index, value); | |
12736 } | |
12737 case EXTERNAL_SHORT_ELEMENTS: { | |
12738 Handle<ExternalShortArray> array(ExternalShortArray::cast( | |
12739 object->elements())); | |
12740 return ExternalShortArray::SetValue(array, index, value); | |
12741 } | |
12742 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: { | |
12743 Handle<ExternalUnsignedShortArray> array( | |
12744 ExternalUnsignedShortArray::cast(object->elements())); | |
12745 return ExternalUnsignedShortArray::SetValue(array, index, value); | |
12746 } | |
12747 case EXTERNAL_INT_ELEMENTS: { | |
12748 Handle<ExternalIntArray> array( | |
12749 ExternalIntArray::cast(object->elements())); | |
12750 return ExternalIntArray::SetValue(array, index, value); | |
12751 } | |
12752 case EXTERNAL_UNSIGNED_INT_ELEMENTS: { | |
12753 Handle<ExternalUnsignedIntArray> array( | |
12754 ExternalUnsignedIntArray::cast(object->elements())); | |
12755 return ExternalUnsignedIntArray::SetValue(array, index, value); | |
12756 } | |
12757 case EXTERNAL_FLOAT_ELEMENTS: { | |
12758 Handle<ExternalFloatArray> array( | |
12759 ExternalFloatArray::cast(object->elements())); | |
12760 return ExternalFloatArray::SetValue(array, index, value); | |
12761 } | |
12762 case EXTERNAL_DOUBLE_ELEMENTS: { | |
12763 Handle<ExternalDoubleArray> array( | |
12764 ExternalDoubleArray::cast(object->elements())); | |
12765 return ExternalDoubleArray::SetValue(array, index, value); | |
12766 } | |
12767 case UINT8_ELEMENTS: { | |
12768 Handle<FixedUint8Array> array( | |
12769 FixedUint8Array::cast(object->elements())); | |
12770 return FixedUint8Array::SetValue(array, index, value); | |
12771 } | |
12772 case UINT8_CLAMPED_ELEMENTS: { | |
12773 Handle<FixedUint8ClampedArray> array( | |
12774 FixedUint8ClampedArray::cast(object->elements())); | |
12775 return FixedUint8ClampedArray::SetValue(array, index, value); | |
12776 } | |
12777 case INT8_ELEMENTS: { | |
12778 Handle<FixedInt8Array> array( | |
12779 FixedInt8Array::cast(object->elements())); | |
12780 return FixedInt8Array::SetValue(array, index, value); | |
12781 } | |
12782 case UINT16_ELEMENTS: { | |
12783 Handle<FixedUint16Array> array( | |
12784 FixedUint16Array::cast(object->elements())); | |
12785 return FixedUint16Array::SetValue(array, index, value); | |
12786 } | |
12787 case INT16_ELEMENTS: { | |
12788 Handle<FixedInt16Array> array( | |
12789 FixedInt16Array::cast(object->elements())); | |
12790 return FixedInt16Array::SetValue(array, index, value); | |
12791 } | |
12792 case UINT32_ELEMENTS: { | |
12793 Handle<FixedUint32Array> array( | |
12794 FixedUint32Array::cast(object->elements())); | |
12795 return FixedUint32Array::SetValue(array, index, value); | |
12796 } | |
12797 case INT32_ELEMENTS: { | |
12798 Handle<FixedInt32Array> array( | |
12799 FixedInt32Array::cast(object->elements())); | |
12800 return FixedInt32Array::SetValue(array, index, value); | |
12801 } | |
12802 case FLOAT32_ELEMENTS: { | |
12803 Handle<FixedFloat32Array> array( | |
12804 FixedFloat32Array::cast(object->elements())); | |
12805 return FixedFloat32Array::SetValue(array, index, value); | |
12806 } | |
12807 case FLOAT64_ELEMENTS: { | |
12808 Handle<FixedFloat64Array> array( | |
12809 FixedFloat64Array::cast(object->elements())); | |
12810 return FixedFloat64Array::SetValue(array, index, value); | |
12811 } | |
12812 case DICTIONARY_ELEMENTS: | 12666 case DICTIONARY_ELEMENTS: |
12813 return SetDictionaryElement(object, index, value, attributes, strict_mode, | 12667 return SetDictionaryElement(object, index, value, attributes, strict_mode, |
12814 check_prototype, | 12668 check_prototype, |
12815 set_mode); | 12669 set_mode); |
12816 case NON_STRICT_ARGUMENTS_ELEMENTS: { | 12670 case NON_STRICT_ARGUMENTS_ELEMENTS: { |
12817 Handle<FixedArray> parameter_map(FixedArray::cast(object->elements())); | 12671 Handle<FixedArray> parameter_map(FixedArray::cast(object->elements())); |
12818 uint32_t length = parameter_map->length(); | 12672 uint32_t length = parameter_map->length(); |
12819 Handle<Object> probe = index < length - 2 ? | 12673 Handle<Object> probe = index < length - 2 ? |
12820 Handle<Object>(parameter_map->get(index + 2), isolate) : | 12674 Handle<Object>(parameter_map->get(index + 2), isolate) : |
12821 Handle<Object>(); | 12675 Handle<Object>(); |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13204 } | 13058 } |
13205 // Fall through if packing is not guaranteed. | 13059 // Fall through if packing is not guaranteed. |
13206 case FAST_HOLEY_DOUBLE_ELEMENTS: { | 13060 case FAST_HOLEY_DOUBLE_ELEMENTS: { |
13207 FixedDoubleArray* elms = FixedDoubleArray::cast(elements()); | 13061 FixedDoubleArray* elms = FixedDoubleArray::cast(elements()); |
13208 *capacity = elms->length(); | 13062 *capacity = elms->length(); |
13209 for (int i = 0; i < *capacity; i++) { | 13063 for (int i = 0; i < *capacity; i++) { |
13210 if (!elms->is_the_hole(i)) ++(*used); | 13064 if (!elms->is_the_hole(i)) ++(*used); |
13211 } | 13065 } |
13212 break; | 13066 break; |
13213 } | 13067 } |
13214 case EXTERNAL_BYTE_ELEMENTS: | 13068 |
13215 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | 13069 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \ |
13216 case EXTERNAL_SHORT_ELEMENTS: | 13070 case EXTERNAL_##TYPE##_ELEMENTS: \ |
13217 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: | 13071 case TYPE##_ELEMENTS: \ |
13218 case EXTERNAL_INT_ELEMENTS: | 13072 |
13219 case EXTERNAL_UNSIGNED_INT_ELEMENTS: | 13073 TYPED_ARRAYS(TYPED_ARRAY_CASE) |
13220 case EXTERNAL_FLOAT_ELEMENTS: | 13074 #undef TYPED_ARRAY_CASE |
13221 case EXTERNAL_DOUBLE_ELEMENTS: | 13075 { |
13222 case EXTERNAL_PIXEL_ELEMENTS: | |
13223 case UINT8_ELEMENTS: | |
13224 case INT8_ELEMENTS: | |
13225 case UINT16_ELEMENTS: | |
13226 case INT16_ELEMENTS: | |
13227 case UINT32_ELEMENTS: | |
13228 case INT32_ELEMENTS: | |
13229 case FLOAT32_ELEMENTS: | |
13230 case FLOAT64_ELEMENTS: | |
13231 case UINT8_CLAMPED_ELEMENTS: { | |
13232 // External arrays are considered 100% used. | 13076 // External arrays are considered 100% used. |
13233 FixedArrayBase* external_array = FixedArrayBase::cast(elements()); | 13077 FixedArrayBase* external_array = FixedArrayBase::cast(elements()); |
13234 *capacity = external_array->length(); | 13078 *capacity = external_array->length(); |
13235 *used = external_array->length(); | 13079 *used = external_array->length(); |
13236 break; | 13080 break; |
13237 } | 13081 } |
13238 } | 13082 } |
13239 } | 13083 } |
13240 | 13084 |
13241 | 13085 |
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13717 if (!FixedDoubleArray::cast(elements())->is_the_hole(i)) { | 13561 if (!FixedDoubleArray::cast(elements())->is_the_hole(i)) { |
13718 if (storage != NULL) { | 13562 if (storage != NULL) { |
13719 storage->set(counter, Smi::FromInt(i)); | 13563 storage->set(counter, Smi::FromInt(i)); |
13720 } | 13564 } |
13721 counter++; | 13565 counter++; |
13722 } | 13566 } |
13723 } | 13567 } |
13724 ASSERT(!storage || storage->length() >= counter); | 13568 ASSERT(!storage || storage->length() >= counter); |
13725 break; | 13569 break; |
13726 } | 13570 } |
13727 case EXTERNAL_PIXEL_ELEMENTS: { | 13571 |
13728 int length = ExternalPixelArray::cast(elements())->length(); | 13572 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \ |
13729 while (counter < length) { | 13573 case EXTERNAL_##TYPE##_ELEMENTS: \ |
13730 if (storage != NULL) { | 13574 case TYPE##_ELEMENTS: \ |
13731 storage->set(counter, Smi::FromInt(counter)); | 13575 |
13732 } | 13576 TYPED_ARRAYS(TYPED_ARRAY_CASE) |
13733 counter++; | 13577 #undef TYPED_ARRAY_CASE |
13734 } | 13578 { |
13735 ASSERT(!storage || storage->length() >= counter); | |
13736 break; | |
13737 } | |
13738 case EXTERNAL_BYTE_ELEMENTS: | |
13739 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | |
13740 case EXTERNAL_SHORT_ELEMENTS: | |
13741 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: | |
13742 case EXTERNAL_INT_ELEMENTS: | |
13743 case EXTERNAL_UNSIGNED_INT_ELEMENTS: | |
13744 case EXTERNAL_FLOAT_ELEMENTS: | |
13745 case EXTERNAL_DOUBLE_ELEMENTS: | |
13746 case UINT8_ELEMENTS: | |
13747 case INT8_ELEMENTS: | |
13748 case UINT16_ELEMENTS: | |
13749 case INT16_ELEMENTS: | |
13750 case UINT32_ELEMENTS: | |
13751 case INT32_ELEMENTS: | |
13752 case FLOAT32_ELEMENTS: | |
13753 case FLOAT64_ELEMENTS: | |
13754 case UINT8_CLAMPED_ELEMENTS: { | |
13755 int length = FixedArrayBase::cast(elements())->length(); | 13579 int length = FixedArrayBase::cast(elements())->length(); |
13756 while (counter < length) { | 13580 while (counter < length) { |
13757 if (storage != NULL) { | 13581 if (storage != NULL) { |
13758 storage->set(counter, Smi::FromInt(counter)); | 13582 storage->set(counter, Smi::FromInt(counter)); |
13759 } | 13583 } |
13760 counter++; | 13584 counter++; |
13761 } | 13585 } |
13762 ASSERT(!storage || storage->length() >= counter); | 13586 ASSERT(!storage || storage->length() >= counter); |
13763 break; | 13587 break; |
13764 } | 13588 } |
| 13589 |
13765 case DICTIONARY_ELEMENTS: { | 13590 case DICTIONARY_ELEMENTS: { |
13766 if (storage != NULL) { | 13591 if (storage != NULL) { |
13767 element_dictionary()->CopyKeysTo(storage, | 13592 element_dictionary()->CopyKeysTo(storage, |
13768 filter, | 13593 filter, |
13769 SeededNumberDictionary::SORTED); | 13594 SeededNumberDictionary::SORTED); |
13770 } | 13595 } |
13771 counter += element_dictionary()->NumberOfElementsFilterAttributes(filter); | 13596 counter += element_dictionary()->NumberOfElementsFilterAttributes(filter); |
13772 break; | 13597 break; |
13773 } | 13598 } |
13774 case NON_STRICT_ARGUMENTS_ELEMENTS: { | 13599 case NON_STRICT_ARGUMENTS_ELEMENTS: { |
(...skipping 883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14658 holes++; | 14483 holes++; |
14659 } | 14484 } |
14660 } | 14485 } |
14661 | 14486 |
14662 return isolate->factory()->NewNumberFromUint(result); | 14487 return isolate->factory()->NewNumberFromUint(result); |
14663 } | 14488 } |
14664 | 14489 |
14665 | 14490 |
14666 ExternalArrayType JSTypedArray::type() { | 14491 ExternalArrayType JSTypedArray::type() { |
14667 switch (elements()->map()->instance_type()) { | 14492 switch (elements()->map()->instance_type()) { |
14668 case EXTERNAL_BYTE_ARRAY_TYPE: | 14493 #define INSTANCE_TYPE_TO_ARRAY_TYPE(Type, type, TYPE, ctype, size) \ |
14669 return kExternalByteArray; | 14494 case EXTERNAL_##TYPE##_ARRAY_TYPE: \ |
14670 case EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE: | 14495 return kExternal##Type##Array; |
14671 return kExternalUnsignedByteArray; | 14496 |
14672 case EXTERNAL_SHORT_ARRAY_TYPE: | 14497 TYPED_ARRAYS(INSTANCE_TYPE_TO_ARRAY_TYPE) |
14673 return kExternalShortArray; | 14498 #undef INSTANCE_TYPE_TO_ARRAY_TYPE |
14674 case EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE: | 14499 |
14675 return kExternalUnsignedShortArray; | |
14676 case EXTERNAL_INT_ARRAY_TYPE: | |
14677 return kExternalIntArray; | |
14678 case EXTERNAL_UNSIGNED_INT_ARRAY_TYPE: | |
14679 return kExternalUnsignedIntArray; | |
14680 case EXTERNAL_FLOAT_ARRAY_TYPE: | |
14681 return kExternalFloatArray; | |
14682 case EXTERNAL_DOUBLE_ARRAY_TYPE: | |
14683 return kExternalDoubleArray; | |
14684 case EXTERNAL_PIXEL_ARRAY_TYPE: | |
14685 return kExternalPixelArray; | |
14686 default: | 14500 default: |
14687 return static_cast<ExternalArrayType>(-1); | 14501 return static_cast<ExternalArrayType>(-1); |
14688 } | 14502 } |
14689 } | 14503 } |
14690 | 14504 |
14691 | 14505 |
14692 size_t JSTypedArray::element_size() { | 14506 size_t JSTypedArray::element_size() { |
14693 switch (elements()->map()->instance_type()) { | 14507 switch (elements()->map()->instance_type()) { |
14694 case EXTERNAL_BYTE_ARRAY_TYPE: | 14508 #define INSTANCE_TYPE_TO_ELEMENT_SIZE(Type, type, TYPE, ctype, size) \ |
14695 return 1; | 14509 case EXTERNAL_##TYPE##_ARRAY_TYPE: \ |
14696 case EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE: | 14510 return size; |
14697 return 1; | 14511 |
14698 case EXTERNAL_SHORT_ARRAY_TYPE: | 14512 TYPED_ARRAYS(INSTANCE_TYPE_TO_ELEMENT_SIZE) |
14699 return 2; | 14513 #undef INSTANCE_TYPE_TO_ELEMENT_SIZE |
14700 case EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE: | 14514 |
14701 return 2; | |
14702 case EXTERNAL_INT_ARRAY_TYPE: | |
14703 return 4; | |
14704 case EXTERNAL_UNSIGNED_INT_ARRAY_TYPE: | |
14705 return 4; | |
14706 case EXTERNAL_FLOAT_ARRAY_TYPE: | |
14707 return 4; | |
14708 case EXTERNAL_DOUBLE_ARRAY_TYPE: | |
14709 return 8; | |
14710 case EXTERNAL_PIXEL_ARRAY_TYPE: | |
14711 return 1; | |
14712 default: | 14515 default: |
14713 UNREACHABLE(); | 14516 UNREACHABLE(); |
14714 return 0; | 14517 return 0; |
14715 } | 14518 } |
14716 } | 14519 } |
14717 | 14520 |
14718 | 14521 |
14719 Object* ExternalPixelArray::SetValue(uint32_t index, Object* value) { | 14522 Object* ExternalUint8ClampedArray::SetValue(uint32_t index, Object* value) { |
14720 uint8_t clamped_value = 0; | 14523 uint8_t clamped_value = 0; |
14721 if (index < static_cast<uint32_t>(length())) { | 14524 if (index < static_cast<uint32_t>(length())) { |
14722 if (value->IsSmi()) { | 14525 if (value->IsSmi()) { |
14723 int int_value = Smi::cast(value)->value(); | 14526 int int_value = Smi::cast(value)->value(); |
14724 if (int_value < 0) { | 14527 if (int_value < 0) { |
14725 clamped_value = 0; | 14528 clamped_value = 0; |
14726 } else if (int_value > 255) { | 14529 } else if (int_value > 255) { |
14727 clamped_value = 255; | 14530 clamped_value = 255; |
14728 } else { | 14531 } else { |
14729 clamped_value = static_cast<uint8_t>(int_value); | 14532 clamped_value = static_cast<uint8_t>(int_value); |
(...skipping 14 matching lines...) Expand all Loading... |
14744 // Clamp undefined to zero (default). All other types have been | 14547 // Clamp undefined to zero (default). All other types have been |
14745 // converted to a number type further up in the call chain. | 14548 // converted to a number type further up in the call chain. |
14746 ASSERT(value->IsUndefined()); | 14549 ASSERT(value->IsUndefined()); |
14747 } | 14550 } |
14748 set(index, clamped_value); | 14551 set(index, clamped_value); |
14749 } | 14552 } |
14750 return Smi::FromInt(clamped_value); | 14553 return Smi::FromInt(clamped_value); |
14751 } | 14554 } |
14752 | 14555 |
14753 | 14556 |
| 14557 Handle<Object> ExternalUint8ClampedArray::SetValue( |
| 14558 Handle<ExternalUint8ClampedArray> array, |
| 14559 uint32_t index, |
| 14560 Handle<Object> value) { |
| 14561 return Handle<Object>(array->SetValue(index, *value), array->GetIsolate()); |
| 14562 } |
| 14563 |
| 14564 |
14754 template<typename ExternalArrayClass, typename ValueType> | 14565 template<typename ExternalArrayClass, typename ValueType> |
14755 static MaybeObject* ExternalArrayIntSetter(Heap* heap, | 14566 static MaybeObject* ExternalArrayIntSetter(Heap* heap, |
14756 ExternalArrayClass* receiver, | 14567 ExternalArrayClass* receiver, |
14757 uint32_t index, | 14568 uint32_t index, |
14758 Object* value) { | 14569 Object* value) { |
14759 ValueType cast_value = 0; | 14570 ValueType cast_value = 0; |
14760 if (index < static_cast<uint32_t>(receiver->length())) { | 14571 if (index < static_cast<uint32_t>(receiver->length())) { |
14761 if (value->IsSmi()) { | 14572 if (value->IsSmi()) { |
14762 int int_value = Smi::cast(value)->value(); | 14573 int int_value = Smi::cast(value)->value(); |
14763 cast_value = static_cast<ValueType>(int_value); | 14574 cast_value = static_cast<ValueType>(int_value); |
14764 } else if (value->IsHeapNumber()) { | 14575 } else if (value->IsHeapNumber()) { |
14765 double double_value = HeapNumber::cast(value)->value(); | 14576 double double_value = HeapNumber::cast(value)->value(); |
14766 cast_value = static_cast<ValueType>(DoubleToInt32(double_value)); | 14577 cast_value = static_cast<ValueType>(DoubleToInt32(double_value)); |
14767 } else { | 14578 } else { |
14768 // Clamp undefined to zero (default). All other types have been | 14579 // Clamp undefined to zero (default). All other types have been |
14769 // converted to a number type further up in the call chain. | 14580 // converted to a number type further up in the call chain. |
14770 ASSERT(value->IsUndefined()); | 14581 ASSERT(value->IsUndefined()); |
14771 } | 14582 } |
14772 receiver->set(index, cast_value); | 14583 receiver->set(index, cast_value); |
14773 } | 14584 } |
14774 return heap->NumberFromInt32(cast_value); | 14585 return heap->NumberFromInt32(cast_value); |
14775 } | 14586 } |
14776 | 14587 |
14777 | 14588 |
14778 Handle<Object> ExternalByteArray::SetValue(Handle<ExternalByteArray> array, | 14589 Handle<Object> ExternalInt8Array::SetValue(Handle<ExternalInt8Array> array, |
14779 uint32_t index, | 14590 uint32_t index, |
14780 Handle<Object> value) { | 14591 Handle<Object> value) { |
14781 CALL_HEAP_FUNCTION(array->GetIsolate(), | 14592 CALL_HEAP_FUNCTION(array->GetIsolate(), |
14782 array->SetValue(index, *value), | 14593 array->SetValue(index, *value), |
14783 Object); | 14594 Object); |
14784 } | 14595 } |
14785 | 14596 |
14786 | 14597 |
14787 MaybeObject* ExternalByteArray::SetValue(uint32_t index, Object* value) { | 14598 MaybeObject* ExternalInt8Array::SetValue(uint32_t index, Object* value) { |
14788 return ExternalArrayIntSetter<ExternalByteArray, int8_t> | 14599 return ExternalArrayIntSetter<ExternalInt8Array, int8_t> |
14789 (GetHeap(), this, index, value); | 14600 (GetHeap(), this, index, value); |
14790 } | 14601 } |
14791 | 14602 |
14792 | 14603 |
14793 Handle<Object> ExternalUnsignedByteArray::SetValue( | 14604 Handle<Object> ExternalUint8Array::SetValue( |
14794 Handle<ExternalUnsignedByteArray> array, | 14605 Handle<ExternalUint8Array> array, |
14795 uint32_t index, | 14606 uint32_t index, |
14796 Handle<Object> value) { | 14607 Handle<Object> value) { |
14797 CALL_HEAP_FUNCTION(array->GetIsolate(), | 14608 CALL_HEAP_FUNCTION(array->GetIsolate(), |
14798 array->SetValue(index, *value), | 14609 array->SetValue(index, *value), |
14799 Object); | 14610 Object); |
14800 } | 14611 } |
14801 | 14612 |
14802 | 14613 |
14803 MaybeObject* ExternalUnsignedByteArray::SetValue(uint32_t index, | 14614 MaybeObject* ExternalUint8Array::SetValue(uint32_t index, |
14804 Object* value) { | 14615 Object* value) { |
14805 return ExternalArrayIntSetter<ExternalUnsignedByteArray, uint8_t> | 14616 return ExternalArrayIntSetter<ExternalUint8Array, uint8_t> |
14806 (GetHeap(), this, index, value); | 14617 (GetHeap(), this, index, value); |
14807 } | 14618 } |
14808 | 14619 |
14809 | 14620 |
14810 Handle<Object> ExternalShortArray::SetValue( | 14621 Handle<Object> ExternalInt16Array::SetValue( |
14811 Handle<ExternalShortArray> array, | 14622 Handle<ExternalInt16Array> array, |
14812 uint32_t index, | 14623 uint32_t index, |
14813 Handle<Object> value) { | 14624 Handle<Object> value) { |
14814 CALL_HEAP_FUNCTION(array->GetIsolate(), | 14625 CALL_HEAP_FUNCTION(array->GetIsolate(), |
14815 array->SetValue(index, *value), | 14626 array->SetValue(index, *value), |
14816 Object); | 14627 Object); |
14817 } | 14628 } |
14818 | 14629 |
14819 | 14630 |
14820 MaybeObject* ExternalShortArray::SetValue(uint32_t index, | 14631 MaybeObject* ExternalInt16Array::SetValue(uint32_t index, |
14821 Object* value) { | 14632 Object* value) { |
14822 return ExternalArrayIntSetter<ExternalShortArray, int16_t> | 14633 return ExternalArrayIntSetter<ExternalInt16Array, int16_t> |
14823 (GetHeap(), this, index, value); | 14634 (GetHeap(), this, index, value); |
14824 } | 14635 } |
14825 | 14636 |
14826 | 14637 |
14827 Handle<Object> ExternalUnsignedShortArray::SetValue( | 14638 Handle<Object> ExternalUint16Array::SetValue( |
14828 Handle<ExternalUnsignedShortArray> array, | 14639 Handle<ExternalUint16Array> array, |
14829 uint32_t index, | 14640 uint32_t index, |
14830 Handle<Object> value) { | 14641 Handle<Object> value) { |
14831 CALL_HEAP_FUNCTION(array->GetIsolate(), | 14642 CALL_HEAP_FUNCTION(array->GetIsolate(), |
14832 array->SetValue(index, *value), | 14643 array->SetValue(index, *value), |
14833 Object); | 14644 Object); |
14834 } | 14645 } |
14835 | 14646 |
14836 | 14647 |
14837 MaybeObject* ExternalUnsignedShortArray::SetValue(uint32_t index, | 14648 MaybeObject* ExternalUint16Array::SetValue(uint32_t index, |
14838 Object* value) { | 14649 Object* value) { |
14839 return ExternalArrayIntSetter<ExternalUnsignedShortArray, uint16_t> | 14650 return ExternalArrayIntSetter<ExternalUint16Array, uint16_t> |
14840 (GetHeap(), this, index, value); | 14651 (GetHeap(), this, index, value); |
14841 } | 14652 } |
14842 | 14653 |
14843 | 14654 |
14844 Handle<Object> ExternalIntArray::SetValue(Handle<ExternalIntArray> array, | 14655 Handle<Object> ExternalInt32Array::SetValue(Handle<ExternalInt32Array> array, |
14845 uint32_t index, | 14656 uint32_t index, |
14846 Handle<Object> value) { | 14657 Handle<Object> value) { |
14847 CALL_HEAP_FUNCTION(array->GetIsolate(), | 14658 CALL_HEAP_FUNCTION(array->GetIsolate(), |
14848 array->SetValue(index, *value), | 14659 array->SetValue(index, *value), |
14849 Object); | 14660 Object); |
14850 } | 14661 } |
14851 | 14662 |
14852 | 14663 |
14853 MaybeObject* ExternalIntArray::SetValue(uint32_t index, Object* value) { | 14664 MaybeObject* ExternalInt32Array::SetValue(uint32_t index, Object* value) { |
14854 return ExternalArrayIntSetter<ExternalIntArray, int32_t> | 14665 return ExternalArrayIntSetter<ExternalInt32Array, int32_t> |
14855 (GetHeap(), this, index, value); | 14666 (GetHeap(), this, index, value); |
14856 } | 14667 } |
14857 | 14668 |
14858 | 14669 |
14859 Handle<Object> ExternalUnsignedIntArray::SetValue( | 14670 Handle<Object> ExternalUint32Array::SetValue( |
14860 Handle<ExternalUnsignedIntArray> array, | 14671 Handle<ExternalUint32Array> array, |
14861 uint32_t index, | 14672 uint32_t index, |
14862 Handle<Object> value) { | 14673 Handle<Object> value) { |
14863 CALL_HEAP_FUNCTION(array->GetIsolate(), | 14674 CALL_HEAP_FUNCTION(array->GetIsolate(), |
14864 array->SetValue(index, *value), | 14675 array->SetValue(index, *value), |
14865 Object); | 14676 Object); |
14866 } | 14677 } |
14867 | 14678 |
14868 | 14679 |
14869 MaybeObject* ExternalUnsignedIntArray::SetValue(uint32_t index, Object* value) { | 14680 MaybeObject* ExternalUint32Array::SetValue(uint32_t index, Object* value) { |
14870 uint32_t cast_value = 0; | 14681 uint32_t cast_value = 0; |
14871 Heap* heap = GetHeap(); | 14682 Heap* heap = GetHeap(); |
14872 if (index < static_cast<uint32_t>(length())) { | 14683 if (index < static_cast<uint32_t>(length())) { |
14873 if (value->IsSmi()) { | 14684 if (value->IsSmi()) { |
14874 int int_value = Smi::cast(value)->value(); | 14685 int int_value = Smi::cast(value)->value(); |
14875 cast_value = static_cast<uint32_t>(int_value); | 14686 cast_value = static_cast<uint32_t>(int_value); |
14876 } else if (value->IsHeapNumber()) { | 14687 } else if (value->IsHeapNumber()) { |
14877 double double_value = HeapNumber::cast(value)->value(); | 14688 double double_value = HeapNumber::cast(value)->value(); |
14878 cast_value = static_cast<uint32_t>(DoubleToUint32(double_value)); | 14689 cast_value = static_cast<uint32_t>(DoubleToUint32(double_value)); |
14879 } else { | 14690 } else { |
14880 // Clamp undefined to zero (default). All other types have been | 14691 // Clamp undefined to zero (default). All other types have been |
14881 // converted to a number type further up in the call chain. | 14692 // converted to a number type further up in the call chain. |
14882 ASSERT(value->IsUndefined()); | 14693 ASSERT(value->IsUndefined()); |
14883 } | 14694 } |
14884 set(index, cast_value); | 14695 set(index, cast_value); |
14885 } | 14696 } |
14886 return heap->NumberFromUint32(cast_value); | 14697 return heap->NumberFromUint32(cast_value); |
14887 } | 14698 } |
14888 | 14699 |
14889 | 14700 |
14890 Handle<Object> ExternalFloatArray::SetValue(Handle<ExternalFloatArray> array, | 14701 Handle<Object> ExternalFloat32Array::SetValue( |
14891 uint32_t index, | 14702 Handle<ExternalFloat32Array> array, |
14892 Handle<Object> value) { | 14703 uint32_t index, |
| 14704 Handle<Object> value) { |
14893 CALL_HEAP_FUNCTION(array->GetIsolate(), | 14705 CALL_HEAP_FUNCTION(array->GetIsolate(), |
14894 array->SetValue(index, *value), | 14706 array->SetValue(index, *value), |
14895 Object); | 14707 Object); |
14896 } | 14708 } |
14897 | 14709 |
14898 | 14710 |
14899 MaybeObject* ExternalFloatArray::SetValue(uint32_t index, Object* value) { | 14711 MaybeObject* ExternalFloat32Array::SetValue(uint32_t index, Object* value) { |
14900 float cast_value = static_cast<float>(OS::nan_value()); | 14712 float cast_value = static_cast<float>(OS::nan_value()); |
14901 Heap* heap = GetHeap(); | 14713 Heap* heap = GetHeap(); |
14902 if (index < static_cast<uint32_t>(length())) { | 14714 if (index < static_cast<uint32_t>(length())) { |
14903 if (value->IsSmi()) { | 14715 if (value->IsSmi()) { |
14904 int int_value = Smi::cast(value)->value(); | 14716 int int_value = Smi::cast(value)->value(); |
14905 cast_value = static_cast<float>(int_value); | 14717 cast_value = static_cast<float>(int_value); |
14906 } else if (value->IsHeapNumber()) { | 14718 } else if (value->IsHeapNumber()) { |
14907 double double_value = HeapNumber::cast(value)->value(); | 14719 double double_value = HeapNumber::cast(value)->value(); |
14908 cast_value = static_cast<float>(double_value); | 14720 cast_value = static_cast<float>(double_value); |
14909 } else { | 14721 } else { |
14910 // Clamp undefined to NaN (default). All other types have been | 14722 // Clamp undefined to NaN (default). All other types have been |
14911 // converted to a number type further up in the call chain. | 14723 // converted to a number type further up in the call chain. |
14912 ASSERT(value->IsUndefined()); | 14724 ASSERT(value->IsUndefined()); |
14913 } | 14725 } |
14914 set(index, cast_value); | 14726 set(index, cast_value); |
14915 } | 14727 } |
14916 return heap->AllocateHeapNumber(cast_value); | 14728 return heap->AllocateHeapNumber(cast_value); |
14917 } | 14729 } |
14918 | 14730 |
14919 | 14731 |
14920 Handle<Object> ExternalDoubleArray::SetValue(Handle<ExternalDoubleArray> array, | 14732 Handle<Object> ExternalFloat64Array::SetValue( |
14921 uint32_t index, | 14733 Handle<ExternalFloat64Array> array, |
14922 Handle<Object> value) { | 14734 uint32_t index, |
| 14735 Handle<Object> value) { |
14923 CALL_HEAP_FUNCTION(array->GetIsolate(), | 14736 CALL_HEAP_FUNCTION(array->GetIsolate(), |
14924 array->SetValue(index, *value), | 14737 array->SetValue(index, *value), |
14925 Object); | 14738 Object); |
14926 } | 14739 } |
14927 | 14740 |
14928 | 14741 |
14929 MaybeObject* ExternalDoubleArray::SetValue(uint32_t index, Object* value) { | 14742 MaybeObject* ExternalFloat64Array::SetValue(uint32_t index, Object* value) { |
14930 double double_value = OS::nan_value(); | 14743 double double_value = OS::nan_value(); |
14931 Heap* heap = GetHeap(); | 14744 Heap* heap = GetHeap(); |
14932 if (index < static_cast<uint32_t>(length())) { | 14745 if (index < static_cast<uint32_t>(length())) { |
14933 if (value->IsSmi()) { | 14746 if (value->IsSmi()) { |
14934 int int_value = Smi::cast(value)->value(); | 14747 int int_value = Smi::cast(value)->value(); |
14935 double_value = static_cast<double>(int_value); | 14748 double_value = static_cast<double>(int_value); |
14936 } else if (value->IsHeapNumber()) { | 14749 } else if (value->IsHeapNumber()) { |
14937 double_value = HeapNumber::cast(value)->value(); | 14750 double_value = HeapNumber::cast(value)->value(); |
14938 } else { | 14751 } else { |
14939 // Clamp undefined to NaN (default). All other types have been | 14752 // Clamp undefined to NaN (default). All other types have been |
(...skipping 1664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16604 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16417 #define ERROR_MESSAGES_TEXTS(C, T) T, |
16605 static const char* error_messages_[] = { | 16418 static const char* error_messages_[] = { |
16606 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16419 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
16607 }; | 16420 }; |
16608 #undef ERROR_MESSAGES_TEXTS | 16421 #undef ERROR_MESSAGES_TEXTS |
16609 return error_messages_[reason]; | 16422 return error_messages_[reason]; |
16610 } | 16423 } |
16611 | 16424 |
16612 | 16425 |
16613 } } // namespace v8::internal | 16426 } } // namespace v8::internal |
OLD | NEW |