Chromium Code Reviews| Index: runtime/lib/double.cc |
| diff --git a/runtime/lib/double.cc b/runtime/lib/double.cc |
| index 303305e04e0721e00a1d88bdeb1807703b8c579c..00c68e823af1033d676c8ada5744f8cd8eaa93b8 100644 |
| --- a/runtime/lib/double.cc |
| +++ b/runtime/lib/double.cc |
| @@ -7,6 +7,7 @@ |
| #include "vm/bootstrap_natives.h" |
| #include "vm/bigint_operations.h" |
| +#include "vm/double_conversion.h" |
| #include "vm/exceptions.h" |
| #include "vm/native_entry.h" |
| #include "vm/object.h" |
| @@ -184,6 +185,33 @@ DEFINE_NATIVE_ENTRY(Double_toInt, 1) { |
| } |
| +DEFINE_NATIVE_ENTRY(Double_toStringAsFixed, 2) { |
| + const Double& arg = Double::CheckedHandle(arguments->At(0)); |
|
Ivan Posva
2011/12/20 00:30:03
@srdjan: It would make sense to changes these spot
|
| + GET_NATIVE_ARGUMENT(Smi, fraction_digits, arguments->At(1)); |
| + double d = arg.value(); |
| + int fraction_digits_value = fraction_digits.Value(); |
| + String& result = String::Handle(); |
| + bool succeeded = DoubleToStringAsFixed(d, fraction_digits_value, result); |
| + if (!succeeded) { |
| + GrowableArray<const Object*> args; |
| + args.Add(&String::ZoneHandle(String::New( |
| + "Illegal arguments to double.toStringAsFixed"))); |
| + Exceptions::ThrowByType(Exceptions::kIllegalArgument, args); |
| + } |
| + arguments->SetReturn(result); |
| +} |
| + |
| + |
| +DEFINE_NATIVE_ENTRY(Double_toStringAsExponential, 2) { |
| + UNIMPLEMENTED(); |
| +} |
| + |
| + |
| +DEFINE_NATIVE_ENTRY(Double_toStringAsPrecision, 2) { |
| + UNIMPLEMENTED(); |
| +} |
| + |
| + |
| DEFINE_NATIVE_ENTRY(Double_isInfinite, 1) { |
| const Double& arg = Double::CheckedHandle(arguments->At(0)); |
| if (isinf(arg.value())) { |