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

Side by Side Diff: src/runtime.cc

Issue 88053002: Implement Math.ceil via Math.floor. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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') | src/v8-counters.h » ('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 7683 matching lines...) Expand 10 before | Expand all | Expand 10 after
7694 int multiplier = (x < 0) ? -1 : 1; 7694 int multiplier = (x < 0) ? -1 : 1;
7695 if (y < 0) multiplier *= 3; 7695 if (y < 0) multiplier *= 3;
7696 result = multiplier * kPiDividedBy4; 7696 result = multiplier * kPiDividedBy4;
7697 } else { 7697 } else {
7698 result = atan2(x, y); 7698 result = atan2(x, y);
7699 } 7699 }
7700 return isolate->heap()->AllocateHeapNumber(result); 7700 return isolate->heap()->AllocateHeapNumber(result);
7701 } 7701 }
7702 7702
7703 7703
7704 RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_ceil) {
7705 SealHandleScope shs(isolate);
7706 ASSERT(args.length() == 1);
7707 isolate->counters()->math_ceil()->Increment();
7708
7709 CONVERT_DOUBLE_ARG_CHECKED(x, 0);
7710 return isolate->heap()->NumberFromDouble(ceiling(x));
7711 }
7712
7713
7714 RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_cos) { 7704 RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_cos) {
7715 SealHandleScope shs(isolate); 7705 SealHandleScope shs(isolate);
7716 ASSERT(args.length() == 1); 7706 ASSERT(args.length() == 1);
7717 isolate->counters()->math_cos()->Increment(); 7707 isolate->counters()->math_cos()->Increment();
7718 7708
7719 CONVERT_DOUBLE_ARG_CHECKED(x, 0); 7709 CONVERT_DOUBLE_ARG_CHECKED(x, 0);
7720 return isolate->transcendental_cache()->Get(TranscendentalCache::COS, x); 7710 return isolate->transcendental_cache()->Get(TranscendentalCache::COS, x);
7721 } 7711 }
7722 7712
7723 7713
(...skipping 7183 matching lines...) Expand 10 before | Expand all | Expand 10 after
14907 // Handle last resort GC and make sure to allow future allocations 14897 // Handle last resort GC and make sure to allow future allocations
14908 // to grow the heap without causing GCs (if possible). 14898 // to grow the heap without causing GCs (if possible).
14909 isolate->counters()->gc_last_resort_from_js()->Increment(); 14899 isolate->counters()->gc_last_resort_from_js()->Increment();
14910 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 14900 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
14911 "Runtime::PerformGC"); 14901 "Runtime::PerformGC");
14912 } 14902 }
14913 } 14903 }
14914 14904
14915 14905
14916 } } // namespace v8::internal 14906 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime.h ('k') | src/v8-counters.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698