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

Unified Diff: src/js/typedarray.js

Issue 2761673003: [typedarrays] Use internal byteOffset in TypedArray.prototype.set (Closed)
Patch Set: path Created 3 years, 9 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/test262/local-tests/test/built-ins/TypedArray/prototype/set/typedarray-arg-src-byteoffset-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 e4556b706a53fdff42a61693bebbfef90ed8dad2..f54ed29a4818b9ff4aab4a40183e0b3c10b542e0 100644
--- a/src/js/typedarray.js
+++ b/src/js/typedarray.js
@@ -282,10 +282,11 @@ function TypedArraySetFromOverlappingTypedArray(target, source, offset) {
// Copy left part.
function CopyLeftPart() {
// First un-mutated byte after the next write
- var targetPtr = target.byteOffset + (offset + 1) * targetElementSize;
+ var targetPtr = %_ArrayBufferViewGetByteOffset(target) +
+ (offset + 1) * targetElementSize;
// Next read at sourcePtr. We do not care for memory changing before
// sourcePtr - we have already copied it.
- var sourcePtr = source.byteOffset;
+ var sourcePtr = %_ArrayBufferViewGetByteOffset(source);
for (var leftIndex = 0;
leftIndex < sourceLength && targetPtr <= sourcePtr;
leftIndex++) {
@@ -300,12 +301,12 @@ function TypedArraySetFromOverlappingTypedArray(target, source, offset) {
// Copy right part;
function CopyRightPart() {
// First unmutated byte before the next write
- var targetPtr =
- target.byteOffset + (offset + sourceLength - 1) * targetElementSize;
+ var targetPtr = %_ArrayBufferViewGetByteOffset(target) +
+ (offset + sourceLength - 1) * targetElementSize;
// Next read before sourcePtr. We do not care for memory changing after
// sourcePtr - we have already copied it.
- var sourcePtr =
- source.byteOffset + sourceLength * sourceElementSize;
+ var sourcePtr = %_ArrayBufferViewGetByteOffset(source) +
+ sourceLength * sourceElementSize;
for(var rightIndex = sourceLength - 1;
rightIndex >= leftIndex && targetPtr >= sourcePtr;
rightIndex--) {
« no previous file with comments | « no previous file | test/test262/local-tests/test/built-ins/TypedArray/prototype/set/typedarray-arg-src-byteoffset-internal.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698