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

Unified Diff: src/js/typedarray.js

Issue 2091153002: TypedArray.prototype.set uses internal length property, not real one. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: shorter lines Created 4 years, 6 months 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 | test/mjsunit/es6/typedarray-set-length-internal.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/js/typedarray.js
diff --git a/src/js/typedarray.js b/src/js/typedarray.js
index 50aae94bdcca99cbc567901d775e767bbac5f7b4..f5c799224d82f82ad08e91c6ba31d3d4e1bb3a1d 100644
--- a/src/js/typedarray.js
+++ b/src/js/typedarray.js
@@ -349,7 +349,7 @@ function TypedArraySetFromArrayLike(target, source, sourceLength, offset) {
function TypedArraySetFromOverlappingTypedArray(target, source, offset) {
var sourceElementSize = source.BYTES_PER_ELEMENT;
var targetElementSize = target.BYTES_PER_ELEMENT;
- var sourceLength = source.length;
+ var sourceLength = %_TypedArrayGetLength(source);
// Copy left part.
function CopyLeftPart() {
@@ -369,7 +369,7 @@ function TypedArraySetFromOverlappingTypedArray(target, source, offset) {
}
var leftIndex = CopyLeftPart();
- // Copy rigth part;
+ // Copy right part;
function CopyRightPart() {
// First unmutated byte before the next write
var targetPtr =
@@ -413,7 +413,8 @@ function TypedArraySet(obj, offset) {
TypedArraySetFromOverlappingTypedArray(this, obj, intOffset);
return;
case 2: // TYPED_ARRAY_SET_TYPED_ARRAY_NONOVERLAPPING
- TypedArraySetFromArrayLike(this, obj, obj.length, intOffset);
+ TypedArraySetFromArrayLike(this,
+ obj, %_TypedArrayGetLength(obj), intOffset);
return;
case 3: // TYPED_ARRAY_SET_NON_TYPED_ARRAY
var l = obj.length;
@@ -428,7 +429,7 @@ function TypedArraySet(obj, offset) {
return;
}
l = TO_LENGTH(l);
- if (intOffset + l > this.length) {
+ if (intOffset + l > %_TypedArrayGetLength(this)) {
throw MakeRangeError(kTypedArraySetSourceTooLarge);
}
TypedArraySetFromArrayLike(this, obj, l, intOffset);
« no previous file with comments | « no previous file | test/mjsunit/es6/typedarray-set-length-internal.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698