OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 %TypedArrayInitialize(obj, arrayId, buffer, 0, byteLength); | 82 %TypedArrayInitialize(obj, arrayId, buffer, 0, byteLength); |
83 for (var i = 0; i < l; i++) { | 83 for (var i = 0; i < l; i++) { |
84 obj[i] = arrayLike[i]; | 84 obj[i] = arrayLike[i]; |
85 } | 85 } |
86 } | 86 } |
87 | 87 |
88 return function (arg1, arg2, arg3) { | 88 return function (arg1, arg2, arg3) { |
89 if (%_IsConstructCall()) { | 89 if (%_IsConstructCall()) { |
90 if (IS_ARRAYBUFFER(arg1)) { | 90 if (IS_ARRAYBUFFER(arg1)) { |
91 ConstructByArrayBuffer(this, arg1, arg2, arg3); | 91 ConstructByArrayBuffer(this, arg1, arg2, arg3); |
92 } else if (IS_NUMBER(arg1) || IS_STRING(arg1) || IS_BOOLEAN(arg1)) { | 92 } else if (IS_NUMBER(arg1) || IS_STRING(arg1) || |
| 93 IS_BOOLEAN(arg1) || IS_UNDEFINED(arg1)) { |
93 ConstructByLength(this, arg1); | 94 ConstructByLength(this, arg1); |
94 } else if (!IS_UNDEFINED(arg1)){ | 95 } else { |
95 ConstructByArrayLike(this, arg1); | 96 ConstructByArrayLike(this, arg1); |
96 } else { | |
97 throw MakeTypeError("parameterless_typed_array_constr", [name]); | |
98 } | 97 } |
99 } else { | 98 } else { |
100 throw MakeTypeError("constructor_not_function", [name]) | 99 throw MakeTypeError("constructor_not_function", [name]) |
101 } | 100 } |
102 } | 101 } |
103 } | 102 } |
104 | 103 |
105 function TypedArrayGetBuffer() { | 104 function TypedArrayGetBuffer() { |
106 return %TypedArrayGetBuffer(this); | 105 return %TypedArrayGetBuffer(this); |
107 } | 106 } |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 | 465 |
467 "getFloat32", DataViewGetFloat32, | 466 "getFloat32", DataViewGetFloat32, |
468 "setFloat32", DataViewSetFloat32, | 467 "setFloat32", DataViewSetFloat32, |
469 | 468 |
470 "getFloat64", DataViewGetFloat64, | 469 "getFloat64", DataViewGetFloat64, |
471 "setFloat64", DataViewSetFloat64 | 470 "setFloat64", DataViewSetFloat64 |
472 )); | 471 )); |
473 } | 472 } |
474 | 473 |
475 SetupDataView(); | 474 SetupDataView(); |
OLD | NEW |