| Index: src/harmony-typedarray.js
|
| diff --git a/src/harmony-typedarray.js b/src/harmony-typedarray.js
|
| index 9b7cd0debf7f3dc1938b89ab2d18eecb6ef0d155..5b666b5645f09a676b2cf8606f0f5a7b16d266dc 100644
|
| --- a/src/harmony-typedarray.js
|
| +++ b/src/harmony-typedarray.js
|
| @@ -31,6 +31,40 @@ 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
|
| + if (!%IsTypedArray(this)) {
|
| + throw MakeTypeError('not_typed_array', []);
|
| + }
|
| + if (!IS_SPEC_FUNCTION(f)) throw MakeTypeError(kCalledNonCallable, f);
|
| +
|
| + var length = %_TypedArrayGetLength(this);
|
| + var receiver;
|
| +
|
| + if (%_ArgumentsLength() > 1) {
|
| + receiver = %_Arguments(1);
|
| + }
|
| +
|
| + var needs_wrapper = false;
|
| + if (IS_NULL(receiver)) {
|
| + if (%IsSloppyModeFunction(mapfn)) receiver = UNDEFINED;
|
| + } else if (!IS_UNDEFINED(receiver)) {
|
| + 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.3.12
|
| function NAMEForEach(f /* thisArg */) { // length == 1
|
| if (!%IsTypedArray(this)) throw MakeTypeError(kNotTypedArray);
|
| @@ -83,6 +117,7 @@ macro EXTEND_TYPED_ARRAY(ARRAY_ID, NAME, ELEMENT_SIZE)
|
|
|
| // Set up non-enumerable functions on the prototype object.
|
| $installFunctions(GlobalNAME.prototype, DONT_ENUM, [
|
| + "every", NAMEEvery,
|
| "forEach", NAMEForEach
|
| ]);
|
| endmacro
|
|
|