OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 7770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7781 if (y == 0) { | 7781 if (y == 0) { |
7782 return Smi::FromInt(1); | 7782 return Smi::FromInt(1); |
7783 } else { | 7783 } else { |
7784 double result = power_double_double(x, y); | 7784 double result = power_double_double(x, y); |
7785 if (std::isnan(result)) return isolate->heap()->nan_value(); | 7785 if (std::isnan(result)) return isolate->heap()->nan_value(); |
7786 return isolate->heap()->AllocateHeapNumber(result); | 7786 return isolate->heap()->AllocateHeapNumber(result); |
7787 } | 7787 } |
7788 } | 7788 } |
7789 | 7789 |
7790 | 7790 |
| 7791 #define HYPERBOLIC_MATH_FUNCTION(name) \ |
| 7792 RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_##name) { \ |
| 7793 SealHandleScope shs(isolate); \ |
| 7794 ASSERT(args.length() == 1); \ |
| 7795 CONVERT_DOUBLE_ARG_CHECKED(x, 0); \ |
| 7796 return isolate->heap()->AllocateHeapNumber(name(x)); \ |
| 7797 } |
| 7798 |
| 7799 HYPERBOLIC_MATH_FUNCTION(asinh) |
| 7800 HYPERBOLIC_MATH_FUNCTION(acosh) |
| 7801 HYPERBOLIC_MATH_FUNCTION(atanh) |
| 7802 |
| 7803 #undef HYPERBOLIC_MATH_FUNCTION |
| 7804 |
| 7805 |
7791 RUNTIME_FUNCTION(MaybeObject*, Runtime_RoundNumber) { | 7806 RUNTIME_FUNCTION(MaybeObject*, Runtime_RoundNumber) { |
7792 SealHandleScope shs(isolate); | 7807 SealHandleScope shs(isolate); |
7793 ASSERT(args.length() == 1); | 7808 ASSERT(args.length() == 1); |
7794 isolate->counters()->math_round()->Increment(); | 7809 isolate->counters()->math_round()->Increment(); |
7795 | 7810 |
7796 if (!args[0]->IsHeapNumber()) { | 7811 if (!args[0]->IsHeapNumber()) { |
7797 // Must be smi. Return the argument unchanged for all the other types | 7812 // Must be smi. Return the argument unchanged for all the other types |
7798 // to make fuzz-natives test happy. | 7813 // to make fuzz-natives test happy. |
7799 return args[0]; | 7814 return args[0]; |
7800 } | 7815 } |
(...skipping 7114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14915 // Handle last resort GC and make sure to allow future allocations | 14930 // Handle last resort GC and make sure to allow future allocations |
14916 // to grow the heap without causing GCs (if possible). | 14931 // to grow the heap without causing GCs (if possible). |
14917 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14932 isolate->counters()->gc_last_resort_from_js()->Increment(); |
14918 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14933 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
14919 "Runtime::PerformGC"); | 14934 "Runtime::PerformGC"); |
14920 } | 14935 } |
14921 } | 14936 } |
14922 | 14937 |
14923 | 14938 |
14924 } } // namespace v8::internal | 14939 } } // namespace v8::internal |
OLD | NEW |