Revision: 15579
Author: [email protected]
Date: Tue Jul 9 12:34:21 2013
Log: Allow parameterless typed array constructors.
ES6 spec tacitly allows them, and they are allowed in Firefox and in
WebKit/Blink.
[email protected],[email protected]
Review URL: https://codereview.chromium.org/18769005
http://code.google.com/p/v8/source/detail?r=15579
Modified:
/branches/bleeding_edge/src/messages.js
/branches/bleeding_edge/src/typedarray.js
/branches/bleeding_edge/test/mjsunit/harmony/typedarrays.js
=======================================
--- /branches/bleeding_edge/src/messages.js Fri Jul 5 01:34:31 2013
+++ /branches/bleeding_edge/src/messages.js Tue Jul 9 12:34:21 2013
@@ -104,8 +104,6 @@
observe_perform_non_function: ["Cannot perform non-function"],
observe_notify_non_notifier: ["notify called on non-notifier object"],
proto_poison_pill: ["Generic use of __proto__ accessor not
allowed"],
- parameterless_typed_array_constr:
- ["%0"," constructor should have at least
one argument."],
not_typed_array: ["this is not a typed array."],
invalid_argument: ["invalid_argument"],
data_view_not_array_buffer: ["First argument to DataView constructor
must be an ArrayBuffer"],
=======================================
--- /branches/bleeding_edge/src/typedarray.js Thu Jun 27 00:42:08 2013
+++ /branches/bleeding_edge/src/typedarray.js Tue Jul 9 12:34:21 2013
@@ -89,12 +89,11 @@
if (%_IsConstructCall()) {
if (IS_ARRAYBUFFER(arg1)) {
ConstructByArrayBuffer(this, arg1, arg2, arg3);
- } else if (IS_NUMBER(arg1) || IS_STRING(arg1) || IS_BOOLEAN(arg1)) {
+ } else if (IS_NUMBER(arg1) || IS_STRING(arg1) ||
+ IS_BOOLEAN(arg1) || IS_UNDEFINED(arg1)) {
ConstructByLength(this, arg1);
- } else if (!IS_UNDEFINED(arg1)){
+ } else {
ConstructByArrayLike(this, arg1);
- } else {
- throw MakeTypeError("parameterless_typed_array_constr", [name]);
}
} else {
throw MakeTypeError("constructor_not_function", [name])
=======================================
--- /branches/bleeding_edge/test/mjsunit/harmony/typedarrays.js Thu Jun 27
00:42:08 2013
+++ /branches/bleeding_edge/test/mjsunit/harmony/typedarrays.js Tue Jul 9
12:34:21 2013
@@ -219,7 +219,6 @@
assertThrows(function() { new proto(unalignedArrayBuffer)},
RangeError);
assertThrows(function() { new proto(unalignedArrayBuffer,
5*elementSize)},
RangeError);
- assertThrows(function() { new proto() }, TypeError);
}
var aFromString = new proto("30");
@@ -250,6 +249,12 @@
assertSame(0, aOverAbLen0.length);
assertSame(0, aOverAbLen0.byteLength);
assertSame(0, aOverAbLen0.byteOffset);
+
+ var aNoParam = new proto();
+ assertSame(elementSize, aNoParam.BYTES_PER_ELEMENT);
+ assertSame(0, aNoParam.length);
+ assertSame(0, aNoParam.byteLength);
+ assertSame(0, aNoParam.byteOffset);
}
TestTypedArray(Uint8Array, 1, 0xFF);
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.