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" |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 | 164 |
165 RUNTIME_FUNCTION(Runtime_NumberToStringSkipCache) { | 165 RUNTIME_FUNCTION(Runtime_NumberToStringSkipCache) { |
166 HandleScope scope(isolate); | 166 HandleScope scope(isolate); |
167 DCHECK(args.length() == 1); | 167 DCHECK(args.length() == 1); |
168 CONVERT_NUMBER_ARG_HANDLE_CHECKED(number, 0); | 168 CONVERT_NUMBER_ARG_HANDLE_CHECKED(number, 0); |
169 | 169 |
170 return *isolate->factory()->NumberToString(number, false); | 170 return *isolate->factory()->NumberToString(number, false); |
171 } | 171 } |
172 | 172 |
173 | 173 |
174 RUNTIME_FUNCTION(Runtime_NumberToInteger) { | |
175 HandleScope scope(isolate); | |
176 DCHECK(args.length() == 1); | |
177 | |
178 CONVERT_DOUBLE_ARG_CHECKED(number, 0); | |
179 return *isolate->factory()->NewNumber(DoubleToInteger(number)); | |
180 } | |
181 | |
182 | |
183 RUNTIME_FUNCTION(Runtime_NumberToIntegerMapMinusZero) { | 174 RUNTIME_FUNCTION(Runtime_NumberToIntegerMapMinusZero) { |
184 HandleScope scope(isolate); | 175 HandleScope scope(isolate); |
185 DCHECK(args.length() == 1); | 176 DCHECK(args.length() == 1); |
186 | 177 |
187 CONVERT_DOUBLE_ARG_CHECKED(number, 0); | 178 CONVERT_DOUBLE_ARG_CHECKED(number, 0); |
188 double double_value = DoubleToInteger(number); | 179 double double_value = DoubleToInteger(number); |
189 // Map both -0 and +0 to +0. | 180 // Map both -0 and +0 to +0. |
190 if (double_value == 0) double_value = 0; | 181 if (double_value == 0) double_value = 0; |
191 | 182 |
192 return *isolate->factory()->NewNumber(double_value); | 183 return *isolate->factory()->NewNumber(double_value); |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 | 309 |
319 | 310 |
320 RUNTIME_FUNCTION(Runtime_GetRootNaN) { | 311 RUNTIME_FUNCTION(Runtime_GetRootNaN) { |
321 SealHandleScope shs(isolate); | 312 SealHandleScope shs(isolate); |
322 DCHECK(args.length() == 0); | 313 DCHECK(args.length() == 0); |
323 return isolate->heap()->nan_value(); | 314 return isolate->heap()->nan_value(); |
324 } | 315 } |
325 | 316 |
326 } // namespace internal | 317 } // namespace internal |
327 } // namespace v8 | 318 } // namespace v8 |
OLD | NEW |