Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: src/runtime.cc

Issue 102023003: Implement hyperbolic math functions for ES6. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: add test cases Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/runtime.h ('k') | test/mjsunit/harmony/math-hyperbolic.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « src/runtime.h ('k') | test/mjsunit/harmony/math-hyperbolic.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698