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

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

Issue 14845021: Cleanups: addressed your comments from https://codereview.chromium.org/14962008/ (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/lib/integers.cc » ('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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 #include <math.h> 5 #include <math.h>
6 6
7 #include "vm/bootstrap_natives.h" 7 #include "vm/bootstrap_natives.h"
8 8
9 #include "vm/bigint_operations.h" 9 #include "vm/bigint_operations.h"
10 #include "vm/code_generator.h" // DartModulo. 10 #include "vm/code_generator.h" // DartModulo.
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 } 73 }
74 74
75 75
76 static RawInteger* DoubleToInteger(double val, const char* error_msg) { 76 static RawInteger* DoubleToInteger(double val, const char* error_msg) {
77 if (isinf(val) || isnan(val)) { 77 if (isinf(val) || isnan(val)) {
78 const Array& args = Array::Handle(Array::New(1)); 78 const Array& args = Array::Handle(Array::New(1));
79 args.SetAt(0, String::Handle(String::New(error_msg))); 79 args.SetAt(0, String::Handle(String::New(error_msg)));
80 Exceptions::ThrowByType(Exceptions::kUnsupported, args); 80 Exceptions::ThrowByType(Exceptions::kUnsupported, args);
81 } 81 }
82 const Bigint& big = Bigint::Handle(BigintOperations::NewFromDouble(val)); 82 const Bigint& big = Bigint::Handle(BigintOperations::NewFromDouble(val));
83 if (BigintOperations::FitsIntoMint(big)) { 83 if (BigintOperations::FitsIntoInt64(big)) {
84 return Integer::New(BigintOperations::ToMint(big)); 84 return Integer::New(BigintOperations::ToInt64(big));
85 } else { 85 } else {
86 return big.raw(); 86 return big.raw();
87 } 87 }
88 } 88 }
89 89
90 DEFINE_NATIVE_ENTRY(Double_trunc_div, 2) { 90 DEFINE_NATIVE_ENTRY(Double_trunc_div, 2) {
91 double left = Double::CheckedHandle(arguments->NativeArgAt(0)).value(); 91 double left = Double::CheckedHandle(arguments->NativeArgAt(0)).value();
92 GET_NON_NULL_NATIVE_ARGUMENT(Double, right_object, arguments->NativeArgAt(1)); 92 GET_NON_NULL_NATIVE_ARGUMENT(Double, right_object, arguments->NativeArgAt(1));
93 double right = right_object.value(); 93 double right = right_object.value();
94 if (FLAG_trace_intrinsified_natives) { 94 if (FLAG_trace_intrinsified_natives) {
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 356
357 DEFINE_NATIVE_ENTRY(Double_getIsNegative, 1) { 357 DEFINE_NATIVE_ENTRY(Double_getIsNegative, 1) {
358 const Double& arg = Double::CheckedHandle(arguments->NativeArgAt(0)); 358 const Double& arg = Double::CheckedHandle(arguments->NativeArgAt(0));
359 // Include negative zero, infinity. 359 // Include negative zero, infinity.
360 return Bool::Get(signbit(arg.value()) && !isnan(arg.value())); 360 return Bool::Get(signbit(arg.value()) && !isnan(arg.value()));
361 } 361 }
362 362
363 // Add here only functions using/referring to old-style casts. 363 // Add here only functions using/referring to old-style casts.
364 364
365 } // namespace dart 365 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/lib/integers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698