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 <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/double_conversion.h" | 10 #include "vm/double_conversion.h" |
11 #include "vm/exceptions.h" | 11 #include "vm/exceptions.h" |
12 #include "vm/native_entry.h" | 12 #include "vm/native_entry.h" |
13 #include "vm/object.h" | 13 #include "vm/object.h" |
14 | 14 |
15 namespace dart { | 15 namespace dart { |
16 | 16 |
17 DECLARE_FLAG(bool, trace_intrinsified_natives); | 17 DECLARE_FLAG(bool, trace_intrinsified_natives); |
18 | 18 |
19 DEFINE_NATIVE_ENTRY(Double_doubleFromInteger, 2) { | 19 DEFINE_NATIVE_ENTRY(Double_doubleFromInteger, 2) { |
20 ASSERT(AbstractTypeArguments::CheckedHandle(arguments->At(0)).IsNull()); | 20 ASSERT(AbstractTypeArguments::CheckedHandle( |
21 const Integer& value = Integer::CheckedHandle(arguments->At(1)); | 21 arguments->NativeArgAt(0)).IsNull()); |
| 22 const Integer& value = Integer::CheckedHandle(arguments->NativeArgAt(1)); |
22 if (FLAG_trace_intrinsified_natives) { | 23 if (FLAG_trace_intrinsified_natives) { |
23 OS::Print("Double_doubleFromInteger %s\n", value.ToCString()); | 24 OS::Print("Double_doubleFromInteger %s\n", value.ToCString()); |
24 } | 25 } |
25 return Double::New(value.AsDoubleValue()); | 26 return Double::New(value.AsDoubleValue()); |
26 } | 27 } |
27 | 28 |
28 | 29 |
29 DEFINE_NATIVE_ENTRY(Double_add, 2) { | 30 DEFINE_NATIVE_ENTRY(Double_add, 2) { |
30 double left = Double::CheckedHandle(arguments->At(0)).value(); | 31 double left = Double::CheckedHandle(arguments->NativeArgAt(0)).value(); |
31 GET_NATIVE_ARGUMENT(Double, right_object, arguments->At(1)); | 32 GET_NATIVE_ARGUMENT(Double, right_object, arguments->NativeArgAt(1)); |
32 double right = right_object.value(); | 33 double right = right_object.value(); |
33 if (FLAG_trace_intrinsified_natives) { | 34 if (FLAG_trace_intrinsified_natives) { |
34 OS::Print("Double_add %f + %f\n", left, right); | 35 OS::Print("Double_add %f + %f\n", left, right); |
35 } | 36 } |
36 return Double::New(left + right); | 37 return Double::New(left + right); |
37 } | 38 } |
38 | 39 |
39 | 40 |
40 DEFINE_NATIVE_ENTRY(Double_sub, 2) { | 41 DEFINE_NATIVE_ENTRY(Double_sub, 2) { |
41 double left = Double::CheckedHandle(arguments->At(0)).value(); | 42 double left = Double::CheckedHandle(arguments->NativeArgAt(0)).value(); |
42 GET_NATIVE_ARGUMENT(Double, right_object, arguments->At(1)); | 43 GET_NATIVE_ARGUMENT(Double, right_object, arguments->NativeArgAt(1)); |
43 double right = right_object.value(); | 44 double right = right_object.value(); |
44 if (FLAG_trace_intrinsified_natives) { | 45 if (FLAG_trace_intrinsified_natives) { |
45 OS::Print("Double_sub %f - %f\n", left, right); | 46 OS::Print("Double_sub %f - %f\n", left, right); |
46 } | 47 } |
47 return Double::New(left - right); | 48 return Double::New(left - right); |
48 } | 49 } |
49 | 50 |
50 | 51 |
51 DEFINE_NATIVE_ENTRY(Double_mul, 2) { | 52 DEFINE_NATIVE_ENTRY(Double_mul, 2) { |
52 double left = Double::CheckedHandle(arguments->At(0)).value(); | 53 double left = Double::CheckedHandle(arguments->NativeArgAt(0)).value(); |
53 GET_NATIVE_ARGUMENT(Double, right_object, arguments->At(1)); | 54 GET_NATIVE_ARGUMENT(Double, right_object, arguments->NativeArgAt(1)); |
54 double right = right_object.value(); | 55 double right = right_object.value(); |
55 if (FLAG_trace_intrinsified_natives) { | 56 if (FLAG_trace_intrinsified_natives) { |
56 OS::Print("Double_mul %f * %f\n", left, right); | 57 OS::Print("Double_mul %f * %f\n", left, right); |
57 } | 58 } |
58 return Double::New(left * right); | 59 return Double::New(left * right); |
59 } | 60 } |
60 | 61 |
61 | 62 |
62 DEFINE_NATIVE_ENTRY(Double_div, 2) { | 63 DEFINE_NATIVE_ENTRY(Double_div, 2) { |
63 double left = Double::CheckedHandle(arguments->At(0)).value(); | 64 double left = Double::CheckedHandle(arguments->NativeArgAt(0)).value(); |
64 GET_NATIVE_ARGUMENT(Double, right_object, arguments->At(1)); | 65 GET_NATIVE_ARGUMENT(Double, right_object, arguments->NativeArgAt(1)); |
65 double right = right_object.value(); | 66 double right = right_object.value(); |
66 if (FLAG_trace_intrinsified_natives) { | 67 if (FLAG_trace_intrinsified_natives) { |
67 OS::Print("Double_div %f / %f\n", left, right); | 68 OS::Print("Double_div %f / %f\n", left, right); |
68 } | 69 } |
69 return Double::New(left / right); | 70 return Double::New(left / right); |
70 } | 71 } |
71 | 72 |
72 | 73 |
73 DEFINE_NATIVE_ENTRY(Double_trunc_div, 2) { | 74 DEFINE_NATIVE_ENTRY(Double_trunc_div, 2) { |
74 double left = Double::CheckedHandle(arguments->At(0)).value(); | 75 double left = Double::CheckedHandle(arguments->NativeArgAt(0)).value(); |
75 GET_NATIVE_ARGUMENT(Double, right_object, arguments->At(1)); | 76 GET_NATIVE_ARGUMENT(Double, right_object, arguments->NativeArgAt(1)); |
76 double right = right_object.value(); | 77 double right = right_object.value(); |
77 if (FLAG_trace_intrinsified_natives) { | 78 if (FLAG_trace_intrinsified_natives) { |
78 OS::Print("Double_trunc_div %f ~/ %f\n", left, right); | 79 OS::Print("Double_trunc_div %f ~/ %f\n", left, right); |
79 } | 80 } |
80 return Double::New(trunc(left / right)); | 81 return Double::New(trunc(left / right)); |
81 } | 82 } |
82 | 83 |
83 | 84 |
84 DEFINE_NATIVE_ENTRY(Double_modulo, 2) { | 85 DEFINE_NATIVE_ENTRY(Double_modulo, 2) { |
85 double left = Double::CheckedHandle(arguments->At(0)).value(); | 86 double left = Double::CheckedHandle(arguments->NativeArgAt(0)).value(); |
86 GET_NATIVE_ARGUMENT(Double, right_object, arguments->At(1)); | 87 GET_NATIVE_ARGUMENT(Double, right_object, arguments->NativeArgAt(1)); |
87 double right = right_object.value(); | 88 double right = right_object.value(); |
88 double remainder = fmod(left, right); | 89 double remainder = fmod(left, right); |
89 if (remainder == 0.0) { | 90 if (remainder == 0.0) { |
90 // We explicitely switch to the positive 0.0 (just in case it was negative). | 91 // We explicitely switch to the positive 0.0 (just in case it was negative). |
91 remainder = +0.0; | 92 remainder = +0.0; |
92 } else if (remainder < 0) { | 93 } else if (remainder < 0) { |
93 if (right < 0) { | 94 if (right < 0) { |
94 remainder -= right; | 95 remainder -= right; |
95 } else { | 96 } else { |
96 remainder += right; | 97 remainder += right; |
97 } | 98 } |
98 } | 99 } |
99 return Double::New(remainder); | 100 return Double::New(remainder); |
100 } | 101 } |
101 | 102 |
102 | 103 |
103 DEFINE_NATIVE_ENTRY(Double_remainder, 2) { | 104 DEFINE_NATIVE_ENTRY(Double_remainder, 2) { |
104 double left = Double::CheckedHandle(arguments->At(0)).value(); | 105 double left = Double::CheckedHandle(arguments->NativeArgAt(0)).value(); |
105 GET_NATIVE_ARGUMENT(Double, right_object, arguments->At(1)); | 106 GET_NATIVE_ARGUMENT(Double, right_object, arguments->NativeArgAt(1)); |
106 double right = right_object.value(); | 107 double right = right_object.value(); |
107 return Double::New(fmod(left, right)); | 108 return Double::New(fmod(left, right)); |
108 } | 109 } |
109 | 110 |
110 | 111 |
111 DEFINE_NATIVE_ENTRY(Double_greaterThan, 2) { | 112 DEFINE_NATIVE_ENTRY(Double_greaterThan, 2) { |
112 const Double& left = Double::CheckedHandle(arguments->At(0)); | 113 const Double& left = Double::CheckedHandle(arguments->NativeArgAt(0)); |
113 GET_NATIVE_ARGUMENT(Double, right, arguments->At(1)); | 114 GET_NATIVE_ARGUMENT(Double, right, arguments->NativeArgAt(1)); |
114 bool result = right.IsNull() ? false : (left.value() > right.value()); | 115 bool result = right.IsNull() ? false : (left.value() > right.value()); |
115 if (FLAG_trace_intrinsified_natives) { | 116 if (FLAG_trace_intrinsified_natives) { |
116 OS::Print("Double_greaterThan %s > %s\n", | 117 OS::Print("Double_greaterThan %s > %s\n", |
117 left.ToCString(), right.ToCString()); | 118 left.ToCString(), right.ToCString()); |
118 } | 119 } |
119 return Bool::Get(result); | 120 return Bool::Get(result); |
120 } | 121 } |
121 | 122 |
122 | 123 |
123 DEFINE_NATIVE_ENTRY(Double_greaterThanFromInteger, 2) { | 124 DEFINE_NATIVE_ENTRY(Double_greaterThanFromInteger, 2) { |
124 const Double& right = Double::CheckedHandle(arguments->At(0)); | 125 const Double& right = Double::CheckedHandle(arguments->NativeArgAt(0)); |
125 GET_NATIVE_ARGUMENT(Integer, left, arguments->At(1)); | 126 GET_NATIVE_ARGUMENT(Integer, left, arguments->NativeArgAt(1)); |
126 return Bool::Get(left.AsDoubleValue() > right.value()); | 127 return Bool::Get(left.AsDoubleValue() > right.value()); |
127 } | 128 } |
128 | 129 |
129 | 130 |
130 DEFINE_NATIVE_ENTRY(Double_equal, 2) { | 131 DEFINE_NATIVE_ENTRY(Double_equal, 2) { |
131 const Double& left = Double::CheckedHandle(arguments->At(0)); | 132 const Double& left = Double::CheckedHandle(arguments->NativeArgAt(0)); |
132 GET_NATIVE_ARGUMENT(Double, right, arguments->At(1)); | 133 GET_NATIVE_ARGUMENT(Double, right, arguments->NativeArgAt(1)); |
133 bool result = right.IsNull() ? false : (left.value() == right.value()); | 134 bool result = right.IsNull() ? false : (left.value() == right.value()); |
134 if (FLAG_trace_intrinsified_natives) { | 135 if (FLAG_trace_intrinsified_natives) { |
135 OS::Print("Double_equal %s == %s\n", | 136 OS::Print("Double_equal %s == %s\n", |
136 left.ToCString(), right.ToCString()); | 137 left.ToCString(), right.ToCString()); |
137 } | 138 } |
138 return Bool::Get(result); | 139 return Bool::Get(result); |
139 } | 140 } |
140 | 141 |
141 | 142 |
142 DEFINE_NATIVE_ENTRY(Double_equalToInteger, 2) { | 143 DEFINE_NATIVE_ENTRY(Double_equalToInteger, 2) { |
143 const Double& left = Double::CheckedHandle(arguments->At(0)); | 144 const Double& left = Double::CheckedHandle(arguments->NativeArgAt(0)); |
144 GET_NATIVE_ARGUMENT(Integer, right, arguments->At(1)); | 145 GET_NATIVE_ARGUMENT(Integer, right, arguments->NativeArgAt(1)); |
145 return Bool::Get(left.value() == right.AsDoubleValue()); | 146 return Bool::Get(left.value() == right.AsDoubleValue()); |
146 } | 147 } |
147 | 148 |
148 | 149 |
149 DEFINE_NATIVE_ENTRY(Double_round, 1) { | 150 DEFINE_NATIVE_ENTRY(Double_round, 1) { |
150 const Double& arg = Double::CheckedHandle(arguments->At(0)); | 151 const Double& arg = Double::CheckedHandle(arguments->NativeArgAt(0)); |
151 return Double::New(round(arg.value())); | 152 return Double::New(round(arg.value())); |
152 } | 153 } |
153 | 154 |
154 DEFINE_NATIVE_ENTRY(Double_floor, 1) { | 155 DEFINE_NATIVE_ENTRY(Double_floor, 1) { |
155 const Double& arg = Double::CheckedHandle(arguments->At(0)); | 156 const Double& arg = Double::CheckedHandle(arguments->NativeArgAt(0)); |
156 return Double::New(floor(arg.value())); | 157 return Double::New(floor(arg.value())); |
157 } | 158 } |
158 | 159 |
159 DEFINE_NATIVE_ENTRY(Double_ceil, 1) { | 160 DEFINE_NATIVE_ENTRY(Double_ceil, 1) { |
160 const Double& arg = Double::CheckedHandle(arguments->At(0)); | 161 const Double& arg = Double::CheckedHandle(arguments->NativeArgAt(0)); |
161 return Double::New(ceil(arg.value())); | 162 return Double::New(ceil(arg.value())); |
162 } | 163 } |
163 | 164 |
164 | 165 |
165 DEFINE_NATIVE_ENTRY(Double_truncate, 1) { | 166 DEFINE_NATIVE_ENTRY(Double_truncate, 1) { |
166 const Double& arg = Double::CheckedHandle(arguments->At(0)); | 167 const Double& arg = Double::CheckedHandle(arguments->NativeArgAt(0)); |
167 return Double::New(trunc(arg.value())); | 168 return Double::New(trunc(arg.value())); |
168 } | 169 } |
169 | 170 |
170 | 171 |
171 DEFINE_NATIVE_ENTRY(Double_pow, 2) { | 172 DEFINE_NATIVE_ENTRY(Double_pow, 2) { |
172 const double operand = Double::CheckedHandle(arguments->At(0)).value(); | 173 const double operand = |
173 GET_NATIVE_ARGUMENT(Double, exponent_object, arguments->At(1)); | 174 Double::CheckedHandle(arguments->NativeArgAt(0)).value(); |
| 175 GET_NATIVE_ARGUMENT(Double, exponent_object, arguments->NativeArgAt(1)); |
174 const double exponent = exponent_object.value(); | 176 const double exponent = exponent_object.value(); |
175 return Double::New(pow(operand, exponent)); | 177 return Double::New(pow(operand, exponent)); |
176 } | 178 } |
177 | 179 |
178 | 180 |
179 #if defined(TARGET_OS_MACOS) | 181 #if defined(TARGET_OS_MACOS) |
180 // MAC OSX math library produces old style cast warning. | 182 // MAC OSX math library produces old style cast warning. |
181 #pragma GCC diagnostic ignored "-Wold-style-cast" | 183 #pragma GCC diagnostic ignored "-Wold-style-cast" |
182 #endif | 184 #endif |
183 | 185 |
184 DEFINE_NATIVE_ENTRY(Double_toInt, 1) { | 186 DEFINE_NATIVE_ENTRY(Double_toInt, 1) { |
185 const Double& arg = Double::CheckedHandle(arguments->At(0)); | 187 const Double& arg = Double::CheckedHandle(arguments->NativeArgAt(0)); |
186 if (isinf(arg.value()) || isnan(arg.value())) { | 188 if (isinf(arg.value()) || isnan(arg.value())) { |
187 GrowableArray<const Object*> args; | 189 GrowableArray<const Object*> args; |
188 args.Add(&String::ZoneHandle(String::New( | 190 args.Add(&String::ZoneHandle(String::New( |
189 "Infinity or NaN toInt"))); | 191 "Infinity or NaN toInt"))); |
190 Exceptions::ThrowByType(Exceptions::kFormat, args); | 192 Exceptions::ThrowByType(Exceptions::kFormat, args); |
191 } | 193 } |
192 double result = trunc(arg.value()); | 194 double result = trunc(arg.value()); |
193 if ((Smi::kMinValue <= result) && (result <= Smi::kMaxValue)) { | 195 if ((Smi::kMinValue <= result) && (result <= Smi::kMaxValue)) { |
194 return Smi::New(static_cast<intptr_t>(result)); | 196 return Smi::New(static_cast<intptr_t>(result)); |
195 } else if ((Mint::kMinValue <= result) && (result <= Mint::kMaxValue)) { | 197 } else if ((Mint::kMinValue <= result) && (result <= Mint::kMaxValue)) { |
196 return Mint::New(static_cast<int64_t>(result)); | 198 return Mint::New(static_cast<int64_t>(result)); |
197 } else { | 199 } else { |
198 return BigintOperations::NewFromDouble(result); | 200 return BigintOperations::NewFromDouble(result); |
199 } | 201 } |
200 } | 202 } |
201 | 203 |
202 | 204 |
203 DEFINE_NATIVE_ENTRY(Double_toStringAsFixed, 2) { | 205 DEFINE_NATIVE_ENTRY(Double_toStringAsFixed, 2) { |
204 // The boundaries are exclusive. | 206 // The boundaries are exclusive. |
205 static const double kLowerBoundary = -1e21; | 207 static const double kLowerBoundary = -1e21; |
206 static const double kUpperBoundary = 1e21; | 208 static const double kUpperBoundary = 1e21; |
207 | 209 |
208 const Double& arg = Double::CheckedHandle(arguments->At(0)); | 210 const Double& arg = Double::CheckedHandle(arguments->NativeArgAt(0)); |
209 GET_NATIVE_ARGUMENT(Smi, fraction_digits, arguments->At(1)); | 211 GET_NATIVE_ARGUMENT(Smi, fraction_digits, arguments->NativeArgAt(1)); |
210 double d = arg.value(); | 212 double d = arg.value(); |
211 intptr_t fraction_digits_value = fraction_digits.Value(); | 213 intptr_t fraction_digits_value = fraction_digits.Value(); |
212 if (0 <= fraction_digits_value && fraction_digits_value <= 20 | 214 if (0 <= fraction_digits_value && fraction_digits_value <= 20 |
213 && kLowerBoundary < d && d < kUpperBoundary) { | 215 && kLowerBoundary < d && d < kUpperBoundary) { |
214 return DoubleToStringAsFixed(d, static_cast<int>(fraction_digits_value)); | 216 return DoubleToStringAsFixed(d, static_cast<int>(fraction_digits_value)); |
215 } else { | 217 } else { |
216 GrowableArray<const Object*> args; | 218 GrowableArray<const Object*> args; |
217 args.Add(&String::ZoneHandle(String::New( | 219 args.Add(&String::ZoneHandle(String::New( |
218 "Illegal arguments to double.toStringAsFixed"))); | 220 "Illegal arguments to double.toStringAsFixed"))); |
219 Exceptions::ThrowByType(Exceptions::kArgument, args); | 221 Exceptions::ThrowByType(Exceptions::kArgument, args); |
220 return Object::null(); | 222 return Object::null(); |
221 } | 223 } |
222 } | 224 } |
223 | 225 |
224 | 226 |
225 DEFINE_NATIVE_ENTRY(Double_toStringAsExponential, 2) { | 227 DEFINE_NATIVE_ENTRY(Double_toStringAsExponential, 2) { |
226 const Double& arg = Double::CheckedHandle(arguments->At(0)); | 228 const Double& arg = Double::CheckedHandle(arguments->NativeArgAt(0)); |
227 GET_NATIVE_ARGUMENT(Smi, fraction_digits, arguments->At(1)); | 229 GET_NATIVE_ARGUMENT(Smi, fraction_digits, arguments->NativeArgAt(1)); |
228 double d = arg.value(); | 230 double d = arg.value(); |
229 intptr_t fraction_digits_value = fraction_digits.Value(); | 231 intptr_t fraction_digits_value = fraction_digits.Value(); |
230 if (-1 <= fraction_digits_value && fraction_digits_value <= 20) { | 232 if (-1 <= fraction_digits_value && fraction_digits_value <= 20) { |
231 return DoubleToStringAsExponential( | 233 return DoubleToStringAsExponential( |
232 d, static_cast<int>(fraction_digits_value)); | 234 d, static_cast<int>(fraction_digits_value)); |
233 } else { | 235 } else { |
234 GrowableArray<const Object*> args; | 236 GrowableArray<const Object*> args; |
235 args.Add(&String::ZoneHandle(String::New( | 237 args.Add(&String::ZoneHandle(String::New( |
236 "Illegal arguments to double.toStringAsExponential"))); | 238 "Illegal arguments to double.toStringAsExponential"))); |
237 Exceptions::ThrowByType(Exceptions::kArgument, args); | 239 Exceptions::ThrowByType(Exceptions::kArgument, args); |
238 return Object::null(); | 240 return Object::null(); |
239 } | 241 } |
240 } | 242 } |
241 | 243 |
242 | 244 |
243 DEFINE_NATIVE_ENTRY(Double_toStringAsPrecision, 2) { | 245 DEFINE_NATIVE_ENTRY(Double_toStringAsPrecision, 2) { |
244 const Double& arg = Double::CheckedHandle(arguments->At(0)); | 246 const Double& arg = Double::CheckedHandle(arguments->NativeArgAt(0)); |
245 GET_NATIVE_ARGUMENT(Smi, precision, arguments->At(1)); | 247 GET_NATIVE_ARGUMENT(Smi, precision, arguments->NativeArgAt(1)); |
246 double d = arg.value(); | 248 double d = arg.value(); |
247 intptr_t precision_value = precision.Value(); | 249 intptr_t precision_value = precision.Value(); |
248 if (1 <= precision_value && precision_value <= 21) { | 250 if (1 <= precision_value && precision_value <= 21) { |
249 return DoubleToStringAsPrecision(d, static_cast<int>(precision_value)); | 251 return DoubleToStringAsPrecision(d, static_cast<int>(precision_value)); |
250 } else { | 252 } else { |
251 GrowableArray<const Object*> args; | 253 GrowableArray<const Object*> args; |
252 args.Add(&String::ZoneHandle(String::New( | 254 args.Add(&String::ZoneHandle(String::New( |
253 "Illegal arguments to double.toStringAsPrecision"))); | 255 "Illegal arguments to double.toStringAsPrecision"))); |
254 Exceptions::ThrowByType(Exceptions::kArgument, args); | 256 Exceptions::ThrowByType(Exceptions::kArgument, args); |
255 return Object::null(); | 257 return Object::null(); |
256 } | 258 } |
257 } | 259 } |
258 | 260 |
259 | 261 |
260 DEFINE_NATIVE_ENTRY(Double_getIsInfinite, 1) { | 262 DEFINE_NATIVE_ENTRY(Double_getIsInfinite, 1) { |
261 const Double& arg = Double::CheckedHandle(arguments->At(0)); | 263 const Double& arg = Double::CheckedHandle(arguments->NativeArgAt(0)); |
262 return Bool::Get(isinf(arg.value())); | 264 return Bool::Get(isinf(arg.value())); |
263 } | 265 } |
264 | 266 |
265 | 267 |
266 DEFINE_NATIVE_ENTRY(Double_getIsNaN, 1) { | 268 DEFINE_NATIVE_ENTRY(Double_getIsNaN, 1) { |
267 const Double& arg = Double::CheckedHandle(arguments->At(0)); | 269 const Double& arg = Double::CheckedHandle(arguments->NativeArgAt(0)); |
268 return Bool::Get(isnan(arg.value())); | 270 return Bool::Get(isnan(arg.value())); |
269 } | 271 } |
270 | 272 |
271 | 273 |
272 DEFINE_NATIVE_ENTRY(Double_getIsNegative, 1) { | 274 DEFINE_NATIVE_ENTRY(Double_getIsNegative, 1) { |
273 const Double& arg = Double::CheckedHandle(arguments->At(0)); | 275 const Double& arg = Double::CheckedHandle(arguments->NativeArgAt(0)); |
274 // Include negative zero, infinity. | 276 // Include negative zero, infinity. |
275 return Bool::Get(signbit(arg.value()) && !isnan(arg.value())); | 277 return Bool::Get(signbit(arg.value()) && !isnan(arg.value())); |
276 } | 278 } |
277 | 279 |
278 // Add here only functions using/referring to old-style casts. | 280 // Add here only functions using/referring to old-style casts. |
279 | 281 |
280 } // namespace dart | 282 } // namespace dart |
OLD | NEW |