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

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

Issue 11468016: Rename GET_NATIVE_ARGUMENT macro to GET_NON_NULL_NATIVE_ARGUMENT. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years 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 | « runtime/lib/isolate.cc ('k') | runtime/lib/mirrors.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 <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"
11 #include "vm/native_entry.h" 11 #include "vm/native_entry.h"
12 #include "vm/object.h" 12 #include "vm/object.h"
13 #include "vm/scanner.h" 13 #include "vm/scanner.h"
14 #include "vm/symbols.h" 14 #include "vm/symbols.h"
15 15
16 namespace dart { 16 namespace dart {
17 17
18 DEFINE_NATIVE_ENTRY(Math_sqrt, 1) { 18 DEFINE_NATIVE_ENTRY(Math_sqrt, 1) {
19 GET_NATIVE_ARGUMENT(Double, operand, arguments->NativeArgAt(0)); 19 GET_NON_NULL_NATIVE_ARGUMENT(Double, operand, arguments->NativeArgAt(0));
20 return Double::New(sqrt(operand.value())); 20 return Double::New(sqrt(operand.value()));
21 } 21 }
22 22
23 DEFINE_NATIVE_ENTRY(Math_sin, 1) { 23 DEFINE_NATIVE_ENTRY(Math_sin, 1) {
24 GET_NATIVE_ARGUMENT(Double, operand, arguments->NativeArgAt(0)); 24 GET_NON_NULL_NATIVE_ARGUMENT(Double, operand, arguments->NativeArgAt(0));
25 return Double::New(sin(operand.value())); 25 return Double::New(sin(operand.value()));
26 } 26 }
27 27
28 DEFINE_NATIVE_ENTRY(Math_cos, 1) { 28 DEFINE_NATIVE_ENTRY(Math_cos, 1) {
29 GET_NATIVE_ARGUMENT(Double, operand, arguments->NativeArgAt(0)); 29 GET_NON_NULL_NATIVE_ARGUMENT(Double, operand, arguments->NativeArgAt(0));
30 return Double::New(cos(operand.value())); 30 return Double::New(cos(operand.value()));
31 } 31 }
32 32
33 DEFINE_NATIVE_ENTRY(Math_tan, 1) { 33 DEFINE_NATIVE_ENTRY(Math_tan, 1) {
34 GET_NATIVE_ARGUMENT(Double, operand, arguments->NativeArgAt(0)); 34 GET_NON_NULL_NATIVE_ARGUMENT(Double, operand, arguments->NativeArgAt(0));
35 return Double::New(tan(operand.value())); 35 return Double::New(tan(operand.value()));
36 } 36 }
37 37
38 DEFINE_NATIVE_ENTRY(Math_asin, 1) { 38 DEFINE_NATIVE_ENTRY(Math_asin, 1) {
39 GET_NATIVE_ARGUMENT(Double, operand, arguments->NativeArgAt(0)); 39 GET_NON_NULL_NATIVE_ARGUMENT(Double, operand, arguments->NativeArgAt(0));
40 return Double::New(asin(operand.value())); 40 return Double::New(asin(operand.value()));
41 } 41 }
42 42
43 DEFINE_NATIVE_ENTRY(Math_acos, 1) { 43 DEFINE_NATIVE_ENTRY(Math_acos, 1) {
44 GET_NATIVE_ARGUMENT(Double, operand, arguments->NativeArgAt(0)); 44 GET_NON_NULL_NATIVE_ARGUMENT(Double, operand, arguments->NativeArgAt(0));
45 return Double::New(acos(operand.value())); 45 return Double::New(acos(operand.value()));
46 } 46 }
47 47
48 DEFINE_NATIVE_ENTRY(Math_atan, 1) { 48 DEFINE_NATIVE_ENTRY(Math_atan, 1) {
49 GET_NATIVE_ARGUMENT(Double, operand, arguments->NativeArgAt(0)); 49 GET_NON_NULL_NATIVE_ARGUMENT(Double, operand, arguments->NativeArgAt(0));
50 return Double::New(atan(operand.value())); 50 return Double::New(atan(operand.value()));
51 } 51 }
52 52
53 DEFINE_NATIVE_ENTRY(Math_atan2, 2) { 53 DEFINE_NATIVE_ENTRY(Math_atan2, 2) {
54 GET_NATIVE_ARGUMENT(Double, operand1, arguments->NativeArgAt(0)); 54 GET_NON_NULL_NATIVE_ARGUMENT(Double, operand1, arguments->NativeArgAt(0));
55 GET_NATIVE_ARGUMENT(Double, operand2, arguments->NativeArgAt(1)); 55 GET_NON_NULL_NATIVE_ARGUMENT(Double, operand2, arguments->NativeArgAt(1));
56 return Double::New(atan2_ieee(operand1.value(), operand2.value())); 56 return Double::New(atan2_ieee(operand1.value(), operand2.value()));
57 } 57 }
58 58
59 DEFINE_NATIVE_ENTRY(Math_exp, 1) { 59 DEFINE_NATIVE_ENTRY(Math_exp, 1) {
60 GET_NATIVE_ARGUMENT(Double, operand, arguments->NativeArgAt(0)); 60 GET_NON_NULL_NATIVE_ARGUMENT(Double, operand, arguments->NativeArgAt(0));
61 return Double::New(exp(operand.value())); 61 return Double::New(exp(operand.value()));
62 } 62 }
63 63
64 DEFINE_NATIVE_ENTRY(Math_log, 1) { 64 DEFINE_NATIVE_ENTRY(Math_log, 1) {
65 GET_NATIVE_ARGUMENT(Double, operand, arguments->NativeArgAt(0)); 65 GET_NON_NULL_NATIVE_ARGUMENT(Double, operand, arguments->NativeArgAt(0));
66 return Double::New(log(operand.value())); 66 return Double::New(log(operand.value()));
67 } 67 }
68 68
69 } // namespace dart 69 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/lib/isolate.cc ('k') | runtime/lib/mirrors.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698