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

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

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