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

Side by Side Diff: lib/runtime/dart/_native_typed_data.js

Issue 1147143007: fixes #206, add checking for unary ops (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: merged Created 5 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 unified diff | Download patch
« no previous file with comments | « lib/runtime/dart/_js_helper.js ('k') | lib/runtime/dart/async.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 var _native_typed_data = dart.defineLibrary(_native_typed_data, {}); 1 var _native_typed_data = dart.defineLibrary(_native_typed_data, {});
2 var core = dart.import(core); 2 var core = dart.import(core);
3 var typed_data = dart.import(typed_data); 3 var typed_data = dart.import(typed_data);
4 var collection = dart.import(collection); 4 var collection = dart.import(collection);
5 var _internal = dart.import(_internal); 5 var _internal = dart.import(_internal);
6 var _interceptors = dart.lazyImport(_interceptors); 6 var _interceptors = dart.lazyImport(_interceptors);
7 var _js_helper = dart.import(_js_helper); 7 var _js_helper = dart.import(_js_helper);
8 var math = dart.import(math); 8 var math = dart.import(math);
9 (function(exports, core, typed_data, collection, _internal, _interceptors, _js_h elper, math) { 9 (function(exports, core, typed_data, collection, _internal, _interceptors, _js_h elper, math) {
10 'use strict'; 10 'use strict';
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 return dart.as(length, core.int); 515 return dart.as(length, core.int);
516 } 516 }
517 dart.fn(_checkLength, core.int, [core.Object]); 517 dart.fn(_checkLength, core.int, [core.Object]);
518 function _checkViewArguments(buffer, offsetInBytes, length) { 518 function _checkViewArguments(buffer, offsetInBytes, length) {
519 if (!dart.is(buffer, NativeByteBuffer)) { 519 if (!dart.is(buffer, NativeByteBuffer)) {
520 throw new core.ArgumentError('Invalid view buffer'); 520 throw new core.ArgumentError('Invalid view buffer');
521 } 521 }
522 if (!(typeof offsetInBytes == 'number')) { 522 if (!(typeof offsetInBytes == 'number')) {
523 throw new core.ArgumentError(`Invalid view offsetInBytes ${offsetInBytes}` ); 523 throw new core.ArgumentError(`Invalid view offsetInBytes ${offsetInBytes}` );
524 } 524 }
525 if (dart.notNull(length != null) && !(typeof length == 'number')) { 525 if (length != null && !(typeof length == 'number')) {
526 throw new core.ArgumentError(`Invalid view length ${length}`); 526 throw new core.ArgumentError(`Invalid view length ${length}`);
527 } 527 }
528 } 528 }
529 dart.fn(_checkViewArguments, dart.void, [core.Object, core.Object, core.Object ]); 529 dart.fn(_checkViewArguments, dart.void, [core.Object, core.Object, core.Object ]);
530 function _ensureNativeList(list) { 530 function _ensureNativeList(list) {
531 if (dart.is(list, _interceptors.JSIndexable)) 531 if (dart.is(list, _interceptors.JSIndexable))
532 return list; 532 return list;
533 let result = core.List.new(list.length); 533 let result = core.List.new(list.length);
534 for (let i = 0; dart.notNull(i) < dart.notNull(list.length); i = dart.notNul l(i) + 1) { 534 for (let i = 0; dart.notNull(i) < dart.notNull(list.length); i = dart.notNul l(i) + 1) {
535 result[dartx.set](i, list[dartx.get](i)); 535 result[dartx.set](i, list[dartx.get](i));
(...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after
1340 let _y = dart.notNull(this.y) / dart.notNull(other.y); 1340 let _y = dart.notNull(this.y) / dart.notNull(other.y);
1341 let _z = dart.notNull(this.z) / dart.notNull(other.z); 1341 let _z = dart.notNull(this.z) / dart.notNull(other.z);
1342 let _w = dart.notNull(this.w) / dart.notNull(other.w); 1342 let _w = dart.notNull(this.w) / dart.notNull(other.w);
1343 return new NativeFloat32x4._doubles(_x, _y, _z, _w); 1343 return new NativeFloat32x4._doubles(_x, _y, _z, _w);
1344 } 1344 }
1345 lessThan(other) { 1345 lessThan(other) {
1346 let _cx = dart.notNull(this.x) < dart.notNull(other.x); 1346 let _cx = dart.notNull(this.x) < dart.notNull(other.x);
1347 let _cy = dart.notNull(this.y) < dart.notNull(other.y); 1347 let _cy = dart.notNull(this.y) < dart.notNull(other.y);
1348 let _cz = dart.notNull(this.z) < dart.notNull(other.z); 1348 let _cz = dart.notNull(this.z) < dart.notNull(other.z);
1349 let _cw = dart.notNull(this.w) < dart.notNull(other.w); 1349 let _cw = dart.notNull(this.w) < dart.notNull(other.w);
1350 return new NativeInt32x4._truncated(_cx ? -1 : 0, _cy ? -1 : 0, _cz ? -1 : 0, _cw ? -1 : 0); 1350 return new NativeInt32x4._truncated(dart.notNull(_cx) ? -1 : 0, dart.notNu ll(_cy) ? -1 : 0, dart.notNull(_cz) ? -1 : 0, dart.notNull(_cw) ? -1 : 0);
1351 } 1351 }
1352 lessThanOrEqual(other) { 1352 lessThanOrEqual(other) {
1353 let _cx = dart.notNull(this.x) <= dart.notNull(other.x); 1353 let _cx = dart.notNull(this.x) <= dart.notNull(other.x);
1354 let _cy = dart.notNull(this.y) <= dart.notNull(other.y); 1354 let _cy = dart.notNull(this.y) <= dart.notNull(other.y);
1355 let _cz = dart.notNull(this.z) <= dart.notNull(other.z); 1355 let _cz = dart.notNull(this.z) <= dart.notNull(other.z);
1356 let _cw = dart.notNull(this.w) <= dart.notNull(other.w); 1356 let _cw = dart.notNull(this.w) <= dart.notNull(other.w);
1357 return new NativeInt32x4._truncated(_cx ? -1 : 0, _cy ? -1 : 0, _cz ? -1 : 0, _cw ? -1 : 0); 1357 return new NativeInt32x4._truncated(dart.notNull(_cx) ? -1 : 0, dart.notNu ll(_cy) ? -1 : 0, dart.notNull(_cz) ? -1 : 0, dart.notNull(_cw) ? -1 : 0);
1358 } 1358 }
1359 greaterThan(other) { 1359 greaterThan(other) {
1360 let _cx = dart.notNull(this.x) > dart.notNull(other.x); 1360 let _cx = dart.notNull(this.x) > dart.notNull(other.x);
1361 let _cy = dart.notNull(this.y) > dart.notNull(other.y); 1361 let _cy = dart.notNull(this.y) > dart.notNull(other.y);
1362 let _cz = dart.notNull(this.z) > dart.notNull(other.z); 1362 let _cz = dart.notNull(this.z) > dart.notNull(other.z);
1363 let _cw = dart.notNull(this.w) > dart.notNull(other.w); 1363 let _cw = dart.notNull(this.w) > dart.notNull(other.w);
1364 return new NativeInt32x4._truncated(_cx ? -1 : 0, _cy ? -1 : 0, _cz ? -1 : 0, _cw ? -1 : 0); 1364 return new NativeInt32x4._truncated(dart.notNull(_cx) ? -1 : 0, dart.notNu ll(_cy) ? -1 : 0, dart.notNull(_cz) ? -1 : 0, dart.notNull(_cw) ? -1 : 0);
1365 } 1365 }
1366 greaterThanOrEqual(other) { 1366 greaterThanOrEqual(other) {
1367 let _cx = dart.notNull(this.x) >= dart.notNull(other.x); 1367 let _cx = dart.notNull(this.x) >= dart.notNull(other.x);
1368 let _cy = dart.notNull(this.y) >= dart.notNull(other.y); 1368 let _cy = dart.notNull(this.y) >= dart.notNull(other.y);
1369 let _cz = dart.notNull(this.z) >= dart.notNull(other.z); 1369 let _cz = dart.notNull(this.z) >= dart.notNull(other.z);
1370 let _cw = dart.notNull(this.w) >= dart.notNull(other.w); 1370 let _cw = dart.notNull(this.w) >= dart.notNull(other.w);
1371 return new NativeInt32x4._truncated(_cx ? -1 : 0, _cy ? -1 : 0, _cz ? -1 : 0, _cw ? -1 : 0); 1371 return new NativeInt32x4._truncated(dart.notNull(_cx) ? -1 : 0, dart.notNu ll(_cy) ? -1 : 0, dart.notNull(_cz) ? -1 : 0, dart.notNull(_cw) ? -1 : 0);
1372 } 1372 }
1373 equal(other) { 1373 equal(other) {
1374 let _cx = this.x == other.x; 1374 let _cx = this.x == other.x;
1375 let _cy = this.y == other.y; 1375 let _cy = this.y == other.y;
1376 let _cz = this.z == other.z; 1376 let _cz = this.z == other.z;
1377 let _cw = this.w == other.w; 1377 let _cw = this.w == other.w;
1378 return new NativeInt32x4._truncated(_cx ? -1 : 0, _cy ? -1 : 0, _cz ? -1 : 0, _cw ? -1 : 0); 1378 return new NativeInt32x4._truncated(dart.notNull(_cx) ? -1 : 0, dart.notNu ll(_cy) ? -1 : 0, dart.notNull(_cz) ? -1 : 0, dart.notNull(_cw) ? -1 : 0);
1379 } 1379 }
1380 notEqual(other) { 1380 notEqual(other) {
1381 let _cx = this.x != other.x; 1381 let _cx = this.x != other.x;
1382 let _cy = this.y != other.y; 1382 let _cy = this.y != other.y;
1383 let _cz = this.z != other.z; 1383 let _cz = this.z != other.z;
1384 let _cw = this.w != other.w; 1384 let _cw = this.w != other.w;
1385 return new NativeInt32x4._truncated(_cx ? -1 : 0, _cy ? -1 : 0, _cz ? -1 : 0, _cw ? -1 : 0); 1385 return new NativeInt32x4._truncated(dart.notNull(_cx) ? -1 : 0, dart.notNu ll(_cy) ? -1 : 0, dart.notNull(_cz) ? -1 : 0, dart.notNull(_cw) ? -1 : 0);
1386 } 1386 }
1387 scale(s) { 1387 scale(s) {
1388 let _x = dart.notNull(s) * dart.notNull(this.x); 1388 let _x = dart.notNull(s) * dart.notNull(this.x);
1389 let _y = dart.notNull(s) * dart.notNull(this.y); 1389 let _y = dart.notNull(s) * dart.notNull(this.y);
1390 let _z = dart.notNull(s) * dart.notNull(this.z); 1390 let _z = dart.notNull(s) * dart.notNull(this.z);
1391 let _w = dart.notNull(s) * dart.notNull(this.w); 1391 let _w = dart.notNull(s) * dart.notNull(this.w);
1392 return new NativeFloat32x4._doubles(_x, _y, _z, _w); 1392 return new NativeFloat32x4._doubles(_x, _y, _z, _w);
1393 } 1393 }
1394 abs() { 1394 abs() {
1395 let _x = this.x[dartx.abs](); 1395 let _x = this.x[dartx.abs]();
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
1581 if (x != this.x && !(typeof x == 'number')) 1581 if (x != this.x && !(typeof x == 'number'))
1582 throw new core.ArgumentError(x); 1582 throw new core.ArgumentError(x);
1583 if (y != this.y && !(typeof y == 'number')) 1583 if (y != this.y && !(typeof y == 'number'))
1584 throw new core.ArgumentError(y); 1584 throw new core.ArgumentError(y);
1585 if (z != this.z && !(typeof z == 'number')) 1585 if (z != this.z && !(typeof z == 'number'))
1586 throw new core.ArgumentError(z); 1586 throw new core.ArgumentError(z);
1587 if (w != this.w && !(typeof w == 'number')) 1587 if (w != this.w && !(typeof w == 'number'))
1588 throw new core.ArgumentError(w); 1588 throw new core.ArgumentError(w);
1589 } 1589 }
1590 bool(x, y, z, w) { 1590 bool(x, y, z, w) {
1591 this.x = x ? -1 : 0; 1591 this.x = dart.notNull(x) ? -1 : 0;
1592 this.y = y ? -1 : 0; 1592 this.y = dart.notNull(y) ? -1 : 0;
1593 this.z = z ? -1 : 0; 1593 this.z = dart.notNull(z) ? -1 : 0;
1594 this.w = w ? -1 : 0; 1594 this.w = dart.notNull(w) ? -1 : 0;
1595 } 1595 }
1596 static fromFloat32x4Bits(f) { 1596 static fromFloat32x4Bits(f) {
1597 let floatList = NativeFloat32x4._list; 1597 let floatList = NativeFloat32x4._list;
1598 floatList.set(0, f.x); 1598 floatList.set(0, f.x);
1599 floatList.set(1, f.y); 1599 floatList.set(1, f.y);
1600 floatList.set(2, f.z); 1600 floatList.set(2, f.z);
1601 floatList.set(3, f.w); 1601 floatList.set(3, f.w);
1602 let view = dart.as(floatList.buffer.asInt32List(), NativeInt32List); 1602 let view = dart.as(floatList.buffer.asInt32List(), NativeInt32List);
1603 return new NativeInt32x4._truncated(view.get(0), view.get(1), view.get(2), view.get(3)); 1603 return new NativeInt32x4._truncated(view.get(0), view.get(1), view.get(2), view.get(3));
1604 } 1604 }
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
1690 get flagY() { 1690 get flagY() {
1691 return this.y != 0; 1691 return this.y != 0;
1692 } 1692 }
1693 get flagZ() { 1693 get flagZ() {
1694 return this.z != 0; 1694 return this.z != 0;
1695 } 1695 }
1696 get flagW() { 1696 get flagW() {
1697 return this.w != 0; 1697 return this.w != 0;
1698 } 1698 }
1699 withFlagX(flagX) { 1699 withFlagX(flagX) {
1700 let _x = flagX ? -1 : 0; 1700 let _x = dart.notNull(flagX) ? -1 : 0;
1701 return new NativeInt32x4._truncated(_x, this.y, this.z, this.w); 1701 return new NativeInt32x4._truncated(_x, this.y, this.z, this.w);
1702 } 1702 }
1703 withFlagY(flagY) { 1703 withFlagY(flagY) {
1704 let _y = flagY ? -1 : 0; 1704 let _y = dart.notNull(flagY) ? -1 : 0;
1705 return new NativeInt32x4._truncated(this.x, _y, this.z, this.w); 1705 return new NativeInt32x4._truncated(this.x, _y, this.z, this.w);
1706 } 1706 }
1707 withFlagZ(flagZ) { 1707 withFlagZ(flagZ) {
1708 let _z = flagZ ? -1 : 0; 1708 let _z = dart.notNull(flagZ) ? -1 : 0;
1709 return new NativeInt32x4._truncated(this.x, this.y, _z, this.w); 1709 return new NativeInt32x4._truncated(this.x, this.y, _z, this.w);
1710 } 1710 }
1711 withFlagW(flagW) { 1711 withFlagW(flagW) {
1712 let _w = flagW ? -1 : 0; 1712 let _w = dart.notNull(flagW) ? -1 : 0;
1713 return new NativeInt32x4._truncated(this.x, this.y, this.z, _w); 1713 return new NativeInt32x4._truncated(this.x, this.y, this.z, _w);
1714 } 1714 }
1715 select(trueValue, falseValue) { 1715 select(trueValue, falseValue) {
1716 let floatList = NativeFloat32x4._list; 1716 let floatList = NativeFloat32x4._list;
1717 let intView = NativeFloat32x4._uint32view; 1717 let intView = NativeFloat32x4._uint32view;
1718 floatList.set(0, trueValue.x); 1718 floatList.set(0, trueValue.x);
1719 floatList.set(1, trueValue.y); 1719 floatList.set(1, trueValue.y);
1720 floatList.set(2, trueValue.z); 1720 floatList.set(2, trueValue.z);
1721 floatList.set(3, trueValue.w); 1721 floatList.set(3, trueValue.w);
1722 let stx = intView.get(0); 1722 let stx = intView.get(0);
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
1921 exports.NativeInt32List = NativeInt32List; 1921 exports.NativeInt32List = NativeInt32List;
1922 exports.NativeInt8List = NativeInt8List; 1922 exports.NativeInt8List = NativeInt8List;
1923 exports.NativeUint16List = NativeUint16List; 1923 exports.NativeUint16List = NativeUint16List;
1924 exports.NativeUint32List = NativeUint32List; 1924 exports.NativeUint32List = NativeUint32List;
1925 exports.NativeUint8ClampedList = NativeUint8ClampedList; 1925 exports.NativeUint8ClampedList = NativeUint8ClampedList;
1926 exports.NativeUint8List = NativeUint8List; 1926 exports.NativeUint8List = NativeUint8List;
1927 exports.NativeFloat32x4 = NativeFloat32x4; 1927 exports.NativeFloat32x4 = NativeFloat32x4;
1928 exports.NativeInt32x4 = NativeInt32x4; 1928 exports.NativeInt32x4 = NativeInt32x4;
1929 exports.NativeFloat64x2 = NativeFloat64x2; 1929 exports.NativeFloat64x2 = NativeFloat64x2;
1930 })(_native_typed_data, core, typed_data, collection, _internal, _interceptors, _ js_helper, math); 1930 })(_native_typed_data, core, typed_data, collection, _internal, _interceptors, _ js_helper, math);
OLDNEW
« no previous file with comments | « lib/runtime/dart/_js_helper.js ('k') | lib/runtime/dart/async.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698