OLD | NEW |
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 3678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3689 } | 3689 } |
3690 | 3690 |
3691 | 3691 |
3692 static Object* Runtime_NumberMod(Arguments args) { | 3692 static Object* Runtime_NumberMod(Arguments args) { |
3693 NoHandleAllocation ha; | 3693 NoHandleAllocation ha; |
3694 ASSERT(args.length() == 2); | 3694 ASSERT(args.length() == 2); |
3695 | 3695 |
3696 CONVERT_DOUBLE_CHECKED(x, args[0]); | 3696 CONVERT_DOUBLE_CHECKED(x, args[0]); |
3697 CONVERT_DOUBLE_CHECKED(y, args[1]); | 3697 CONVERT_DOUBLE_CHECKED(y, args[1]); |
3698 | 3698 |
3699 #ifdef WIN32 | 3699 #if defined WIN32 || defined _WIN64 |
3700 // Workaround MS fmod bugs. ECMA-262 says: | 3700 // Workaround MS fmod bugs. ECMA-262 says: |
3701 // dividend is finite and divisor is an infinity => result equals dividend | 3701 // dividend is finite and divisor is an infinity => result equals dividend |
3702 // dividend is a zero and divisor is nonzero finite => result equals dividend | 3702 // dividend is a zero and divisor is nonzero finite => result equals dividend |
3703 if (!(isfinite(x) && (!isfinite(y) && !isnan(y))) && | 3703 if (!(isfinite(x) && (!isfinite(y) && !isnan(y))) && |
3704 !(x == 0 && (y != 0 && isfinite(y)))) | 3704 !(x == 0 && (y != 0 && isfinite(y)))) |
3705 #endif | 3705 #endif |
3706 x = fmod(x, y); | 3706 x = fmod(x, y); |
3707 // NewNumberFromDouble may return a Smi instead of a Number object | 3707 // NewNumberFromDouble may return a Smi instead of a Number object |
3708 return Heap::NewNumberFromDouble(x); | 3708 return Heap::NewNumberFromDouble(x); |
3709 } | 3709 } |
(...skipping 3999 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7709 } else { | 7709 } else { |
7710 // Handle last resort GC and make sure to allow future allocations | 7710 // Handle last resort GC and make sure to allow future allocations |
7711 // to grow the heap without causing GCs (if possible). | 7711 // to grow the heap without causing GCs (if possible). |
7712 Counters::gc_last_resort_from_js.Increment(); | 7712 Counters::gc_last_resort_from_js.Increment(); |
7713 Heap::CollectAllGarbage(false); | 7713 Heap::CollectAllGarbage(false); |
7714 } | 7714 } |
7715 } | 7715 } |
7716 | 7716 |
7717 | 7717 |
7718 } } // namespace v8::internal | 7718 } } // namespace v8::internal |
OLD | NEW |