Index: src/js/typedarray.js |
diff --git a/src/js/typedarray.js b/src/js/typedarray.js |
index 7becd8947a5a9161b1584d3f1e2bfd93a223d7d3..a3dfde3499b4e51b639d9927e3ced7bb81f18e9f 100644 |
--- a/src/js/typedarray.js |
+++ b/src/js/typedarray.js |
@@ -300,8 +300,10 @@ function NAMESubArray(begin, end) { |
var newLength = endInt - beginInt; |
var beginByteOffset = |
%_ArrayBufferViewGetByteOffset(this) + beginInt * ELEMENT_SIZE; |
- return TypedArraySpeciesCreate(this, %TypedArrayGetBuffer(this), |
- beginByteOffset, newLength, true); |
+ // BUG(v8:4665): For web compatibility, subarray needs to always build an |
+ // instance of the default constructor. |
+ // TODO(littledan): Switch to the standard or standardize the fix |
+ return new GlobalNAME(%TypedArrayGetBuffer(this), beginByteOffset, newLength); |
} |
endmacro |