OLD | NEW |
1 // Copyright (c) 1994-2006 Sun Microsystems Inc. | 1 // Copyright (c) 1994-2006 Sun Microsystems Inc. |
2 // All Rights Reserved. | 2 // All Rights Reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
6 // met: | 6 // met: |
7 // | 7 // |
8 // - Redistributions of source code must retain the above copyright notice, | 8 // - Redistributions of source code must retain the above copyright notice, |
9 // this list of conditions and the following disclaimer. | 9 // this list of conditions and the following disclaimer. |
10 // | 10 // |
(...skipping 1380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1391 return ExternalReference(reinterpret_cast<Address>(page) + | 1391 return ExternalReference(reinterpret_cast<Address>(page) + |
1392 MemoryChunk::kFlagsOffset); | 1392 MemoryChunk::kFlagsOffset); |
1393 } | 1393 } |
1394 | 1394 |
1395 | 1395 |
1396 ExternalReference ExternalReference::ForDeoptEntry(Address entry) { | 1396 ExternalReference ExternalReference::ForDeoptEntry(Address entry) { |
1397 return ExternalReference(entry); | 1397 return ExternalReference(entry); |
1398 } | 1398 } |
1399 | 1399 |
1400 | 1400 |
| 1401 double power_helper(double x, double y) { |
| 1402 int y_int = static_cast<int>(y); |
| 1403 if (y == y_int) { |
| 1404 return power_double_int(x, y_int); // Returns 1 if exponent is 0. |
| 1405 } |
| 1406 if (y == 0.5) { |
| 1407 return (isinf(x)) ? V8_INFINITY : fast_sqrt(x + 0.0); // Convert -0 to +0. |
| 1408 } |
| 1409 if (y == -0.5) { |
| 1410 return (isinf(x)) ? 0 : 1.0 / fast_sqrt(x + 0.0); // Convert -0 to +0. |
| 1411 } |
| 1412 return power_double_double(x, y); |
| 1413 } |
| 1414 |
| 1415 |
1401 // Helper function to compute x^y, where y is known to be an | 1416 // Helper function to compute x^y, where y is known to be an |
1402 // integer. Uses binary decomposition to limit the number of | 1417 // integer. Uses binary decomposition to limit the number of |
1403 // multiplications; see the discussion in "Hacker's Delight" by Henry | 1418 // multiplications; see the discussion in "Hacker's Delight" by Henry |
1404 // S. Warren, Jr., figure 11-6, page 213. | 1419 // S. Warren, Jr., figure 11-6, page 213. |
1405 double power_double_int(double x, int y) { | 1420 double power_double_int(double x, int y) { |
1406 double m = (y < 0) ? 1 / x : x; | 1421 double m = (y < 0) ? 1 / x : x; |
1407 unsigned n = (y < 0) ? -y : y; | 1422 unsigned n = (y < 0) ? -y : y; |
1408 double p = 1; | 1423 double p = 1; |
1409 while (n != 0) { | 1424 while (n != 0) { |
1410 if ((n & 1) != 0) p *= m; | 1425 if ((n & 1) != 0) p *= m; |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1582 assembler_->RecordRelocInfo(RelocInfo::POSITION, state_.current_position); | 1597 assembler_->RecordRelocInfo(RelocInfo::POSITION, state_.current_position); |
1583 state_.written_position = state_.current_position; | 1598 state_.written_position = state_.current_position; |
1584 written = true; | 1599 written = true; |
1585 } | 1600 } |
1586 | 1601 |
1587 // Return whether something was written. | 1602 // Return whether something was written. |
1588 return written; | 1603 return written; |
1589 } | 1604 } |
1590 | 1605 |
1591 } } // namespace v8::internal | 1606 } } // namespace v8::internal |
OLD | NEW |