| 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 1365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1376 return ExternalReference(reinterpret_cast<Address>(page) + | 1376 return ExternalReference(reinterpret_cast<Address>(page) + |
| 1377 MemoryChunk::kFlagsOffset); | 1377 MemoryChunk::kFlagsOffset); |
| 1378 } | 1378 } |
| 1379 | 1379 |
| 1380 | 1380 |
| 1381 ExternalReference ExternalReference::ForDeoptEntry(Address entry) { | 1381 ExternalReference ExternalReference::ForDeoptEntry(Address entry) { |
| 1382 return ExternalReference(entry); | 1382 return ExternalReference(entry); |
| 1383 } | 1383 } |
| 1384 | 1384 |
| 1385 | 1385 |
| 1386 double power_helper(double x, double y) { |
| 1387 int y_int = static_cast<int>(y); |
| 1388 if (y == y_int) { |
| 1389 return power_double_int(x, y_int); // Returns 1 if exponent is 0. |
| 1390 } |
| 1391 if (y == 0.5) { |
| 1392 return (isinf(x)) ? V8_INFINITY : fast_sqrt(x + 0.0); // Convert -0 to +0. |
| 1393 } |
| 1394 if (y == -0.5) { |
| 1395 return (isinf(x)) ? 0 : 1.0 / fast_sqrt(x + 0.0); // Convert -0 to +0. |
| 1396 } |
| 1397 return power_double_double(x, y); |
| 1398 } |
| 1399 |
| 1400 |
| 1386 // Helper function to compute x^y, where y is known to be an | 1401 // Helper function to compute x^y, where y is known to be an |
| 1387 // integer. Uses binary decomposition to limit the number of | 1402 // integer. Uses binary decomposition to limit the number of |
| 1388 // multiplications; see the discussion in "Hacker's Delight" by Henry | 1403 // multiplications; see the discussion in "Hacker's Delight" by Henry |
| 1389 // S. Warren, Jr., figure 11-6, page 213. | 1404 // S. Warren, Jr., figure 11-6, page 213. |
| 1390 double power_double_int(double x, int y) { | 1405 double power_double_int(double x, int y) { |
| 1391 double m = (y < 0) ? 1 / x : x; | 1406 double m = (y < 0) ? 1 / x : x; |
| 1392 unsigned n = (y < 0) ? -y : y; | 1407 unsigned n = (y < 0) ? -y : y; |
| 1393 double p = 1; | 1408 double p = 1; |
| 1394 while (n != 0) { | 1409 while (n != 0) { |
| 1395 if ((n & 1) != 0) p *= m; | 1410 if ((n & 1) != 0) p *= m; |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1567 assembler_->RecordRelocInfo(RelocInfo::POSITION, state_.current_position); | 1582 assembler_->RecordRelocInfo(RelocInfo::POSITION, state_.current_position); |
| 1568 state_.written_position = state_.current_position; | 1583 state_.written_position = state_.current_position; |
| 1569 written = true; | 1584 written = true; |
| 1570 } | 1585 } |
| 1571 | 1586 |
| 1572 // Return whether something was written. | 1587 // Return whether something was written. |
| 1573 return written; | 1588 return written; |
| 1574 } | 1589 } |
| 1575 | 1590 |
| 1576 } } // namespace v8::internal | 1591 } } // namespace v8::internal |
| OLD | NEW |