| 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 <ctype.h> // isspace. | 5 #include <ctype.h> // isspace. |
| 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/exceptions.h" | 10 #include "vm/exceptions.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 DEFINE_NATIVE_ENTRY(MathNatives_acos, 1) { | 44 DEFINE_NATIVE_ENTRY(MathNatives_acos, 1) { |
| 45 GET_NATIVE_ARGUMENT(Double, operand, arguments->At(0)); | 45 GET_NATIVE_ARGUMENT(Double, operand, arguments->At(0)); |
| 46 arguments->SetReturn(Double::Handle(Double::New(acos(operand.value())))); | 46 arguments->SetReturn(Double::Handle(Double::New(acos(operand.value())))); |
| 47 } | 47 } |
| 48 | 48 |
| 49 DEFINE_NATIVE_ENTRY(MathNatives_atan, 1) { | 49 DEFINE_NATIVE_ENTRY(MathNatives_atan, 1) { |
| 50 GET_NATIVE_ARGUMENT(Double, operand, arguments->At(0)); | 50 GET_NATIVE_ARGUMENT(Double, operand, arguments->At(0)); |
| 51 arguments->SetReturn(Double::Handle(Double::New(atan(operand.value())))); | 51 arguments->SetReturn(Double::Handle(Double::New(atan(operand.value())))); |
| 52 } | 52 } |
| 53 | 53 |
| 54 // It is not possible to call the native MathNatives_atan2. Somehow this leads | 54 DEFINE_NATIVE_ENTRY(MathNatives_atan2, 2) { |
| 55 // to a dynamic error "native function 'MathNatives_atan2' cannot be found". | |
| 56 DEFINE_NATIVE_ENTRY(MathNatives_2atan, 2) { | |
| 57 GET_NATIVE_ARGUMENT(Double, operand1, arguments->At(0)); | 55 GET_NATIVE_ARGUMENT(Double, operand1, arguments->At(0)); |
| 58 GET_NATIVE_ARGUMENT(Double, operand2, arguments->At(1)); | 56 GET_NATIVE_ARGUMENT(Double, operand2, arguments->At(1)); |
| 59 arguments->SetReturn(Double::Handle(Double::New( | 57 arguments->SetReturn(Double::Handle(Double::New( |
| 60 atan2(operand1.value(), operand2.value())))); | 58 atan2(operand1.value(), operand2.value())))); |
| 61 } | 59 } |
| 62 | 60 |
| 63 DEFINE_NATIVE_ENTRY(MathNatives_exp, 1) { | 61 DEFINE_NATIVE_ENTRY(MathNatives_exp, 1) { |
| 64 GET_NATIVE_ARGUMENT(Double, operand, arguments->At(0)); | 62 GET_NATIVE_ARGUMENT(Double, operand, arguments->At(0)); |
| 65 arguments->SetReturn(Double::Handle(Double::New(exp(operand.value())))); | 63 arguments->SetReturn(Double::Handle(Double::New(exp(operand.value())))); |
| 66 } | 64 } |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 return; | 173 return; |
| 176 } | 174 } |
| 177 } | 175 } |
| 178 | 176 |
| 179 GrowableArray<const Object*> args; | 177 GrowableArray<const Object*> args; |
| 180 args.Add(&value); | 178 args.Add(&value); |
| 181 Exceptions::ThrowByType(Exceptions::kBadNumberFormat, args); | 179 Exceptions::ThrowByType(Exceptions::kBadNumberFormat, args); |
| 182 } | 180 } |
| 183 | 181 |
| 184 } // namespace dart | 182 } // namespace dart |
| OLD | NEW |