OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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/builtins/builtins.h" | 5 #include "src/builtins/builtins.h" |
6 #include "src/builtins/builtins-utils.h" | 6 #include "src/builtins/builtins-utils.h" |
7 | 7 |
8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 max = abs_value; | 334 max = abs_value; |
335 } | 335 } |
336 } | 336 } |
337 } | 337 } |
338 | 338 |
339 if (max == V8_INFINITY) { | 339 if (max == V8_INFINITY) { |
340 return *isolate->factory()->NewNumber(V8_INFINITY); | 340 return *isolate->factory()->NewNumber(V8_INFINITY); |
341 } | 341 } |
342 | 342 |
343 if (one_arg_is_nan) { | 343 if (one_arg_is_nan) { |
344 return *isolate->factory()->nan_value(); | 344 return isolate->heap()->nan_value(); |
345 } | 345 } |
346 | 346 |
347 if (max == 0) { | 347 if (max == 0) { |
348 return Smi::kZero; | 348 return Smi::kZero; |
349 } | 349 } |
350 DCHECK_GT(max, 0); | 350 DCHECK_GT(max, 0); |
351 | 351 |
352 // Kahan summation to avoid rounding errors. | 352 // Kahan summation to avoid rounding errors. |
353 // Normalize the numbers to the largest one to avoid overflow. | 353 // Normalize the numbers to the largest one to avoid overflow. |
354 double sum = 0; | 354 double sum = 0; |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
592 void Builtins::Generate_MathMax(MacroAssembler* masm) { | 592 void Builtins::Generate_MathMax(MacroAssembler* masm) { |
593 Generate_MathMaxMin(masm, MathMaxMinKind::kMax); | 593 Generate_MathMaxMin(masm, MathMaxMinKind::kMax); |
594 } | 594 } |
595 | 595 |
596 void Builtins::Generate_MathMin(MacroAssembler* masm) { | 596 void Builtins::Generate_MathMin(MacroAssembler* masm) { |
597 Generate_MathMaxMin(masm, MathMaxMinKind::kMin); | 597 Generate_MathMaxMin(masm, MathMaxMinKind::kMin); |
598 } | 598 } |
599 | 599 |
600 } // namespace internal | 600 } // namespace internal |
601 } // namespace v8 | 601 } // namespace v8 |
OLD | NEW |