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

Unified Diff: src/array-iterator.js

Issue 336403002: Add @@iterator, .entries(), .values(), .keys() support to typed arrays (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 6 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/typed-array-iterator.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/array-iterator.js
diff --git a/src/array-iterator.js b/src/array-iterator.js
index 40e6e80ce658730b8fc7e73d6d5356bfe7cbdebd..a7cf0e390c2f9002eb990ea1b4b50977a6af7cb1 100644
--- a/src/array-iterator.js
+++ b/src/array-iterator.js
@@ -129,3 +129,30 @@ function ExtendArrayPrototype() {
DONT_ENUM | DONT_DELETE | READ_ONLY);
}
ExtendArrayPrototype();
+
+
+function ExtendTypedArrayPrototypes() {
+ %CheckIsBootstrapping();
+
+macro TYPED_ARRAYS(FUNCTION)
+ FUNCTION(Uint8Array)
+ FUNCTION(Int8Array)
+ FUNCTION(Uint16Array)
+ FUNCTION(Int16Array)
+ FUNCTION(Uint32Array)
+ FUNCTION(Int32Array)
+ FUNCTION(Float32Array)
+ FUNCTION(Float64Array)
+ FUNCTION(Uint8ClampedArray)
+endmacro
+
+macro EXTEND_TYPED_ARRAY(NAME)
+ %SetProperty(global.NAME.prototype, 'entries', ArrayEntries, DONT_ENUM);
rossberg 2014/06/18 09:38:01 Why do you need. 'global.' here?
+ %SetProperty(global.NAME.prototype, 'values', ArrayValues, DONT_ENUM);
+ %SetProperty(global.NAME.prototype, 'keys', ArrayKeys, DONT_ENUM);
+ %SetProperty(global.NAME.prototype, symbolIterator, ArrayValues, DONT_ENUM);
+endmacro
+
+ TYPED_ARRAYS(EXTEND_TYPED_ARRAY)
+}
+ExtendTypedArrayPrototypes();
« no previous file with comments | « no previous file | test/mjsunit/harmony/typed-array-iterator.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698