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

Side by Side Diff: src/runtime.cc

Issue 131022: Speculative fix for computing Math.pow(2, -1074) on win32 where... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 6 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 4152 matching lines...) Expand 10 before | Expand all | Expand 10 after
4163 while (true) { 4163 while (true) {
4164 if ((n & 1) != 0) p *= m; 4164 if ((n & 1) != 0) p *= m;
4165 n >>= 1; 4165 n >>= 1;
4166 if (n == 0) { 4166 if (n == 0) {
4167 if (y < 0) { 4167 if (y < 0) {
4168 // Unfortunately, we have to be careful when p has reached 4168 // Unfortunately, we have to be careful when p has reached
4169 // infinity in the computation, because sometimes the higher 4169 // infinity in the computation, because sometimes the higher
4170 // internal precision in the pow() implementation would have 4170 // internal precision in the pow() implementation would have
4171 // given us a finite p. This happens very rarely. 4171 // given us a finite p. This happens very rarely.
4172 double result = 1.0 / p; 4172 double result = 1.0 / p;
4173 return (result == 0 && isinf(p)) ? pow(x, y) : result; 4173 return (result == 0 && isinf(p))
4174 ? pow(x, static_cast<double>(y)) // Avoid pow(double, int).
4175 : result;
4174 } else { 4176 } else {
4175 return p; 4177 return p;
4176 } 4178 }
4177 } 4179 }
4178 m *= m; 4180 m *= m;
4179 } 4181 }
4180 } 4182 }
4181 4183
4182 4184
4183 static Object* Runtime_Math_pow(Arguments args) { 4185 static Object* Runtime_Math_pow(Arguments args) {
(...skipping 3315 matching lines...) Expand 10 before | Expand all | Expand 10 after
7499 } else { 7501 } else {
7500 // Handle last resort GC and make sure to allow future allocations 7502 // Handle last resort GC and make sure to allow future allocations
7501 // to grow the heap without causing GCs (if possible). 7503 // to grow the heap without causing GCs (if possible).
7502 Counters::gc_last_resort_from_js.Increment(); 7504 Counters::gc_last_resort_from_js.Increment();
7503 Heap::CollectAllGarbage(); 7505 Heap::CollectAllGarbage();
7504 } 7506 }
7505 } 7507 }
7506 7508
7507 7509
7508 } } // namespace v8::internal 7510 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698