Index: src/typedarray.js |
diff --git a/src/typedarray.js b/src/typedarray.js |
index d13ee61e2fd973d9e5b23997edb27ab664bcaa17..109d627008daeb7115c60196aabbafadc84edeca 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) { |