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

Unified Diff: src/js/typedarray.js

Issue 2763473002: [typedarrays] Move %TypedArray%.prototype.slice to C++ (Closed)
Patch Set: Add tests Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: src/js/typedarray.js
diff --git a/src/js/typedarray.js b/src/js/typedarray.js
index e4556b706a53fdff42a61693bebbfef90ed8dad2..e19ecaf93fdae65661cd50ae3822b90009e6b6db 100644
--- a/src/js/typedarray.js
+++ b/src/js/typedarray.js
@@ -539,49 +539,6 @@ function TypedArrayReduceRight(callback, current) {
%FunctionSetLength(TypedArrayReduceRight, 1);
-function TypedArraySlice(start, end) {
- if (!IS_TYPEDARRAY(this)) throw %make_type_error(kNotTypedArray);
- var len = %_TypedArrayGetLength(this);
-
- var relativeStart = TO_INTEGER(start);
-
- var k;
- if (relativeStart < 0) {
- k = MaxSimple(len + relativeStart, 0);
- } else {
- k = MinSimple(relativeStart, len);
- }
-
- var relativeEnd;
- if (IS_UNDEFINED(end)) {
- relativeEnd = len;
- } else {
- relativeEnd = TO_INTEGER(end);
- }
-
- var final;
- if (relativeEnd < 0) {
- final = MaxSimple(len + relativeEnd, 0);
- } else {
- final = MinSimple(relativeEnd, len);
- }
-
- var count = MaxSimple(final - k, 0);
- var array = TypedArraySpeciesCreate(this, count);
- // The code below is the 'then' branch; the 'else' branch species
- // a memcpy. Because V8 doesn't canonicalize NaN, the difference is
- // unobservable.
- var n = 0;
- while (k < final) {
- var kValue = this[k];
- array[n] = kValue;
- k++;
- n++;
- }
- return array;
-}
-
-
// ES6 draft 08-24-14, section 22.2.2.2
function TypedArrayOf() {
var length = arguments.length;
@@ -668,7 +625,6 @@ utils.InstallFunctions(GlobalTypedArray.prototype, DONT_ENUM, [
"reduce", TypedArrayReduce,
"reduceRight", TypedArrayReduceRight,
"reverse", TypedArrayReverse,
- "slice", TypedArraySlice,
"some", TypedArraySome,
"sort", TypedArraySort,
"toLocaleString", TypedArrayToLocaleString

Powered by Google App Engine
This is Rietveld 408576698