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

Unified Diff: src/harmony-typedarray.js

Issue 1126313003: Make one copy for all TypedArray methods (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Cleaner tests 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/mjsunit/harmony/typedarray-proto.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/harmony-typedarray.js
diff --git a/src/harmony-typedarray.js b/src/harmony-typedarray.js
index 5b666b5645f09a676b2cf8606f0f5a7b16d266dc..793e855ae72d3a2df2a92f021045813fb4d9834c 100644
--- a/src/harmony-typedarray.js
+++ b/src/harmony-typedarray.js
@@ -10,18 +10,18 @@
macro TYPED_ARRAYS(FUNCTION)
// arrayIds below should be synchronized with Runtime_TypedArrayInitialize.
-FUNCTION(1, Uint8Array, 1)
-FUNCTION(2, Int8Array, 1)
-FUNCTION(3, Uint16Array, 2)
-FUNCTION(4, Int16Array, 2)
-FUNCTION(5, Uint32Array, 4)
-FUNCTION(6, Int32Array, 4)
-FUNCTION(7, Float32Array, 4)
-FUNCTION(8, Float64Array, 8)
-FUNCTION(9, Uint8ClampedArray, 1)
+FUNCTION(Uint8Array)
+FUNCTION(Int8Array)
+FUNCTION(Uint16Array)
+FUNCTION(Int16Array)
+FUNCTION(Uint32Array)
+FUNCTION(Int32Array)
+FUNCTION(Float32Array)
+FUNCTION(Float64Array)
+FUNCTION(Uint8ClampedArray)
endmacro
-macro DECLARE_GLOBALS(INDEX, NAME, SIZE)
+macro DECLARE_GLOBALS(NAME)
var GlobalNAME = global.NAME;
endmacro
@@ -29,10 +29,8 @@ TYPED_ARRAYS(DECLARE_GLOBALS)
// -------------------------------------------------------------------
-macro TYPED_ARRAY_HARMONY_ADDITIONS(ARRAY_ID, NAME, ELEMENT_SIZE)
-
// ES6 draft 05-05-15, section 22.2.3.7
-function NAMEEvery(f /* thisArg */) { // length == 1
+function TypedArrayEvery(f /* thisArg */) { // length == 1
if (!%IsTypedArray(this)) {
throw MakeTypeError('not_typed_array', []);
}
@@ -66,7 +64,7 @@ function NAMEEvery(f /* thisArg */) { // length == 1
}
// ES6 draft 08-24-14, section 22.2.3.12
-function NAMEForEach(f /* thisArg */) { // length == 1
+function TypedArrayForEach(f /* thisArg */) { // length == 1
if (!%IsTypedArray(this)) throw MakeTypeError(kNotTypedArray);
if (!IS_SPEC_FUNCTION(f)) throw MakeTypeError(kCalledNonCallable, f);
@@ -95,7 +93,7 @@ function NAMEForEach(f /* thisArg */) { // length == 1
}
// ES6 draft 08-24-14, section 22.2.2.2
-function NAMEOf() { // length == 0
+function TypedArrayOf() { // length == 0
var length = %_ArgumentsLength();
var array = new this(length);
for (var i = 0; i < length; i++) {
@@ -104,21 +102,16 @@ function NAMEOf() { // length == 0
return array;
}
-endmacro
-
-TYPED_ARRAYS(TYPED_ARRAY_HARMONY_ADDITIONS)
-
-
-macro EXTEND_TYPED_ARRAY(ARRAY_ID, NAME, ELEMENT_SIZE)
+macro EXTEND_TYPED_ARRAY(NAME)
// Set up non-enumerable functions on the object.
$installFunctions(GlobalNAME, DONT_ENUM | DONT_DELETE | READ_ONLY, [
- "of", NAMEOf
+ "of", TypedArrayOf
]);
// Set up non-enumerable functions on the prototype object.
$installFunctions(GlobalNAME.prototype, DONT_ENUM, [
- "every", NAMEEvery,
- "forEach", NAMEForEach
+ "every", TypedArrayEvery,
+ "forEach", TypedArrayForEach
]);
endmacro
« no previous file with comments | « no previous file | test/mjsunit/harmony/typedarray-proto.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698