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

Side by Side Diff: src/typedarray.js

Issue 19562002: Add BYTES_PER_ELEMENT property to constructors of typed arrays. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 months 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | test/mjsunit/harmony/typedarrays.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 173
174 // ------------------------------------------------------------------- 174 // -------------------------------------------------------------------
175 175
176 function SetupTypedArray(arrayId, name, constructor, elementSize) { 176 function SetupTypedArray(arrayId, name, constructor, elementSize) {
177 %CheckIsBootstrapping(); 177 %CheckIsBootstrapping();
178 var fun = CreateTypedArrayConstructor(name, elementSize, 178 var fun = CreateTypedArrayConstructor(name, elementSize,
179 arrayId, constructor); 179 arrayId, constructor);
180 %SetCode(constructor, fun); 180 %SetCode(constructor, fun);
181 %FunctionSetPrototype(constructor, new $Object()); 181 %FunctionSetPrototype(constructor, new $Object());
182 182
183 %SetProperty(constructor, "BYTES_PER_ELEMENT", elementSize,
184 READ_ONLY | DONT_ENUM | DONT_DELETE);
183 %SetProperty(constructor.prototype, 185 %SetProperty(constructor.prototype,
184 "constructor", constructor, DONT_ENUM); 186 "constructor", constructor, DONT_ENUM);
185 %SetProperty(constructor.prototype, 187 %SetProperty(constructor.prototype,
186 "BYTES_PER_ELEMENT", elementSize, 188 "BYTES_PER_ELEMENT", elementSize,
187 READ_ONLY | DONT_ENUM | DONT_DELETE); 189 READ_ONLY | DONT_ENUM | DONT_DELETE);
188 InstallGetter(constructor.prototype, "buffer", TypedArrayGetBuffer); 190 InstallGetter(constructor.prototype, "buffer", TypedArrayGetBuffer);
189 InstallGetter(constructor.prototype, "byteOffset", TypedArrayGetByteOffset); 191 InstallGetter(constructor.prototype, "byteOffset", TypedArrayGetByteOffset);
190 InstallGetter(constructor.prototype, "byteLength", TypedArrayGetByteLength); 192 InstallGetter(constructor.prototype, "byteLength", TypedArrayGetByteLength);
191 InstallGetter(constructor.prototype, "length", TypedArrayGetLength); 193 InstallGetter(constructor.prototype, "length", TypedArrayGetLength);
192 194
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 514
513 "getFloat32", DataViewGetFloat32, 515 "getFloat32", DataViewGetFloat32,
514 "setFloat32", DataViewSetFloat32, 516 "setFloat32", DataViewSetFloat32,
515 517
516 "getFloat64", DataViewGetFloat64, 518 "getFloat64", DataViewGetFloat64,
517 "setFloat64", DataViewSetFloat64 519 "setFloat64", DataViewSetFloat64
518 )); 520 ));
519 } 521 }
520 522
521 SetupDataView(); 523 SetupDataView();
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/harmony/typedarrays.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698