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

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

Issue 1677063005: Revert of [builtins] Remove bunch of uses of %_Arguments and %_ArgumentsLength. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 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/js/spread.js ('k') | no next file » | 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
(...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 %FunctionSetLength(TypedArrayIndexOf, 1); 610 %FunctionSetLength(TypedArrayIndexOf, 1);
611 611
612 612
613 // ES6 section 22.2.3.16 613 // ES6 section 22.2.3.16
614 function TypedArrayLastIndexOf(element, index) { 614 function TypedArrayLastIndexOf(element, index) {
615 if (!%_IsTypedArray(this)) throw MakeTypeError(kNotTypedArray); 615 if (!%_IsTypedArray(this)) throw MakeTypeError(kNotTypedArray);
616 616
617 var length = %_TypedArrayGetLength(this); 617 var length = %_TypedArrayGetLength(this);
618 618
619 return InnerArrayLastIndexOf(this, element, index, length, 619 return InnerArrayLastIndexOf(this, element, index, length,
620 arguments.length); 620 %_ArgumentsLength());
621 } 621 }
622 %FunctionSetLength(TypedArrayLastIndexOf, 1); 622 %FunctionSetLength(TypedArrayLastIndexOf, 1);
623 623
624 624
625 // ES6 draft 07-15-13, section 22.2.3.18 625 // ES6 draft 07-15-13, section 22.2.3.18
626 function TypedArrayMap(f, thisArg) { 626 function TypedArrayMap(f, thisArg) {
627 if (!%_IsTypedArray(this)) throw MakeTypeError(kNotTypedArray); 627 if (!%_IsTypedArray(this)) throw MakeTypeError(kNotTypedArray);
628 628
629 var length = %_TypedArrayGetLength(this); 629 var length = %_TypedArrayGetLength(this);
630 var result = TypedArraySpeciesCreate(this, length); 630 var result = TypedArraySpeciesCreate(this, length);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
674 return InnerArrayJoin(separator, this, length); 674 return InnerArrayJoin(separator, this, length);
675 } 675 }
676 676
677 677
678 // ES6 draft 07-15-13, section 22.2.3.19 678 // ES6 draft 07-15-13, section 22.2.3.19
679 function TypedArrayReduce(callback, current) { 679 function TypedArrayReduce(callback, current) {
680 if (!%_IsTypedArray(this)) throw MakeTypeError(kNotTypedArray); 680 if (!%_IsTypedArray(this)) throw MakeTypeError(kNotTypedArray);
681 681
682 var length = %_TypedArrayGetLength(this); 682 var length = %_TypedArrayGetLength(this);
683 return InnerArrayReduce(callback, current, this, length, 683 return InnerArrayReduce(callback, current, this, length,
684 arguments.length); 684 %_ArgumentsLength());
685 } 685 }
686 %FunctionSetLength(TypedArrayReduce, 1); 686 %FunctionSetLength(TypedArrayReduce, 1);
687 687
688 688
689 // ES6 draft 07-15-13, section 22.2.3.19 689 // ES6 draft 07-15-13, section 22.2.3.19
690 function TypedArrayReduceRight(callback, current) { 690 function TypedArrayReduceRight(callback, current) {
691 if (!%_IsTypedArray(this)) throw MakeTypeError(kNotTypedArray); 691 if (!%_IsTypedArray(this)) throw MakeTypeError(kNotTypedArray);
692 692
693 var length = %_TypedArrayGetLength(this); 693 var length = %_TypedArrayGetLength(this);
694 return InnerArrayReduceRight(callback, current, this, length, 694 return InnerArrayReduceRight(callback, current, this, length,
695 arguments.length); 695 %_ArgumentsLength());
696 } 696 }
697 %FunctionSetLength(TypedArrayReduceRight, 1); 697 %FunctionSetLength(TypedArrayReduceRight, 1);
698 698
699 699
700 function TypedArraySlice(start, end) { 700 function TypedArraySlice(start, end) {
701 if (!%_IsTypedArray(this)) throw MakeTypeError(kNotTypedArray); 701 if (!%_IsTypedArray(this)) throw MakeTypeError(kNotTypedArray);
702 var len = %_TypedArrayGetLength(this); 702 var len = %_TypedArrayGetLength(this);
703 703
704 var relativeStart = TO_INTEGER(start); 704 var relativeStart = TO_INTEGER(start);
705 705
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
746 746
747 var length = %_TypedArrayGetLength(this); 747 var length = %_TypedArrayGetLength(this);
748 748
749 return InnerArrayIncludes(searchElement, fromIndex, this, length); 749 return InnerArrayIncludes(searchElement, fromIndex, this, length);
750 } 750 }
751 %FunctionSetLength(TypedArrayIncludes, 1); 751 %FunctionSetLength(TypedArrayIncludes, 1);
752 752
753 753
754 // ES6 draft 08-24-14, section 22.2.2.2 754 // ES6 draft 08-24-14, section 22.2.2.2
755 function TypedArrayOf() { 755 function TypedArrayOf() {
756 var length = arguments.length; 756 var length = %_ArgumentsLength();
757 var array = TypedArrayCreate(this, length); 757 var array = TypedArrayCreate(this, length);
758 for (var i = 0; i < length; i++) { 758 for (var i = 0; i < length; i++) {
759 array[i] = arguments[i]; 759 array[i] = %_Arguments(i);
760 } 760 }
761 return array; 761 return array;
762 } 762 }
763 763
764 764
765 function TypedArrayFrom(source, mapfn, thisArg) { 765 function TypedArrayFrom(source, mapfn, thisArg) {
766 // TODO(littledan): Investigate if there is a receiver which could be 766 // TODO(littledan): Investigate if there is a receiver which could be
767 // faster to accumulate on than Array, e.g., a TypedVector. 767 // faster to accumulate on than Array, e.g., a TypedVector.
768 // TODO(littledan): Rewrite this code to ensure that things happen 768 // TODO(littledan): Rewrite this code to ensure that things happen
769 // in the right order, e.g., the constructor needs to be called before 769 // in the right order, e.g., the constructor needs to be called before
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
913 FUNCTION(Float64) 913 FUNCTION(Float64)
914 endmacro 914 endmacro
915 915
916 916
917 macro DATA_VIEW_GETTER_SETTER(TYPENAME) 917 macro DATA_VIEW_GETTER_SETTER(TYPENAME)
918 function DataViewGetTYPENAMEJS(offset, little_endian) { 918 function DataViewGetTYPENAMEJS(offset, little_endian) {
919 if (!IS_DATAVIEW(this)) { 919 if (!IS_DATAVIEW(this)) {
920 throw MakeTypeError(kIncompatibleMethodReceiver, 920 throw MakeTypeError(kIncompatibleMethodReceiver,
921 'DataView.getTYPENAME', this); 921 'DataView.getTYPENAME', this);
922 } 922 }
923 if (arguments.length < 1) throw MakeTypeError(kInvalidArgument); 923 if (%_ArgumentsLength() < 1) throw MakeTypeError(kInvalidArgument);
924 offset = ToPositiveInteger(offset, kInvalidDataViewAccessorOffset); 924 offset = ToPositiveInteger(offset, kInvalidDataViewAccessorOffset);
925 little_endian = TO_BOOLEAN(little_endian); 925 return %DataViewGetTYPENAME(this, offset, !!little_endian);
926 return %DataViewGetTYPENAME(this, offset, little_endian);
927 } 926 }
928 %FunctionSetLength(DataViewGetTYPENAMEJS, 1); 927 %FunctionSetLength(DataViewGetTYPENAMEJS, 1);
929 928
930 function DataViewSetTYPENAMEJS(offset, value, little_endian) { 929 function DataViewSetTYPENAMEJS(offset, value, little_endian) {
931 if (!IS_DATAVIEW(this)) { 930 if (!IS_DATAVIEW(this)) {
932 throw MakeTypeError(kIncompatibleMethodReceiver, 931 throw MakeTypeError(kIncompatibleMethodReceiver,
933 'DataView.setTYPENAME', this); 932 'DataView.setTYPENAME', this);
934 } 933 }
935 if (arguments.length < 2) throw MakeTypeError(kInvalidArgument); 934 if (%_ArgumentsLength() < 2) throw MakeTypeError(kInvalidArgument);
936 offset = ToPositiveInteger(offset, kInvalidDataViewAccessorOffset); 935 offset = ToPositiveInteger(offset, kInvalidDataViewAccessorOffset);
937 little_endian = TO_BOOLEAN(little_endian); 936 %DataViewSetTYPENAME(this, offset, TO_NUMBER(value), !!little_endian);
938 %DataViewSetTYPENAME(this, offset, TO_NUMBER(value), little_endian);
939 } 937 }
940 %FunctionSetLength(DataViewSetTYPENAMEJS, 2); 938 %FunctionSetLength(DataViewSetTYPENAMEJS, 2);
941 endmacro 939 endmacro
942 940
943 DATA_VIEW_TYPES(DATA_VIEW_GETTER_SETTER) 941 DATA_VIEW_TYPES(DATA_VIEW_GETTER_SETTER)
944 942
945 // Setup the DataView constructor. 943 // Setup the DataView constructor.
946 %SetCode(GlobalDataView, DataViewConstructor); 944 %SetCode(GlobalDataView, DataViewConstructor);
947 %FunctionSetPrototype(GlobalDataView, new GlobalObject); 945 %FunctionSetPrototype(GlobalDataView, new GlobalObject);
948 946
(...skipping 29 matching lines...) Expand all
978 "setUint32", DataViewSetUint32JS, 976 "setUint32", DataViewSetUint32JS,
979 977
980 "getFloat32", DataViewGetFloat32JS, 978 "getFloat32", DataViewGetFloat32JS,
981 "setFloat32", DataViewSetFloat32JS, 979 "setFloat32", DataViewSetFloat32JS,
982 980
983 "getFloat64", DataViewGetFloat64JS, 981 "getFloat64", DataViewGetFloat64JS,
984 "setFloat64", DataViewSetFloat64JS 982 "setFloat64", DataViewSetFloat64JS
985 ]); 983 ]);
986 984
987 }) 985 })
OLDNEW
« no previous file with comments | « src/js/spread.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698