Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(500)

Unified Diff: src/typedarray.js

Issue 80753004: Fix previous backmerge (3.21.18.10 / r17958) (Closed) Base URL: https://v8.googlecode.com/svn/branches/3.21
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/version.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/typedarray.js
diff --git a/src/typedarray.js b/src/typedarray.js
index e12230dd7186e6ab49a5a4a72b4bae2c46fed1fe..ec9849df699a3ac69b5e52492ec441446f05fc2b 100644
--- a/src/typedarray.js
+++ b/src/typedarray.js
@@ -69,6 +69,9 @@ function CreateTypedArrayConstructor(name, elementSize, arrayId, constructor) {
function ConstructByLength(obj, length) {
var l = ToPositiveInteger(length, "invalid_typed_array_length");
+ if (l > %MaxSmi()) {
+ throw MakeRangeError("invalid_typed_array_length");
+ }
var byteLength = l * elementSize;
var buffer = new global.ArrayBuffer(byteLength);
%TypedArrayInitialize(obj, arrayId, buffer, 0, byteLength);
@@ -77,9 +80,6 @@ function CreateTypedArrayConstructor(name, elementSize, arrayId, constructor) {
function ConstructByArrayLike(obj, arrayLike) {
var length = arrayLike.length;
var l = ToPositiveInteger(length, "invalid_typed_array_length");
- if (l > %MaxSmi()) {
- throw MakeRangeError("invalid_typed_array_length");
- }
if(!%TypedArrayInitializeFromArrayLike(obj, arrayId, arrayLike, l)) {
for (var i = 0; i < l; i++) {
obj[i] = arrayLike[i];
« no previous file with comments | « no previous file | src/version.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698