Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "include/dart_api.h" | 5 #include "include/dart_api.h" |
| 6 | 6 |
| 7 #include "vm/bigint_operations.h" | 7 #include "vm/bigint_operations.h" |
| 8 #include "vm/class_finalizer.h" | 8 #include "vm/class_finalizer.h" |
| 9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
| 10 #include "vm/dart.h" | 10 #include "vm/dart.h" |
| (...skipping 1635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1646 type& array = type::Handle(isolate); \ | 1646 type& array = type::Handle(isolate); \ |
| 1647 array ^= obj.raw(); \ | 1647 array ^= obj.raw(); \ |
| 1648 *len = array.Length(); \ | 1648 *len = array.Length(); \ |
| 1649 return Api::Success(isolate); \ | 1649 return Api::Success(isolate); \ |
| 1650 | 1650 |
| 1651 | 1651 |
| 1652 DART_EXPORT Dart_Handle Dart_ListLength(Dart_Handle list, intptr_t* len) { | 1652 DART_EXPORT Dart_Handle Dart_ListLength(Dart_Handle list, intptr_t* len) { |
| 1653 Isolate* isolate = Isolate::Current(); | 1653 Isolate* isolate = Isolate::Current(); |
| 1654 DARTSCOPE(isolate); | 1654 DARTSCOPE(isolate); |
| 1655 const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(list)); | 1655 const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(list)); |
| 1656 if (obj.IsByteArray()) { | |
|
Ivan Posva
2012/05/02 08:19:17
You should preserve support for fast handling of b
cshapiro
2012/05/03 04:01:50
Done. Restored. I think this case is easy to kee
| |
| 1657 GET_LIST_LENGTH(isolate, ByteArray, obj, len); | |
| 1658 } | |
| 1659 if (obj.IsArray()) { | 1656 if (obj.IsArray()) { |
| 1660 GET_LIST_LENGTH(isolate, Array, obj, len); | 1657 GET_LIST_LENGTH(isolate, Array, obj, len); |
| 1661 } | 1658 } |
| 1662 if (obj.IsGrowableObjectArray()) { | 1659 if (obj.IsGrowableObjectArray()) { |
| 1663 GET_LIST_LENGTH(isolate, GrowableObjectArray, obj, len); | 1660 GET_LIST_LENGTH(isolate, GrowableObjectArray, obj, len); |
| 1664 } | 1661 } |
| 1665 // Now check and handle a dart object that implements the List interface. | 1662 // Now check and handle a dart object that implements the List interface. |
| 1666 const Instance& instance = | 1663 const Instance& instance = |
| 1667 Instance::Handle(isolate, GetListInstance(isolate, obj)); | 1664 Instance::Handle(isolate, GetListInstance(isolate, obj)); |
| 1668 if (instance.IsNull()) { | 1665 if (instance.IsNull()) { |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1820 return Api::NewError("Invalid length passed in to access array elements"); \ | 1817 return Api::NewError("Invalid length passed in to access array elements"); \ |
| 1821 | 1818 |
| 1822 | 1819 |
| 1823 DART_EXPORT Dart_Handle Dart_ListGetAsBytes(Dart_Handle list, | 1820 DART_EXPORT Dart_Handle Dart_ListGetAsBytes(Dart_Handle list, |
| 1824 intptr_t offset, | 1821 intptr_t offset, |
| 1825 uint8_t* native_array, | 1822 uint8_t* native_array, |
| 1826 intptr_t length) { | 1823 intptr_t length) { |
| 1827 Isolate* isolate = Isolate::Current(); | 1824 Isolate* isolate = Isolate::Current(); |
| 1828 DARTSCOPE(isolate); | 1825 DARTSCOPE(isolate); |
| 1829 const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(list)); | 1826 const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(list)); |
| 1830 if (obj.IsByteArray()) { | |
|
Ivan Posva
2012/05/02 08:19:17
ditto.
cshapiro
2012/05/03 04:01:50
I will make this work for the Uint8Array types. I
| |
| 1831 ByteArray& byte_array = ByteArray::Handle(isolate); | |
| 1832 byte_array ^= obj.raw(); | |
| 1833 if (Utils::RangeCheck(offset, length, byte_array.Length())) { | |
| 1834 ByteArray::Copy(native_array, byte_array, offset, length); | |
| 1835 return Api::Success(isolate); | |
| 1836 } | |
| 1837 return Api::NewError("Invalid length passed in to access list elements"); | |
| 1838 } | |
| 1839 if (obj.IsArray()) { | 1827 if (obj.IsArray()) { |
| 1840 GET_LIST_ELEMENT_AS_BYTES(isolate, | 1828 GET_LIST_ELEMENT_AS_BYTES(isolate, |
| 1841 Array, | 1829 Array, |
| 1842 obj, | 1830 obj, |
| 1843 native_array, | 1831 native_array, |
| 1844 offset, | 1832 offset, |
| 1845 length); } | 1833 length); } |
| 1846 if (obj.IsGrowableObjectArray()) { | 1834 if (obj.IsGrowableObjectArray()) { |
| 1847 GET_LIST_ELEMENT_AS_BYTES(isolate, | 1835 GET_LIST_ELEMENT_AS_BYTES(isolate, |
| 1848 GrowableObjectArray, | 1836 GrowableObjectArray, |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1904 return Api::NewError("Invalid length passed in to set array elements"); \ | 1892 return Api::NewError("Invalid length passed in to set array elements"); \ |
| 1905 | 1893 |
| 1906 | 1894 |
| 1907 DART_EXPORT Dart_Handle Dart_ListSetAsBytes(Dart_Handle list, | 1895 DART_EXPORT Dart_Handle Dart_ListSetAsBytes(Dart_Handle list, |
| 1908 intptr_t offset, | 1896 intptr_t offset, |
| 1909 uint8_t* native_array, | 1897 uint8_t* native_array, |
| 1910 intptr_t length) { | 1898 intptr_t length) { |
| 1911 Isolate* isolate = Isolate::Current(); | 1899 Isolate* isolate = Isolate::Current(); |
| 1912 DARTSCOPE(isolate); | 1900 DARTSCOPE(isolate); |
| 1913 const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(list)); | 1901 const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(list)); |
| 1914 if (obj.IsByteArray()) { | |
|
Ivan Posva
2012/05/02 08:19:17
ditto.
cshapiro
2012/05/03 04:01:50
Sure, with the same limitations as above.
| |
| 1915 ByteArray& byte_array = ByteArray::Handle(isolate); | |
| 1916 byte_array ^= obj.raw(); | |
| 1917 if (Utils::RangeCheck(offset, length, byte_array.Length())) { | |
| 1918 ByteArray::Copy(byte_array, offset, native_array, length); | |
| 1919 return Api::Success(isolate); | |
| 1920 } | |
| 1921 return Api::NewError("Invalid length passed in to set list elements"); | |
| 1922 } | |
| 1923 if (obj.IsArray()) { | 1902 if (obj.IsArray()) { |
| 1924 if (obj.IsImmutableArray()) { | 1903 if (obj.IsImmutableArray()) { |
| 1925 return Api::NewError("Cannot modify immutable array"); | 1904 return Api::NewError("Cannot modify immutable array"); |
| 1926 } | 1905 } |
| 1927 SET_LIST_ELEMENT_AS_BYTES(isolate, | 1906 SET_LIST_ELEMENT_AS_BYTES(isolate, |
| 1928 Array, | 1907 Array, |
| 1929 obj, | 1908 obj, |
| 1930 native_array, | 1909 native_array, |
| 1931 offset, | 1910 offset, |
| 1932 length); | 1911 length); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1979 Isolate* isolate = Isolate::Current(); | 1958 Isolate* isolate = Isolate::Current(); |
| 1980 DARTSCOPE(isolate); | 1959 DARTSCOPE(isolate); |
| 1981 const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(object)); | 1960 const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(object)); |
| 1982 return obj.IsByteArray(); | 1961 return obj.IsByteArray(); |
| 1983 } | 1962 } |
| 1984 | 1963 |
| 1985 | 1964 |
| 1986 DART_EXPORT Dart_Handle Dart_NewByteArray(intptr_t length) { | 1965 DART_EXPORT Dart_Handle Dart_NewByteArray(intptr_t length) { |
| 1987 Isolate* isolate = Isolate::Current(); | 1966 Isolate* isolate = Isolate::Current(); |
| 1988 DARTSCOPE(isolate); | 1967 DARTSCOPE(isolate); |
| 1989 return Api::NewHandle(isolate, InternalByteArray::New(length)); | 1968 return Api::NewHandle(isolate, Uint8Array::New(length)); |
| 1990 } | 1969 } |
| 1991 | 1970 |
| 1992 | 1971 |
| 1993 DART_EXPORT Dart_Handle Dart_NewExternalByteArray(uint8_t* data, | 1972 DART_EXPORT Dart_Handle Dart_NewExternalByteArray(uint8_t* data, |
| 1994 intptr_t length, | 1973 intptr_t length, |
| 1995 void* peer, | 1974 void* peer, |
| 1996 Dart_PeerFinalizer callback) { | 1975 Dart_PeerFinalizer callback) { |
| 1997 Isolate* isolate = Isolate::Current(); | 1976 Isolate* isolate = Isolate::Current(); |
| 1998 DARTSCOPE(isolate); | 1977 DARTSCOPE(isolate); |
| 1999 if (data == NULL && length != 0) { | 1978 if (data == NULL && length != 0) { |
| 2000 return Api::NewError("%s expects argument 'data' to be non-null.", | 1979 return Api::NewError("%s expects argument 'data' to be non-null.", |
| 2001 CURRENT_FUNC); | 1980 CURRENT_FUNC); |
| 2002 } | 1981 } |
| 2003 if (length < 0) { | 1982 if (length < 0) { |
| 2004 return Api::NewError("%s expects argument 'length' to be greater than 0.", | 1983 return Api::NewError("%s expects argument 'length' to be greater than 0.", |
| 2005 CURRENT_FUNC); | 1984 CURRENT_FUNC); |
| 2006 } | 1985 } |
| 2007 return Api::NewHandle( | 1986 return Api::NewHandle( |
| 2008 isolate, ExternalByteArray::New(data, length, peer, callback)); | 1987 isolate, ExternalUint8Array::New(data, length, peer, callback)); |
| 2009 } | 1988 } |
| 2010 | 1989 |
| 2011 | 1990 |
| 2012 DART_EXPORT Dart_Handle Dart_ExternalByteArrayGetPeer(Dart_Handle object, | 1991 DART_EXPORT Dart_Handle Dart_ExternalByteArrayGetPeer(Dart_Handle object, |
| 2013 void** peer) { | 1992 void** peer) { |
| 2014 Isolate* isolate = Isolate::Current(); | 1993 Isolate* isolate = Isolate::Current(); |
| 2015 DARTSCOPE(isolate); | 1994 DARTSCOPE(isolate); |
| 2016 const ExternalByteArray& array = | 1995 const ExternalUint8Array& array = |
| 2017 Api::UnwrapExternalByteArrayHandle(isolate, object); | 1996 Api::UnwrapExternalUint8ArrayHandle(isolate, object); |
| 2018 if (array.IsNull()) { | 1997 if (array.IsNull()) { |
| 2019 RETURN_TYPE_ERROR(isolate, object, ExternalByteArray); | 1998 RETURN_TYPE_ERROR(isolate, object, ExternalUint8Array); |
| 2020 } | 1999 } |
| 2021 if (peer == NULL) { | 2000 if (peer == NULL) { |
| 2022 return Api::NewError("%s expects argument 'peer' to be non-null.", | 2001 return Api::NewError("%s expects argument 'peer' to be non-null.", |
| 2023 CURRENT_FUNC); | 2002 CURRENT_FUNC); |
| 2024 } | 2003 } |
| 2025 *peer = array.GetPeer(); | 2004 *peer = array.GetPeer(); |
| 2026 return Api::Success(isolate); | 2005 return Api::Success(isolate); |
| 2027 } | 2006 } |
| 2028 | 2007 |
| 2029 | 2008 |
| 2030 template<typename T> | 2009 template<typename T> |
| 2031 Dart_Handle ByteArrayGetAt(T* value, Dart_Handle array, intptr_t offset) { | 2010 Dart_Handle ByteArrayGetAt(T* value, Dart_Handle array, intptr_t offset) { |
| 2032 Isolate* isolate = Isolate::Current(); | 2011 Isolate* isolate = Isolate::Current(); |
| 2033 CHECK_ISOLATE(isolate); | 2012 CHECK_ISOLATE(isolate); |
| 2034 const ByteArray& array_obj = Api::UnwrapByteArrayHandle(isolate, array); | 2013 const ByteArray& array_obj = Api::UnwrapByteArrayHandle(isolate, array); |
| 2035 if (array_obj.IsNull()) { | 2014 if (array_obj.IsNull()) { |
| 2036 RETURN_TYPE_ERROR(isolate, array, ByteArray); | 2015 RETURN_TYPE_ERROR(isolate, array, ByteArray); |
| 2037 } | 2016 } |
| 2038 intptr_t length = sizeof(T); | 2017 intptr_t length = sizeof(T); |
| 2039 if (!Utils::RangeCheck(offset, length, array_obj.Length())) { | 2018 if (!Utils::RangeCheck(offset, length, array_obj.ByteLength())) { |
| 2040 return Api::NewError("Invalid index passed in to get byte array element"); | 2019 return Api::NewError("Invalid index passed in to get byte array element"); |
| 2041 } | 2020 } |
| 2042 uint8_t* dst = reinterpret_cast<uint8_t*>(value); | 2021 uint8_t* dst = reinterpret_cast<uint8_t*>(value); |
| 2043 ByteArray::Copy(dst, array_obj, offset, length); | 2022 ByteArray::Copy(dst, array_obj, offset, length); |
| 2044 return Api::Success(isolate); | 2023 return Api::Success(isolate); |
| 2045 } | 2024 } |
| 2046 | 2025 |
| 2047 | 2026 |
| 2048 template<typename T> | 2027 template<typename T> |
| 2049 Dart_Handle ByteArraySetAt(Dart_Handle array, intptr_t offset, T value) { | 2028 Dart_Handle ByteArraySetAt(Dart_Handle array, intptr_t offset, T value) { |
| 2050 Isolate* isolate = Isolate::Current(); | 2029 Isolate* isolate = Isolate::Current(); |
| 2051 CHECK_ISOLATE(isolate); | 2030 CHECK_ISOLATE(isolate); |
| 2052 const ByteArray& array_obj = Api::UnwrapByteArrayHandle(isolate, array); | 2031 const ByteArray& array_obj = Api::UnwrapByteArrayHandle(isolate, array); |
| 2053 if (array_obj.IsNull()) { | 2032 if (array_obj.IsNull()) { |
| 2054 RETURN_TYPE_ERROR(isolate, array, ByteArray); | 2033 RETURN_TYPE_ERROR(isolate, array, ByteArray); |
| 2055 } | 2034 } |
| 2056 intptr_t length = sizeof(T); | 2035 intptr_t length = sizeof(T); |
| 2057 if (!Utils::RangeCheck(offset, length, array_obj.Length())) { | 2036 if (!Utils::RangeCheck(offset, length, array_obj.ByteLength())) { |
| 2058 return Api::NewError("Invalid index passed in to get byte array element"); | 2037 return Api::NewError("Invalid index passed in to get byte array element"); |
| 2059 } | 2038 } |
| 2060 const uint8_t* src = reinterpret_cast<uint8_t*>(&value); | 2039 const uint8_t* src = reinterpret_cast<uint8_t*>(&value); |
| 2061 ByteArray::Copy(array_obj, offset, src, length); | 2040 ByteArray::Copy(array_obj, offset, src, length); |
| 2062 return Api::Success(isolate); | 2041 return Api::Success(isolate); |
| 2063 } | 2042 } |
| 2064 | 2043 |
| 2065 | 2044 |
| 2066 DART_EXPORT Dart_Handle Dart_ByteArrayGetInt8At(Dart_Handle array, | 2045 DART_EXPORT Dart_Handle Dart_ByteArrayGetInt8At(Dart_Handle array, |
| 2067 intptr_t offset, | 2046 intptr_t byte_offset, |
| 2068 int8_t* value) { | 2047 int8_t* value) { |
| 2069 return ByteArrayGetAt(value, array, offset); | 2048 return ByteArrayGetAt(value, array, byte_offset); |
| 2070 } | 2049 } |
| 2071 | 2050 |
| 2072 | 2051 |
| 2073 DART_EXPORT Dart_Handle Dart_ByteArraySetInt8At(Dart_Handle array, | 2052 DART_EXPORT Dart_Handle Dart_ByteArraySetInt8At(Dart_Handle array, |
| 2074 intptr_t offset, | 2053 intptr_t byte_offset, |
| 2075 int8_t value) { | 2054 int8_t value) { |
| 2076 return ByteArraySetAt(array, offset, value); | 2055 return ByteArraySetAt(array, byte_offset, value); |
| 2077 } | 2056 } |
| 2078 | 2057 |
| 2079 | 2058 |
| 2080 DART_EXPORT Dart_Handle Dart_ByteArrayGetUint8At(Dart_Handle array, | 2059 DART_EXPORT Dart_Handle Dart_ByteArrayGetUint8At(Dart_Handle array, |
| 2081 intptr_t offset, | 2060 intptr_t byte_offset, |
| 2082 uint8_t* value) { | 2061 uint8_t* value) { |
| 2083 return ByteArrayGetAt(value, array, offset); | 2062 return ByteArrayGetAt(value, array, byte_offset); |
| 2084 } | 2063 } |
| 2085 | 2064 |
| 2086 | 2065 |
| 2087 DART_EXPORT Dart_Handle Dart_ByteArraySetUint8At(Dart_Handle array, | 2066 DART_EXPORT Dart_Handle Dart_ByteArraySetUint8At(Dart_Handle array, |
| 2088 intptr_t offset, | 2067 intptr_t byte_offset, |
| 2089 uint8_t value) { | 2068 uint8_t value) { |
| 2090 return ByteArraySetAt(array, offset, value); | 2069 return ByteArraySetAt(array, byte_offset, value); |
| 2091 } | 2070 } |
| 2092 | 2071 |
| 2093 | 2072 |
| 2094 DART_EXPORT Dart_Handle Dart_ByteArrayGetInt16At(Dart_Handle array, | 2073 DART_EXPORT Dart_Handle Dart_ByteArrayGetInt16At(Dart_Handle array, |
| 2095 intptr_t offset, | 2074 intptr_t byte_offset, |
| 2096 int16_t* value) { | 2075 int16_t* value) { |
| 2097 return ByteArrayGetAt(value, array, offset); | 2076 return ByteArrayGetAt(value, array, byte_offset); |
| 2098 } | 2077 } |
| 2099 | 2078 |
| 2100 | 2079 |
| 2101 DART_EXPORT Dart_Handle Dart_ByteArraySetInt16At(Dart_Handle array, | 2080 DART_EXPORT Dart_Handle Dart_ByteArraySetInt16At(Dart_Handle array, |
| 2102 intptr_t offset, | 2081 intptr_t byte_offset, |
| 2103 int16_t value) { | 2082 int16_t value) { |
| 2104 return ByteArraySetAt(array, offset, value); | 2083 return ByteArraySetAt(array, byte_offset, value); |
| 2105 } | 2084 } |
| 2106 | 2085 |
| 2107 | 2086 |
| 2108 DART_EXPORT Dart_Handle Dart_ByteArrayGetUint16At(Dart_Handle array, | 2087 DART_EXPORT Dart_Handle Dart_ByteArrayGetUint16At(Dart_Handle array, |
| 2109 intptr_t offset, | 2088 intptr_t byte_offset, |
| 2110 uint16_t* value) { | 2089 uint16_t* value) { |
| 2111 return ByteArrayGetAt(value, array, offset); | 2090 return ByteArrayGetAt(value, array, byte_offset); |
| 2112 } | 2091 } |
| 2113 | 2092 |
| 2114 | 2093 |
| 2115 DART_EXPORT Dart_Handle Dart_ByteArraySetUint16At(Dart_Handle array, | 2094 DART_EXPORT Dart_Handle Dart_ByteArraySetUint16At(Dart_Handle array, |
| 2116 intptr_t offset, | 2095 intptr_t byte_offset, |
| 2117 uint16_t value) { | 2096 uint16_t value) { |
| 2118 return ByteArraySetAt(array, offset, value); | 2097 return ByteArraySetAt(array, byte_offset, value); |
| 2119 } | 2098 } |
| 2120 | 2099 |
| 2121 | 2100 |
| 2122 DART_EXPORT Dart_Handle Dart_ByteArrayGetInt32At(Dart_Handle array, | 2101 DART_EXPORT Dart_Handle Dart_ByteArrayGetInt32At(Dart_Handle array, |
| 2123 intptr_t offset, | 2102 intptr_t byte_offset, |
| 2124 int32_t* value) { | 2103 int32_t* value) { |
| 2125 return ByteArrayGetAt(value, array, offset); | 2104 return ByteArrayGetAt(value, array, byte_offset); |
| 2126 } | 2105 } |
| 2127 | 2106 |
| 2128 | 2107 |
| 2129 DART_EXPORT Dart_Handle Dart_ByteArraySetInt32At(Dart_Handle array, | 2108 DART_EXPORT Dart_Handle Dart_ByteArraySetInt32At(Dart_Handle array, |
| 2130 intptr_t offset, | 2109 intptr_t byte_offset, |
| 2131 int32_t value) { | 2110 int32_t value) { |
| 2132 return ByteArraySetAt(array, offset, value); | 2111 return ByteArraySetAt(array, byte_offset, value); |
| 2133 } | 2112 } |
| 2134 | 2113 |
| 2135 | 2114 |
| 2136 DART_EXPORT Dart_Handle Dart_ByteArrayGetUint32At(Dart_Handle array, | 2115 DART_EXPORT Dart_Handle Dart_ByteArrayGetUint32At(Dart_Handle array, |
| 2137 intptr_t offset, | 2116 intptr_t byte_offset, |
| 2138 uint32_t* value) { | 2117 uint32_t* value) { |
| 2139 return ByteArrayGetAt(value, array, offset); | 2118 return ByteArrayGetAt(value, array, byte_offset); |
| 2140 } | 2119 } |
| 2141 | 2120 |
| 2142 | 2121 |
| 2143 DART_EXPORT Dart_Handle Dart_ByteArraySetUint32At(Dart_Handle array, | 2122 DART_EXPORT Dart_Handle Dart_ByteArraySetUint32At(Dart_Handle array, |
| 2144 intptr_t offset, | 2123 intptr_t byte_offset, |
| 2145 uint32_t value) { | 2124 uint32_t value) { |
| 2146 return ByteArraySetAt(array, offset, value); | 2125 return ByteArraySetAt(array, byte_offset, value); |
| 2147 } | 2126 } |
| 2148 | 2127 |
| 2149 | 2128 |
| 2150 DART_EXPORT Dart_Handle Dart_ByteArrayGetInt64At(Dart_Handle array, | 2129 DART_EXPORT Dart_Handle Dart_ByteArrayGetInt64At(Dart_Handle array, |
| 2151 intptr_t offset, | 2130 intptr_t byte_offset, |
| 2152 int64_t* value) { | 2131 int64_t* value) { |
| 2153 return ByteArrayGetAt(value, array, offset); | 2132 return ByteArrayGetAt(value, array, byte_offset); |
| 2154 } | 2133 } |
| 2155 | 2134 |
| 2156 | 2135 |
| 2157 DART_EXPORT Dart_Handle Dart_ByteArraySetInt64At(Dart_Handle array, | 2136 DART_EXPORT Dart_Handle Dart_ByteArraySetInt64At(Dart_Handle array, |
| 2158 intptr_t offset, | 2137 intptr_t byte_offset, |
| 2159 int64_t value) { | 2138 int64_t value) { |
| 2160 return ByteArraySetAt(array, offset, value); | 2139 return ByteArraySetAt(array, byte_offset, value); |
| 2161 } | 2140 } |
| 2162 | 2141 |
| 2163 | 2142 |
| 2164 DART_EXPORT Dart_Handle Dart_ByteArrayGetUint64At(Dart_Handle array, | 2143 DART_EXPORT Dart_Handle Dart_ByteArrayGetUint64At(Dart_Handle array, |
| 2165 intptr_t offset, | 2144 intptr_t byte_offset, |
| 2166 uint64_t* value) { | 2145 uint64_t* value) { |
| 2167 return ByteArrayGetAt(value, array, offset); | 2146 return ByteArrayGetAt(value, array, byte_offset); |
| 2168 } | 2147 } |
| 2169 | 2148 |
| 2170 | 2149 |
| 2171 DART_EXPORT Dart_Handle Dart_ByteArraySetUint64At(Dart_Handle array, | 2150 DART_EXPORT Dart_Handle Dart_ByteArraySetUint64At(Dart_Handle array, |
| 2172 intptr_t offset, | 2151 intptr_t byte_offset, |
| 2173 uint64_t value) { | 2152 uint64_t value) { |
| 2174 return ByteArraySetAt(array, offset, value); | 2153 return ByteArraySetAt(array, byte_offset, value); |
| 2175 } | 2154 } |
| 2176 | 2155 |
| 2177 | 2156 |
| 2178 DART_EXPORT Dart_Handle Dart_ByteArrayGetFloat32At(Dart_Handle array, | 2157 DART_EXPORT Dart_Handle Dart_ByteArrayGetFloat32At(Dart_Handle array, |
| 2179 intptr_t offset, | 2158 intptr_t byte_offset, |
| 2180 float* value) { | 2159 float* value) { |
| 2181 return ByteArrayGetAt(value, array, offset); | 2160 return ByteArrayGetAt(value, array, byte_offset); |
| 2182 } | 2161 } |
| 2183 | 2162 |
| 2184 | 2163 |
| 2185 DART_EXPORT Dart_Handle Dart_ByteArraySetFloat32At(Dart_Handle array, | 2164 DART_EXPORT Dart_Handle Dart_ByteArraySetFloat32At(Dart_Handle array, |
| 2186 intptr_t offset, | 2165 intptr_t byte_offset, |
| 2187 float value) { | 2166 float value) { |
| 2188 return ByteArraySetAt(array, offset, value); | 2167 return ByteArraySetAt(array, byte_offset, value); |
| 2189 } | 2168 } |
| 2190 | 2169 |
| 2191 | 2170 |
| 2192 DART_EXPORT Dart_Handle Dart_ByteArrayGetFloat64At(Dart_Handle array, | 2171 DART_EXPORT Dart_Handle Dart_ByteArrayGetFloat64At(Dart_Handle array, |
| 2193 intptr_t offset, | 2172 intptr_t byte_offset, |
| 2194 double* value) { | 2173 double* value) { |
| 2195 return ByteArrayGetAt(value, array, offset); | 2174 return ByteArrayGetAt(value, array, byte_offset); |
| 2196 } | 2175 } |
| 2197 | 2176 |
| 2198 | 2177 |
| 2199 DART_EXPORT Dart_Handle Dart_ByteArraySetFloat64At(Dart_Handle array, | 2178 DART_EXPORT Dart_Handle Dart_ByteArraySetFloat64At(Dart_Handle array, |
| 2200 intptr_t offset, | 2179 intptr_t byte_offset, |
| 2201 double value) { | 2180 double value) { |
| 2202 return ByteArraySetAt(array, offset, value); | 2181 return ByteArraySetAt(array, byte_offset, value); |
| 2203 } | 2182 } |
| 2204 | 2183 |
| 2205 | 2184 |
| 2206 // --- Closures --- | 2185 // --- Closures --- |
| 2207 | 2186 |
| 2208 | 2187 |
| 2209 DART_EXPORT bool Dart_IsClosure(Dart_Handle object) { | 2188 DART_EXPORT bool Dart_IsClosure(Dart_Handle object) { |
| 2210 Isolate* isolate = Isolate::Current(); | 2189 Isolate* isolate = Isolate::Current(); |
| 2211 DARTSCOPE(isolate); | 2190 DARTSCOPE(isolate); |
| 2212 const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(object)); | 2191 const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(object)); |
| (...skipping 1073 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3286 *buffer = NULL; | 3265 *buffer = NULL; |
| 3287 } | 3266 } |
| 3288 delete debug_region; | 3267 delete debug_region; |
| 3289 } else { | 3268 } else { |
| 3290 *buffer = NULL; | 3269 *buffer = NULL; |
| 3291 *buffer_size = 0; | 3270 *buffer_size = 0; |
| 3292 } | 3271 } |
| 3293 } | 3272 } |
| 3294 | 3273 |
| 3295 } // namespace dart | 3274 } // namespace dart |
| OLD | NEW |