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

Unified Diff: tests/compiler/dart2js/mock_compiler.dart

Issue 106973008: Optimize num::~/, num::>> and num::<< for some cases. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years 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 | « sdk/lib/_internal/lib/js_number.dart ('k') | tests/language/truncdiv_uint32_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/compiler/dart2js/mock_compiler.dart
===================================================================
--- tests/compiler/dart2js/mock_compiler.dart (revision 31017)
+++ tests/compiler/dart2js/mock_compiler.dart (working copy)
@@ -131,12 +131,15 @@
operator-() => (this is JSInt) ? 42 : 42.2;
operator +(other) => (this is JSInt) ? 42 : 42.2;
operator -(other) => (this is JSInt) ? 42 : 42.2;
- operator ~/(other) => 42;
+ operator ~/(other) => _tdivFast(other);
operator /(other) => (this is JSInt) ? 42 : 42.2;
operator *(other) => (this is JSInt) ? 42 : 42.2;
operator %(other) => (this is JSInt) ? 42 : 42.2;
- operator <<(other) => 42;
- operator >>(other) => 42;
+ operator <<(other) => _shlPositive(other);
+ operator >>(other) {
+ return _shrBothPositive(other) + _shrReceiverPositive(other) +
+ _shrOtherPositive(other);
+ }
operator |(other) => 42;
operator &(other) => 42;
operator ^(other) => 42;
@@ -148,6 +151,12 @@
operator ==(other) => true;
get hashCode => throw "JSNumber.hashCode not implemented.";
+ _tdivFast(other) => 42;
+ _shlPositive(other) => 42;
+ _shrBothPositive(other) => 42;
+ _shrReceiverPositive(other) => 42;
+ _shrOtherPositive(other) => 42;
+
abs() => (this is JSInt) ? 42 : 42.2;
remainder(other) => (this is JSInt) ? 42 : 42.2;
truncate() => 42;
« no previous file with comments | « sdk/lib/_internal/lib/js_number.dart ('k') | tests/language/truncdiv_uint32_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698