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

Unified Diff: src/js/typedarray.js

Issue 2763473002: [typedarrays] Move %TypedArray%.prototype.slice to C++ (Closed)
Patch Set: rebase 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
« no previous file with comments | « src/elements.cc ('k') | test/mjsunit/es6/typedarray-slice.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/js/typedarray.js
diff --git a/src/js/typedarray.js b/src/js/typedarray.js
index afc749b97661be9f53a7f27f5fb87a5b684b3d72..117148dc5e8e685110d62f764fe67c86149ea745 100644
--- a/src/js/typedarray.js
+++ b/src/js/typedarray.js
@@ -583,49 +583,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;
@@ -710,7 +667,6 @@ utils.InstallFunctions(GlobalTypedArray.prototype, DONT_ENUM, [
"map", TypedArrayMap,
"reduce", TypedArrayReduce,
"reduceRight", TypedArrayReduceRight,
- "slice", TypedArraySlice,
"some", TypedArraySome,
"sort", TypedArraySort,
"toLocaleString", TypedArrayToLocaleString
« no previous file with comments | « src/elements.cc ('k') | test/mjsunit/es6/typedarray-slice.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698