OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/runtime/runtime-utils.h" | 5 #include "src/runtime/runtime-utils.h" |
6 | 6 |
7 #include "src/arguments.h" | 7 #include "src/arguments.h" |
8 #include "src/base/bits.h" | 8 #include "src/base/bits.h" |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
| 11 #include "src/isolate-inl.h" |
11 | 12 |
12 namespace v8 { | 13 namespace v8 { |
13 namespace internal { | 14 namespace internal { |
14 | 15 |
15 RUNTIME_FUNCTION(Runtime_NumberToRadixString) { | 16 RUNTIME_FUNCTION(Runtime_NumberToRadixString) { |
16 HandleScope scope(isolate); | 17 HandleScope scope(isolate); |
17 DCHECK(args.length() == 2); | 18 DCHECK(args.length() == 2); |
18 CONVERT_SMI_ARG_CHECKED(radix, 1); | 19 CONVERT_SMI_ARG_CHECKED(radix, 1); |
19 RUNTIME_ASSERT(2 <= radix && radix <= 36); | 20 RUNTIME_ASSERT(2 <= radix && radix <= 36); |
20 | 21 |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 | 165 |
165 RUNTIME_FUNCTION(Runtime_NumberToStringSkipCache) { | 166 RUNTIME_FUNCTION(Runtime_NumberToStringSkipCache) { |
166 HandleScope scope(isolate); | 167 HandleScope scope(isolate); |
167 DCHECK(args.length() == 1); | 168 DCHECK(args.length() == 1); |
168 CONVERT_NUMBER_ARG_HANDLE_CHECKED(number, 0); | 169 CONVERT_NUMBER_ARG_HANDLE_CHECKED(number, 0); |
169 | 170 |
170 return *isolate->factory()->NumberToString(number, false); | 171 return *isolate->factory()->NumberToString(number, false); |
171 } | 172 } |
172 | 173 |
173 | 174 |
| 175 // TODO(bmeurer): Kill this runtime entry. Uses in date.js are wrong anyway. |
174 RUNTIME_FUNCTION(Runtime_NumberToIntegerMapMinusZero) { | 176 RUNTIME_FUNCTION(Runtime_NumberToIntegerMapMinusZero) { |
175 HandleScope scope(isolate); | 177 HandleScope scope(isolate); |
176 DCHECK(args.length() == 1); | 178 DCHECK(args.length() == 1); |
177 | 179 CONVERT_ARG_HANDLE_CHECKED(Object, input, 0); |
178 CONVERT_DOUBLE_ARG_CHECKED(number, 0); | 180 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, input, Object::ToNumber(input)); |
179 double double_value = DoubleToInteger(number); | 181 double double_value = DoubleToInteger(input->Number()); |
180 // Map both -0 and +0 to +0. | 182 // Map both -0 and +0 to +0. |
181 if (double_value == 0) double_value = 0; | 183 if (double_value == 0) double_value = 0; |
182 | 184 |
183 return *isolate->factory()->NewNumber(double_value); | 185 return *isolate->factory()->NewNumber(double_value); |
184 } | 186 } |
185 | 187 |
186 | 188 |
187 // Converts a Number to a Smi, if possible. Returns NaN if the number is not | 189 // Converts a Number to a Smi, if possible. Returns NaN if the number is not |
188 // a small integer. | 190 // a small integer. |
189 RUNTIME_FUNCTION(Runtime_NumberToSmi) { | 191 RUNTIME_FUNCTION(Runtime_NumberToSmi) { |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 | 311 |
310 | 312 |
311 RUNTIME_FUNCTION(Runtime_GetRootNaN) { | 313 RUNTIME_FUNCTION(Runtime_GetRootNaN) { |
312 SealHandleScope shs(isolate); | 314 SealHandleScope shs(isolate); |
313 DCHECK(args.length() == 0); | 315 DCHECK(args.length() == 0); |
314 return isolate->heap()->nan_value(); | 316 return isolate->heap()->nan_value(); |
315 } | 317 } |
316 | 318 |
317 } // namespace internal | 319 } // namespace internal |
318 } // namespace v8 | 320 } // namespace v8 |
OLD | NEW |