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

Side by Side Diff: src/runtime.cc

Issue 169513002: Harmony: implement Math.fround. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: updated comments Created 6 years, 10 months 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-fround.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 7811 matching lines...) Expand 10 before | Expand all | Expand 10 after
7822 RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_sqrt) { 7822 RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_sqrt) {
7823 SealHandleScope shs(isolate); 7823 SealHandleScope shs(isolate);
7824 ASSERT(args.length() == 1); 7824 ASSERT(args.length() == 1);
7825 isolate->counters()->math_sqrt()->Increment(); 7825 isolate->counters()->math_sqrt()->Increment();
7826 7826
7827 CONVERT_DOUBLE_ARG_CHECKED(x, 0); 7827 CONVERT_DOUBLE_ARG_CHECKED(x, 0);
7828 return isolate->heap()->AllocateHeapNumber(fast_sqrt(x)); 7828 return isolate->heap()->AllocateHeapNumber(fast_sqrt(x));
7829 } 7829 }
7830 7830
7831 7831
7832 RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_fround) {
7833 SealHandleScope shs(isolate);
7834 ASSERT(args.length() == 1);
7835
7836 CONVERT_DOUBLE_ARG_CHECKED(x, 0);
7837 float xf = static_cast<float>(x);
7838 return isolate->heap()->AllocateHeapNumber(xf);
7839 }
7840
7841
7832 RUNTIME_FUNCTION(MaybeObject*, Runtime_DateMakeDay) { 7842 RUNTIME_FUNCTION(MaybeObject*, Runtime_DateMakeDay) {
7833 SealHandleScope shs(isolate); 7843 SealHandleScope shs(isolate);
7834 ASSERT(args.length() == 2); 7844 ASSERT(args.length() == 2);
7835 7845
7836 CONVERT_SMI_ARG_CHECKED(year, 0); 7846 CONVERT_SMI_ARG_CHECKED(year, 0);
7837 CONVERT_SMI_ARG_CHECKED(month, 1); 7847 CONVERT_SMI_ARG_CHECKED(month, 1);
7838 7848
7839 return Smi::FromInt(isolate->date_cache()->DaysFromYearMonth(year, month)); 7849 return Smi::FromInt(isolate->date_cache()->DaysFromYearMonth(year, month));
7840 } 7850 }
7841 7851
(...skipping 7037 matching lines...) Expand 10 before | Expand all | Expand 10 after
14879 // Handle last resort GC and make sure to allow future allocations 14889 // Handle last resort GC and make sure to allow future allocations
14880 // to grow the heap without causing GCs (if possible). 14890 // to grow the heap without causing GCs (if possible).
14881 isolate->counters()->gc_last_resort_from_js()->Increment(); 14891 isolate->counters()->gc_last_resort_from_js()->Increment();
14882 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 14892 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
14883 "Runtime::PerformGC"); 14893 "Runtime::PerformGC");
14884 } 14894 }
14885 } 14895 }
14886 14896
14887 14897
14888 } } // namespace v8::internal 14898 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime.h ('k') | test/mjsunit/harmony/math-fround.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698