| OLD | NEW |
| 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 "vm/bootstrap_natives.h" | 5 #include "vm/bootstrap_natives.h" |
| 6 | 6 |
| 7 #include "platform/math.h" | 7 #include "platform/math.h" |
| 8 | 8 |
| 9 #include "vm/code_generator.h" // DartModulo. | 9 #include "vm/code_generator.h" // DartModulo. |
| 10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 if (String::ParseDouble(value, start, end, &double_value)) { | 225 if (String::ParseDouble(value, start, end, &double_value)) { |
| 226 return Double::New(double_value); | 226 return Double::New(double_value); |
| 227 } | 227 } |
| 228 } | 228 } |
| 229 return Object::null(); | 229 return Object::null(); |
| 230 } | 230 } |
| 231 | 231 |
| 232 | 232 |
| 233 DEFINE_NATIVE_ENTRY(Double_toString, 1) { | 233 DEFINE_NATIVE_ENTRY(Double_toString, 1) { |
| 234 const Number& number = Number::CheckedHandle(arguments->NativeArgAt(0)); | 234 const Number& number = Number::CheckedHandle(arguments->NativeArgAt(0)); |
| 235 Heap::Space space = isolate->heap()->ShouldPretenure(kOneByteStringCid) ? | 235 return number.ToString(Heap::kNew); |
| 236 Heap::kPretenured : Heap::kNew; | |
| 237 return number.ToString(space); | |
| 238 } | 236 } |
| 239 | 237 |
| 240 | 238 |
| 241 DEFINE_NATIVE_ENTRY(Double_toStringAsFixed, 2) { | 239 DEFINE_NATIVE_ENTRY(Double_toStringAsFixed, 2) { |
| 242 // The boundaries are exclusive. | 240 // The boundaries are exclusive. |
| 243 static const double kLowerBoundary = -1e21; | 241 static const double kLowerBoundary = -1e21; |
| 244 static const double kUpperBoundary = 1e21; | 242 static const double kUpperBoundary = 1e21; |
| 245 | 243 |
| 246 const Double& arg = Double::CheckedHandle(arguments->NativeArgAt(0)); | 244 const Double& arg = Double::CheckedHandle(arguments->NativeArgAt(0)); |
| 247 GET_NON_NULL_NATIVE_ARGUMENT(Smi, fraction_digits, arguments->NativeArgAt(1)); | 245 GET_NON_NULL_NATIVE_ARGUMENT(Smi, fraction_digits, arguments->NativeArgAt(1)); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 DEFINE_NATIVE_ENTRY(Double_flipSignBit, 1) { | 310 DEFINE_NATIVE_ENTRY(Double_flipSignBit, 1) { |
| 313 const Double& arg = Double::CheckedHandle(arguments->NativeArgAt(0)); | 311 const Double& arg = Double::CheckedHandle(arguments->NativeArgAt(0)); |
| 314 const double in_val = arg.value(); | 312 const double in_val = arg.value(); |
| 315 const int64_t bits = bit_cast<int64_t, double>(in_val) ^ kSignBitDouble; | 313 const int64_t bits = bit_cast<int64_t, double>(in_val) ^ kSignBitDouble; |
| 316 return Double::New(bit_cast<double, int64_t>(bits)); | 314 return Double::New(bit_cast<double, int64_t>(bits)); |
| 317 } | 315 } |
| 318 | 316 |
| 319 // Add here only functions using/referring to old-style casts. | 317 // Add here only functions using/referring to old-style casts. |
| 320 | 318 |
| 321 } // namespace dart | 319 } // namespace dart |
| OLD | NEW |