| Index: src/typedarray.js
|
| diff --git a/src/typedarray.js b/src/typedarray.js
|
| index cba8993c236227cb81bbc66eeb27c5c70aeaa005..14275d7ef67150493df4aa20a3aa6b9345c233ca 100644
|
| --- a/src/typedarray.js
|
| +++ b/src/typedarray.js
|
| @@ -100,8 +100,12 @@ macro TYPED_ARRAY_CONSTRUCTOR(ARRAY_ID, NAME, ELEMENT_SIZE)
|
| throw MakeRangeError("invalid_typed_array_length");
|
| }
|
| var byteLength = l * ELEMENT_SIZE;
|
| - var buffer = new $ArrayBuffer(byteLength);
|
| - %TypedArrayInitialize(obj, ARRAY_ID, buffer, 0, byteLength);
|
| + if (byteLength > %TypedArrayMaxSizeInHeap()) {
|
| + var buffer = new $ArrayBuffer(byteLength);
|
| + %TypedArrayInitialize(obj, ARRAY_ID, buffer, 0, byteLength);
|
| + } else {
|
| + %TypedArrayInitialize(obj, ARRAY_ID, null, 0, byteLength);
|
| + }
|
| }
|
|
|
| function NAMEConstructByArrayLike(obj, arrayLike) {
|
| @@ -180,8 +184,8 @@ function CreateSubArray(elementSize, constructor) {
|
| }
|
| var newLength = endInt - beginInt;
|
| var beginByteOffset =
|
| - %TypedArrayGetByteOffset(this) + beginInt * elementSize;
|
| - return new constructor(%TypedArrayGetBuffer(this),
|
| + this.byteOffset + beginInt * elementSize;
|
| + return new constructor(this.buffer,
|
| beginByteOffset, newLength);
|
| }
|
| }
|
|
|