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

Side by Side Diff: test/generated_sdk/lib/_internal/compiler/js_lib/js_number.dart

Issue 1143273002: Add types to shift operations (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 7 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/_interceptors.js ('k') | tool/input_sdk/private/js_number.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of _interceptors; 5 part of _interceptors;
6 6
7 /** 7 /**
8 * The super interceptor class for [JSInt] and [JSDouble]. The compiler 8 * The super interceptor class for [JSInt] and [JSDouble]. The compiler
9 * recognizes this class as an interceptor, and changes references to 9 * recognizes this class as an interceptor, and changes references to
10 * [:this:] to actually use the receiver of the method, which is 10 * [:this:] to actually use the receiver of the method, which is
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 // trick to remove one instruction in the first line. 386 // trick to remove one instruction in the first line.
387 387
388 i = _shru(i, 0) - (_shru(i, 1) & 0x55555555); 388 i = _shru(i, 0) - (_shru(i, 1) & 0x55555555);
389 i = (i & 0x33333333) + (_shru(i, 2) & 0x33333333); 389 i = (i & 0x33333333) + (_shru(i, 2) & 0x33333333);
390 i = 0x0F0F0F0F & (i + _shru(i, 4)); 390 i = 0x0F0F0F0F & (i + _shru(i, 4));
391 i += _shru(i, 8); 391 i += _shru(i, 8);
392 i += _shru(i, 16); 392 i += _shru(i, 16);
393 return (i & 0x0000003F); 393 return (i & 0x0000003F);
394 } 394 }
395 395
396 static _shru(int value, int shift) => JS('int', '# >>> #', value, shift); 396 static int _shru(int value, int shift) => JS('int', '# >>> #', value, shift);
Jennifer Messerly 2015/05/20 17:50:19 wow. I guess dart2js infers so they didn't really
397 static _shrs(int value, int shift) => JS('int', '# >> #', value, shift); 397 static int _shrs(int value, int shift) => JS('int', '# >> #', value, shift);
398 static _ors(int a, int b) => JS('int', '# | #', a, b); 398 static int _ors(int a, int b) => JS('int', '# | #', a, b);
399 399
400 // Assumes i is <= 32-bit 400 // Assumes i is <= 32-bit
401 static int _spread(int i) { 401 static int _spread(int i) {
402 i = _ors(i, _shrs(i, 1)); 402 i = _ors(i, _shrs(i, 1));
403 i = _ors(i, _shrs(i, 2)); 403 i = _ors(i, _shrs(i, 2));
404 i = _ors(i, _shrs(i, 4)); 404 i = _ors(i, _shrs(i, 4));
405 i = _ors(i, _shrs(i, 8)); 405 i = _ors(i, _shrs(i, 8));
406 i = _shru(_ors(i, _shrs(i, 16)), 0); 406 i = _shru(_ors(i, _shrs(i, 16)), 0);
407 return i; 407 return i;
408 } 408 }
409 409
410 Type get runtimeType => int; 410 Type get runtimeType => int;
411 411
412 int operator ~() => JS('JSUInt32', r'(~#) >>> 0', this); 412 int operator ~() => JS('JSUInt32', r'(~#) >>> 0', this);
413 } 413 }
414 414
415 class JSDouble extends JSNumber implements double { 415 class JSDouble extends JSNumber implements double {
416 const JSDouble(); 416 const JSDouble();
417 Type get runtimeType => double; 417 Type get runtimeType => double;
418 } 418 }
419 419
420 class JSPositiveInt extends JSInt {} 420 class JSPositiveInt extends JSInt {}
421 class JSUInt32 extends JSPositiveInt {} 421 class JSUInt32 extends JSPositiveInt {}
422 class JSUInt31 extends JSUInt32 {} 422 class JSUInt31 extends JSUInt32 {}
OLDNEW
« no previous file with comments | « lib/runtime/dart/_interceptors.js ('k') | tool/input_sdk/private/js_number.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698