Commit a676bc1b authored by yangguo@chromium.org's avatar yangguo@chromium.org

Fix typed array error message.

R=dslomov@chromium.org
BUG=v8:3159
LOG=N

Review URL: https://codereview.chromium.org/163293002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19369 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent def0b80b
...@@ -120,7 +120,7 @@ var kMessages = { ...@@ -120,7 +120,7 @@ var kMessages = {
invalid_string_length: ["Invalid string length"], invalid_string_length: ["Invalid string length"],
invalid_typed_array_offset: ["Start offset is too large:"], invalid_typed_array_offset: ["Start offset is too large:"],
invalid_typed_array_length: ["Invalid typed array length"], invalid_typed_array_length: ["Invalid typed array length"],
invalid_typed_array_alignment: ["%0", "of", "%1", "should be a multiple of", "%3"], invalid_typed_array_alignment: ["%0", " of ", "%1", " should be a multiple of ", "%2"],
typed_array_set_source_too_large: typed_array_set_source_too_large:
["Source is too large"], ["Source is too large"],
typed_array_set_negative_offset: typed_array_set_negative_offset:
......
...@@ -58,7 +58,7 @@ macro TYPED_ARRAY_CONSTRUCTOR(ARRAY_ID, NAME, ELEMENT_SIZE) ...@@ -58,7 +58,7 @@ macro TYPED_ARRAY_CONSTRUCTOR(ARRAY_ID, NAME, ELEMENT_SIZE)
if (offset % ELEMENT_SIZE !== 0) { if (offset % ELEMENT_SIZE !== 0) {
throw MakeRangeError("invalid_typed_array_alignment", throw MakeRangeError("invalid_typed_array_alignment",
"start offset", "NAME", ELEMENT_SIZE); ["start offset", "NAME", ELEMENT_SIZE]);
} }
if (offset > bufferByteLength) { if (offset > bufferByteLength) {
throw MakeRangeError("invalid_typed_array_offset"); throw MakeRangeError("invalid_typed_array_offset");
...@@ -70,7 +70,7 @@ macro TYPED_ARRAY_CONSTRUCTOR(ARRAY_ID, NAME, ELEMENT_SIZE) ...@@ -70,7 +70,7 @@ macro TYPED_ARRAY_CONSTRUCTOR(ARRAY_ID, NAME, ELEMENT_SIZE)
if (IS_UNDEFINED(length)) { if (IS_UNDEFINED(length)) {
if (bufferByteLength % ELEMENT_SIZE !== 0) { if (bufferByteLength % ELEMENT_SIZE !== 0) {
throw MakeRangeError("invalid_typed_array_alignment", throw MakeRangeError("invalid_typed_array_alignment",
"byte length", "NAME", ELEMENT_SIZE); ["byte length", "NAME", ELEMENT_SIZE]);
} }
newByteLength = bufferByteLength - offset; newByteLength = bufferByteLength - offset;
newLength = newByteLength / ELEMENT_SIZE; newLength = newByteLength / ELEMENT_SIZE;
......
// Copyright 2014 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
try {
new Uint32Array(new ArrayBuffer(1), 2, 3);
} catch (e) {
assertEquals("start offset of Uint32Array should be a multiple of 4",
e.message);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment