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

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

Issue 1131113002: TypedArray.prototype.copyWithin method (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: better description Created 5 years, 7 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/harmony-array.js ('k') | test/mjsunit/harmony/typedarray-copywithin.js » ('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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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, exports) { 5 (function(global, exports) {
6 6
7 "use strict"; 7 "use strict";
8 8
9 %CheckIsBootstrapping(); 9 %CheckIsBootstrapping();
10 10
(...skipping 11 matching lines...) Expand all
22 endmacro 22 endmacro
23 23
24 macro DECLARE_GLOBALS(NAME) 24 macro DECLARE_GLOBALS(NAME)
25 var GlobalNAME = global.NAME; 25 var GlobalNAME = global.NAME;
26 endmacro 26 endmacro
27 27
28 TYPED_ARRAYS(DECLARE_GLOBALS) 28 TYPED_ARRAYS(DECLARE_GLOBALS)
29 29
30 // ------------------------------------------------------------------- 30 // -------------------------------------------------------------------
31 31
32 function TypedArrayCopyWithin(target, start, end) {
33 if (!%IsTypedArray(this)) throw MakeTypeError(kNotTypedArray);
34
35 var length = %_TypedArrayGetLength(this);
36
37 // TODO(dehrenberg): Replace with a memcpy for better performance
38 return $innerArrayCopyWithin(target, start, end, this, length);
39 }
40 %FunctionSetLength(TypedArrayCopyWithin, 2);
41
32 // ES6 draft 05-05-15, section 22.2.3.7 42 // ES6 draft 05-05-15, section 22.2.3.7
33 function TypedArrayEvery(f, receiver) { 43 function TypedArrayEvery(f, receiver) {
34 if (!%IsTypedArray(this)) throw MakeTypeError(kNotTypedArray); 44 if (!%IsTypedArray(this)) throw MakeTypeError(kNotTypedArray);
35 45
36 var length = %_TypedArrayGetLength(this); 46 var length = %_TypedArrayGetLength(this);
37 47
38 return $innerArrayEvery(f, receiver, this, length); 48 return $innerArrayEvery(f, receiver, this, length);
39 } 49 }
40 %FunctionSetLength(TypedArrayEvery, 1); 50 %FunctionSetLength(TypedArrayEvery, 1);
41 51
(...skipping 18 matching lines...) Expand all
60 } 70 }
61 71
62 macro EXTEND_TYPED_ARRAY(NAME) 72 macro EXTEND_TYPED_ARRAY(NAME)
63 // Set up non-enumerable functions on the object. 73 // Set up non-enumerable functions on the object.
64 $installFunctions(GlobalNAME, DONT_ENUM | DONT_DELETE | READ_ONLY, [ 74 $installFunctions(GlobalNAME, DONT_ENUM | DONT_DELETE | READ_ONLY, [
65 "of", TypedArrayOf 75 "of", TypedArrayOf
66 ]); 76 ]);
67 77
68 // Set up non-enumerable functions on the prototype object. 78 // Set up non-enumerable functions on the prototype object.
69 $installFunctions(GlobalNAME.prototype, DONT_ENUM, [ 79 $installFunctions(GlobalNAME.prototype, DONT_ENUM, [
80 "copyWithin", TypedArrayCopyWithin,
70 "every", TypedArrayEvery, 81 "every", TypedArrayEvery,
71 "forEach", TypedArrayForEach 82 "forEach", TypedArrayForEach
72 ]); 83 ]);
73 endmacro 84 endmacro
74 85
75 TYPED_ARRAYS(EXTEND_TYPED_ARRAY) 86 TYPED_ARRAYS(EXTEND_TYPED_ARRAY)
76 87
77 }) 88 })
OLDNEW
« no previous file with comments | « src/harmony-array.js ('k') | test/mjsunit/harmony/typedarray-copywithin.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698