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

Side by Side Diff: src/runtime.cc

Issue 303034: X64/Win64: Alternative implementation of fmod in general. (Closed)
Patch Set: Created 11 years, 2 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
OLDNEW
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 3724 matching lines...) Expand 10 before | Expand all | Expand 10 after
3735 } 3735 }
3736 3736
3737 3737
3738 static Object* Runtime_NumberMod(Arguments args) { 3738 static Object* Runtime_NumberMod(Arguments args) {
3739 NoHandleAllocation ha; 3739 NoHandleAllocation ha;
3740 ASSERT(args.length() == 2); 3740 ASSERT(args.length() == 2);
3741 3741
3742 CONVERT_DOUBLE_CHECKED(x, args[0]); 3742 CONVERT_DOUBLE_CHECKED(x, args[0]);
3743 CONVERT_DOUBLE_CHECKED(y, args[1]); 3743 CONVERT_DOUBLE_CHECKED(y, args[1]);
3744 3744
3745 #if defined WIN32 || defined _WIN64 3745 x = modulo(x, y);
3746 // Workaround MS fmod bugs. ECMA-262 says:
3747 // dividend is finite and divisor is an infinity => result equals dividend
3748 // dividend is a zero and divisor is nonzero finite => result equals dividend
3749 if (!(isfinite(x) && (!isfinite(y) && !isnan(y))) &&
3750 !(x == 0 && (y != 0 && isfinite(y))))
3751 #endif
3752 x = fmod(x, y);
3753 // NewNumberFromDouble may return a Smi instead of a Number object 3746 // NewNumberFromDouble may return a Smi instead of a Number object
3754 return Heap::NewNumberFromDouble(x); 3747 return Heap::NewNumberFromDouble(x);
3755 } 3748 }
3756 3749
3757 3750
3758 static Object* Runtime_StringAdd(Arguments args) { 3751 static Object* Runtime_StringAdd(Arguments args) {
3759 NoHandleAllocation ha; 3752 NoHandleAllocation ha;
3760 ASSERT(args.length() == 2); 3753 ASSERT(args.length() == 2);
3761 CONVERT_CHECKED(String, str1, args[0]); 3754 CONVERT_CHECKED(String, str1, args[0]);
3762 CONVERT_CHECKED(String, str2, args[1]); 3755 CONVERT_CHECKED(String, str2, args[1]);
(...skipping 3988 matching lines...) Expand 10 before | Expand all | Expand 10 after
7751 } else { 7744 } else {
7752 // Handle last resort GC and make sure to allow future allocations 7745 // Handle last resort GC and make sure to allow future allocations
7753 // to grow the heap without causing GCs (if possible). 7746 // to grow the heap without causing GCs (if possible).
7754 Counters::gc_last_resort_from_js.Increment(); 7747 Counters::gc_last_resort_from_js.Increment();
7755 Heap::CollectAllGarbage(false); 7748 Heap::CollectAllGarbage(false);
7756 } 7749 }
7757 } 7750 }
7758 7751
7759 7752
7760 } } // namespace v8::internal 7753 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/platform-win32.cc ('k') | src/x64/assembler-x64.h » ('j') | src/x64/codegen-x64.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698