Commit 4697e5bb authored by Michael Achenbach's avatar Michael Achenbach Committed by Commit Bot

[foozzie] Improve mocks for typed arrays

This wraps float arrays with a proxy to make raw buffer use slow paths avoiding different NAN patterns.

This also mocks out large typed arrays when passing the lenth as third constructor parameter.

BUG=chromium:691287,chromium:690898
NOTRY=true

Change-Id: Ic4295b0d8690e5209aceeda9ed93efdd580194c0
Reviewed-on: https://chromium-review.googlesource.com/441624
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#43229}
parent a27d97c4
......@@ -70,8 +70,8 @@ Object.defineProperty(
var mock = function(arrayType) {
var handler = {
construct: function(target, args) {
return new (
Function.prototype.bind.apply(arrayType, [null].concat(args)));
return new Proxy(
Function.prototype.bind.apply(arrayType, [null].concat(args)), {});
},
};
return new Proxy(arrayType, handler);
......
......@@ -20,6 +20,10 @@
Number.isInteger(args[0]) &&
args[0] > 1048576) {
args[0] = 1048576
} else if (args.length > 2 &&
Number.isInteger(args[2]) &&
args[2] > 1048576) {
args[2] = 1048576
}
return new (
Function.prototype.bind.apply(arrayType, [null].concat(args)));
......
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