| Index: src/harmony-typedarray.js
|
| diff --git a/src/harmony-typedarray.js b/src/harmony-typedarray.js
|
| index 014206c4cba8400cf745b9295d5cb223695ad6cb..b09d4e8373ebf2c72806764c9d5a0202329ae25a 100644
|
| --- a/src/harmony-typedarray.js
|
| +++ b/src/harmony-typedarray.js
|
| @@ -59,6 +59,41 @@ function NAMEForEach(f /* thisArg */) { // length == 1
|
| }
|
| }
|
|
|
| +// ES6 draft 09-14-14, section 22.2.3.7
|
| +function NAMEEvery(f /* thisArg */) { // length == 1
|
| + if (!%IsTypedArray(this)) {
|
| + throw MakeTypeError('not_typed_array', []);
|
| + }
|
| + if (!IS_SPEC_FUNCTION(f)) {
|
| + throw MakeTypeError('called_non_callable', [ f ]);
|
| + }
|
| +
|
| + var length = %_TypedArrayGetLength(this);
|
| + var receiver;
|
| +
|
| + if (%_ArgumentsLength() > 1) {
|
| + receiver = %_Arguments(1);
|
| + }
|
| +
|
| + var needs_wrapper = false;
|
| + if (IS_NULL_OR_UNDEFINED(receiver)) {
|
| + receiver = %GetDefaultReceiver(f) || receiver;
|
| + } else {
|
| + needs_wrapper = SHOULD_CREATE_WRAPPER(f, receiver);
|
| + }
|
| +
|
| + var stepping = DEBUG_IS_ACTIVE && %DebugCallbackSupportsStepping(f);
|
| + for (var i = 0; i < length; i++) {
|
| + var element = this[i];
|
| + // Prepare break slots for debugger step in.
|
| + if (stepping) %DebugPrepareStepInIfStepping(f);
|
| + var new_receiver = needs_wrapper ? ToObject(receiver) : receiver;
|
| + if (!%_CallFunction(new_receiver, TO_OBJECT_INLINE(element), i, this, f))
|
| + return false;
|
| + }
|
| + return true;
|
| +}
|
| +
|
| // ES6 draft 08-24-14, section 22.2.2.2
|
| function NAMEOf() { // length == 0
|
| var length = %_ArgumentsLength();
|
| @@ -84,8 +119,9 @@ macro EXTEND_TYPED_ARRAY(ARRAY_ID, NAME, ELEMENT_SIZE)
|
| ));
|
|
|
| // Set up non-enumerable functions on the prototype object.
|
| - InstallFunctions(global.NAME.prototype, DONT_ENUM, $Array(
|
| - "forEach", NAMEForEach
|
| + InstallFunctions(global.NAME.prototype, DONT_ENUM | DONT_DELETE | READ_ONLY, $Array(
|
| + "forEach", NAMEForEach,
|
| + "every", NAMEEvery
|
| ));
|
| endmacro
|
|
|
|
|