Version 3.20.5
Ensured that the length of frozen arrays is immutable (issue 2711,259548)
Performance and stability improvements on all platforms.
git-svn-id: http://v8.googlecode.com/svn/trunk@15657 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
diff --git a/src/typedarray.js b/src/typedarray.js
index 57d0c60..ee1fa9d 100644
--- a/src/typedarray.js
+++ b/src/typedarray.js
@@ -154,7 +154,7 @@
var l = obj.length;
if (IS_UNDEFINED(l)) {
- throw MakeTypeError("invalid_argument");
+ return;
}
if (intOffset + l > this.length) {
throw MakeRangeError("typed_array_set_source_too_large");
@@ -259,6 +259,9 @@
throw MakeTypeError('incompatible_method_reciever',
['DataView.getInt8', this]);
}
+ if (%_ArgumentsLength() < 1) {
+ throw MakeTypeError('invalid_argument');
+ }
return %DataViewGetInt8(this,
ToPositiveDataViewOffset(offset),
!!little_endian);
@@ -269,6 +272,9 @@
throw MakeTypeError('incompatible_method_reciever',
['DataView.setInt8', this]);
}
+ if (%_ArgumentsLength() < 1) {
+ throw MakeTypeError('invalid_argument');
+ }
%DataViewSetInt8(this,
ToPositiveDataViewOffset(offset),
TO_NUMBER_INLINE(value),
@@ -280,6 +286,9 @@
throw MakeTypeError('incompatible_method_reciever',
['DataView.getUint8', this]);
}
+ if (%_ArgumentsLength() < 1) {
+ throw MakeTypeError('invalid_argument');
+ }
return %DataViewGetUint8(this,
ToPositiveDataViewOffset(offset),
!!little_endian);
@@ -290,6 +299,9 @@
throw MakeTypeError('incompatible_method_reciever',
['DataView.setUint8', this]);
}
+ if (%_ArgumentsLength() < 1) {
+ throw MakeTypeError('invalid_argument');
+ }
%DataViewSetUint8(this,
ToPositiveDataViewOffset(offset),
TO_NUMBER_INLINE(value),
@@ -301,6 +313,9 @@
throw MakeTypeError('incompatible_method_reciever',
['DataView.getInt16', this]);
}
+ if (%_ArgumentsLength() < 1) {
+ throw MakeTypeError('invalid_argument');
+ }
return %DataViewGetInt16(this,
ToPositiveDataViewOffset(offset),
!!little_endian);
@@ -311,6 +326,9 @@
throw MakeTypeError('incompatible_method_reciever',
['DataView.setInt16', this]);
}
+ if (%_ArgumentsLength() < 1) {
+ throw MakeTypeError('invalid_argument');
+ }
%DataViewSetInt16(this,
ToPositiveDataViewOffset(offset),
TO_NUMBER_INLINE(value),
@@ -322,6 +340,9 @@
throw MakeTypeError('incompatible_method_reciever',
['DataView.getUint16', this]);
}
+ if (%_ArgumentsLength() < 1) {
+ throw MakeTypeError('invalid_argument');
+ }
return %DataViewGetUint16(this,
ToPositiveDataViewOffset(offset),
!!little_endian);
@@ -332,6 +353,9 @@
throw MakeTypeError('incompatible_method_reciever',
['DataView.setUint16', this]);
}
+ if (%_ArgumentsLength() < 1) {
+ throw MakeTypeError('invalid_argument');
+ }
%DataViewSetUint16(this,
ToPositiveDataViewOffset(offset),
TO_NUMBER_INLINE(value),
@@ -343,6 +367,9 @@
throw MakeTypeError('incompatible_method_reciever',
['DataView.getInt32', this]);
}
+ if (%_ArgumentsLength() < 1) {
+ throw MakeTypeError('invalid_argument');
+ }
return %DataViewGetInt32(this,
ToPositiveDataViewOffset(offset),
!!little_endian);
@@ -353,6 +380,9 @@
throw MakeTypeError('incompatible_method_reciever',
['DataView.setInt32', this]);
}
+ if (%_ArgumentsLength() < 2) {
+ throw MakeTypeError('invalid_argument');
+ }
%DataViewSetInt32(this,
ToPositiveDataViewOffset(offset),
TO_NUMBER_INLINE(value),
@@ -364,6 +394,9 @@
throw MakeTypeError('incompatible_method_reciever',
['DataView.getUint32', this]);
}
+ if (%_ArgumentsLength() < 1) {
+ throw MakeTypeError('invalid_argument');
+ }
return %DataViewGetUint32(this,
ToPositiveDataViewOffset(offset),
!!little_endian);
@@ -374,6 +407,9 @@
throw MakeTypeError('incompatible_method_reciever',
['DataView.setUint32', this]);
}
+ if (%_ArgumentsLength() < 1) {
+ throw MakeTypeError('invalid_argument');
+ }
%DataViewSetUint32(this,
ToPositiveDataViewOffset(offset),
TO_NUMBER_INLINE(value),
@@ -385,6 +421,9 @@
throw MakeTypeError('incompatible_method_reciever',
['DataView.getFloat32', this]);
}
+ if (%_ArgumentsLength() < 1) {
+ throw MakeTypeError('invalid_argument');
+ }
return %DataViewGetFloat32(this,
ToPositiveDataViewOffset(offset),
!!little_endian);
@@ -395,6 +434,9 @@
throw MakeTypeError('incompatible_method_reciever',
['DataView.setFloat32', this]);
}
+ if (%_ArgumentsLength() < 1) {
+ throw MakeTypeError('invalid_argument');
+ }
%DataViewSetFloat32(this,
ToPositiveDataViewOffset(offset),
TO_NUMBER_INLINE(value),
@@ -406,9 +448,8 @@
throw MakeTypeError('incompatible_method_reciever',
['DataView.getFloat64', this]);
}
- offset = TO_INTEGER(offset);
- if (offset < 0) {
- throw MakeRangeError("invalid_data_view_accessor_offset");
+ if (%_ArgumentsLength() < 1) {
+ throw MakeTypeError('invalid_argument');
}
return %DataViewGetFloat64(this,
ToPositiveDataViewOffset(offset),
@@ -420,9 +461,8 @@
throw MakeTypeError('incompatible_method_reciever',
['DataView.setFloat64', this]);
}
- offset = TO_INTEGER(offset);
- if (offset < 0) {
- throw MakeRangeError("invalid_data_view_accessor_offset");
+ if (%_ArgumentsLength() < 1) {
+ throw MakeTypeError('invalid_argument');
}
%DataViewSetFloat64(this,
ToPositiveDataViewOffset(offset),