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

Side by Side Diff: src/js/typedarray.js

Issue 2306033002: [turbofan] Migrate remaining DataView builtins to C++. (Closed)
Patch Set: Created 4 years, 3 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
« no previous file with comments | « src/builtins/builtins-dataview.cc ('k') | src/runtime/runtime.h » ('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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 (function(global, utils) { 5 (function(global, utils) {
6 6
7 "use strict"; 7 "use strict";
8 8
9 %CheckIsBootstrapping(); 9 %CheckIsBootstrapping();
10 10
11 // ------------------------------------------------------------------- 11 // -------------------------------------------------------------------
12 // Imports 12 // Imports
13 13
14 // array.js has to come before typedarray.js for this to work 14 // array.js has to come before typedarray.js for this to work
15 var ArrayToString = utils.ImportNow("ArrayToString"); 15 var ArrayToString = utils.ImportNow("ArrayToString");
16 var ArrayValues; 16 var ArrayValues;
17 var GetIterator; 17 var GetIterator;
18 var GetMethod; 18 var GetMethod;
19 var GlobalArray = global.Array; 19 var GlobalArray = global.Array;
20 var GlobalArrayBuffer = global.ArrayBuffer; 20 var GlobalArrayBuffer = global.ArrayBuffer;
21 var GlobalArrayBufferPrototype = GlobalArrayBuffer.prototype; 21 var GlobalArrayBufferPrototype = GlobalArrayBuffer.prototype;
22 var GlobalDataView = global.DataView;
23 var GlobalObject = global.Object; 22 var GlobalObject = global.Object;
24 var InnerArrayCopyWithin; 23 var InnerArrayCopyWithin;
25 var InnerArrayEvery; 24 var InnerArrayEvery;
26 var InnerArrayFill; 25 var InnerArrayFill;
27 var InnerArrayFilter; 26 var InnerArrayFilter;
28 var InnerArrayFind; 27 var InnerArrayFind;
29 var InnerArrayFindIndex; 28 var InnerArrayFindIndex;
30 var InnerArrayForEach; 29 var InnerArrayForEach;
31 var InnerArrayJoin; 30 var InnerArrayJoin;
32 var InnerArrayReduce; 31 var InnerArrayReduce;
(...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after
908 907
909 %AddNamedProperty(GlobalNAME.prototype, 908 %AddNamedProperty(GlobalNAME.prototype,
910 "constructor", global.NAME, DONT_ENUM); 909 "constructor", global.NAME, DONT_ENUM);
911 %AddNamedProperty(GlobalNAME.prototype, 910 %AddNamedProperty(GlobalNAME.prototype,
912 "BYTES_PER_ELEMENT", ELEMENT_SIZE, 911 "BYTES_PER_ELEMENT", ELEMENT_SIZE,
913 READ_ONLY | DONT_ENUM | DONT_DELETE); 912 READ_ONLY | DONT_ENUM | DONT_DELETE);
914 endmacro 913 endmacro
915 914
916 TYPED_ARRAYS(SETUP_TYPED_ARRAY) 915 TYPED_ARRAYS(SETUP_TYPED_ARRAY)
917 916
918 // --------------------------- DataView -----------------------------
919
920 macro DATA_VIEW_TYPES(FUNCTION)
921 FUNCTION(Int8)
922 FUNCTION(Uint8)
923 FUNCTION(Int16)
924 FUNCTION(Uint16)
925 FUNCTION(Int32)
926 FUNCTION(Uint32)
927 FUNCTION(Float32)
928 FUNCTION(Float64)
929 endmacro
930
931
932 macro DATA_VIEW_GETTER_SETTER(TYPENAME)
933 function DataViewGetTYPENAMEJS(offset, little_endian) {
934 if (!IS_DATAVIEW(this)) {
935 throw %make_type_error(kIncompatibleMethodReceiver,
936 'DataView.getTYPENAME', this);
937 }
938 offset = IS_UNDEFINED(offset) ? 0 : ToIndex(offset, kInvalidDataViewAccessorOf fset);
939 return %DataViewGetTYPENAME(this, offset, !!little_endian);
940 }
941 %FunctionSetLength(DataViewGetTYPENAMEJS, 1);
942
943 function DataViewSetTYPENAMEJS(offset, value, little_endian) {
944 if (!IS_DATAVIEW(this)) {
945 throw %make_type_error(kIncompatibleMethodReceiver,
946 'DataView.setTYPENAME', this);
947 }
948 offset = IS_UNDEFINED(offset) ? 0 : ToIndex(offset, kInvalidDataViewAccessorOf fset);
949 %DataViewSetTYPENAME(this, offset, TO_NUMBER(value), !!little_endian);
950 }
951 %FunctionSetLength(DataViewSetTYPENAMEJS, 2);
952 endmacro
953
954 DATA_VIEW_TYPES(DATA_VIEW_GETTER_SETTER)
955
956 utils.InstallFunctions(GlobalDataView.prototype, DONT_ENUM, [
957 "getInt8", DataViewGetInt8JS,
958 "setInt8", DataViewSetInt8JS,
959
960 "getUint8", DataViewGetUint8JS,
961 "setUint8", DataViewSetUint8JS,
962
963 "getInt16", DataViewGetInt16JS,
964 "setInt16", DataViewSetInt16JS,
965
966 "getUint16", DataViewGetUint16JS,
967 "setUint16", DataViewSetUint16JS,
968
969 "getInt32", DataViewGetInt32JS,
970 "setInt32", DataViewSetInt32JS,
971
972 "getUint32", DataViewGetUint32JS,
973 "setUint32", DataViewSetUint32JS,
974
975 "getFloat32", DataViewGetFloat32JS,
976 "setFloat32", DataViewSetFloat32JS,
977
978 "getFloat64", DataViewGetFloat64JS,
979 "setFloat64", DataViewSetFloat64JS
980 ]);
981
982 }) 917 })
OLDNEW
« no previous file with comments | « src/builtins/builtins-dataview.cc ('k') | src/runtime/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698