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

Side by Side Diff: runtime/lib/double.dart

Issue 1974533002: Faster dispatch of integer operations on double. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: remove extra spaces Created 4 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 | « no previous file | runtime/vm/method_recognizer.h » ('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 class _Double implements double { 5 class _Double implements double {
6 factory _Double.fromInteger(int value) 6 factory _Double.fromInteger(int value)
7 native "Double_doubleFromInteger"; 7 native "Double_doubleFromInteger";
8 8
9 Type get runtimeType => double; 9 Type get runtimeType => double;
10 10
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 bool _equal(double other) native "Double_equal"; 56 bool _equal(double other) native "Double_equal";
57 bool _equalToInteger(int other) native "Double_equalToInteger"; 57 bool _equalToInteger(int other) native "Double_equalToInteger";
58 bool operator <(num other) { 58 bool operator <(num other) {
59 return other > this; 59 return other > this;
60 } 60 }
61 bool operator >(num other) { 61 bool operator >(num other) {
62 return _greaterThan(other.toDouble()); 62 return _greaterThan(other.toDouble());
63 } 63 }
64 bool _greaterThan(double other) native "Double_greaterThan"; 64 bool _greaterThan(double other) native "Double_greaterThan";
65 bool operator >=(num other) { 65 bool operator >=(num other) {
66 return (this == other) || (this > other); 66 return (this == other) || (this > other);
67 } 67 }
68 bool operator <=(num other) { 68 bool operator <=(num other) {
69 return (this == other) || (this < other); 69 return (this == other) || (this < other);
70 } 70 }
71 double _addFromInteger(int other) { 71 double _addFromInteger(int other) {
72 return new _Double.fromInteger(other) + this; 72 return new _Double.fromInteger(other)._add(this);
73 } 73 }
74 double _subFromInteger(int other) { 74 double _subFromInteger(int other) {
75 return new _Double.fromInteger(other) - this; 75 return new _Double.fromInteger(other)._sub(this);
76 } 76 }
77 double _mulFromInteger(int other) { 77 double _mulFromInteger(int other) {
78 return new _Double.fromInteger(other) * this; 78 return new _Double.fromInteger(other)._mul(this);
79 } 79 }
80 int _truncDivFromInteger(int other) { 80 int _truncDivFromInteger(int other) {
81 return new _Double.fromInteger(other) ~/ this; 81 return new _Double.fromInteger(other)._trunc_div(this);
82 } 82 }
83 double _moduloFromInteger(int other) { 83 double _moduloFromInteger(int other) {
84 return new _Double.fromInteger(other) % this; 84 return new _Double.fromInteger(other)._modulo(this);
85 } 85 }
86 double _remainderFromInteger(int other) { 86 double _remainderFromInteger(int other) {
87 return new _Double.fromInteger(other).remainder(this); 87 return new _Double.fromInteger(other)._remainder(this);
88 } 88 }
89 bool _greaterThanFromInteger(int other) 89 bool _greaterThanFromInteger(int other)
90 native "Double_greaterThanFromInteger"; 90 native "Double_greaterThanFromInteger";
91 91
92 bool get isNegative native "Double_getIsNegative"; 92 bool get isNegative native "Double_getIsNegative";
93 bool get isInfinite native "Double_getIsInfinite"; 93 bool get isInfinite native "Double_getIsInfinite";
94 bool get isNaN native "Double_getIsNaN"; 94 bool get isNaN native "Double_getIsNaN";
95 bool get isFinite => !isInfinite && !isNaN; // Can be optimized. 95 bool get isFinite => !isInfinite && !isNaN; // Can be optimized.
96 96
97 double abs() { 97 double abs() {
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 return EQUAL; 262 return EQUAL;
263 } 263 }
264 } else if (isNaN) { 264 } else if (isNaN) {
265 return other.isNaN ? EQUAL : GREATER; 265 return other.isNaN ? EQUAL : GREATER;
266 } else { 266 } else {
267 // Other is NaN. 267 // Other is NaN.
268 return LESS; 268 return LESS;
269 } 269 }
270 } 270 }
271 } 271 }
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/method_recognizer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698