Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(502)

Unified Diff: runtime/lib/byte_array.cc

Issue 11437028: Added Uint8ClampedList. COmpielr optimziations to follow in next CL. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/lib/byte_array.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/byte_array.cc
===================================================================
--- runtime/lib/byte_array.cc (revision 15794)
+++ runtime/lib/byte_array.cc (working copy)
@@ -343,6 +343,30 @@
}
+// Uint8ClampedArray
+
+DEFINE_NATIVE_ENTRY(Uint8ClampedArray_new, 1) {
+ GET_NATIVE_ARGUMENT(Smi, length, arguments->NativeArgAt(0));
+ intptr_t len = length.Value();
+ LengthCheck(len, Uint8ClampedArray::kMaxElements);
+ return Uint8ClampedArray::New(len);
+}
+
+
+DEFINE_NATIVE_ENTRY(Uint8ClampedArray_newTransferable, 1) {
+ GET_NATIVE_ARGUMENT(Smi, length, arguments->NativeArgAt(0));
+ intptr_t len = length.Value();
+ LengthCheck(len, Uint8ClampedArray::kMaxElements);
+ uint8_t* bytes = OS::AllocateAlignedArray<uint8_t>(
+ len,
+ ExternalByteArrayData<uint8_t>::kAlignment);
+ return ExternalUint8ClampedArray::New(bytes,
+ len,
+ bytes,
+ OS::AlignedFree);
+}
+
+
// Int16Array
DEFINE_NATIVE_ENTRY(Int16Array_new, 1) {
« no previous file with comments | « no previous file | runtime/lib/byte_array.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698