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

Side by Side Diff: src/assembler.cc

Issue 1473683004: Lazily initialize fast_sqrt() and pass an Isolate parameter to it (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 5 years 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
« no previous file with comments | « src/assembler.h ('k') | src/codegen.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1451 matching lines...) Expand 10 before | Expand all | Expand 10 after
1462 } 1462 }
1463 1463
1464 1464
1465 ExternalReference ExternalReference::runtime_function_table_address( 1465 ExternalReference ExternalReference::runtime_function_table_address(
1466 Isolate* isolate) { 1466 Isolate* isolate) {
1467 return ExternalReference( 1467 return ExternalReference(
1468 const_cast<Runtime::Function*>(Runtime::RuntimeFunctionTable(isolate))); 1468 const_cast<Runtime::Function*>(Runtime::RuntimeFunctionTable(isolate)));
1469 } 1469 }
1470 1470
1471 1471
1472 double power_helper(double x, double y) { 1472 double power_helper(Isolate* isolate, double x, double y) {
1473 int y_int = static_cast<int>(y); 1473 int y_int = static_cast<int>(y);
1474 if (y == y_int) { 1474 if (y == y_int) {
1475 return power_double_int(x, y_int); // Returns 1 if exponent is 0. 1475 return power_double_int(x, y_int); // Returns 1 if exponent is 0.
1476 } 1476 }
1477 if (y == 0.5) { 1477 if (y == 0.5) {
1478 lazily_initialize_fast_sqrt(isolate);
1478 return (std::isinf(x)) ? V8_INFINITY 1479 return (std::isinf(x)) ? V8_INFINITY
1479 : fast_sqrt(x + 0.0); // Convert -0 to +0. 1480 : fast_sqrt(x + 0.0, isolate); // Convert -0 to +0.
1480 } 1481 }
1481 if (y == -0.5) { 1482 if (y == -0.5) {
1482 return (std::isinf(x)) ? 0 : 1.0 / fast_sqrt(x + 0.0); // Convert -0 to +0. 1483 lazily_initialize_fast_sqrt(isolate);
1484 return (std::isinf(x)) ? 0 : 1.0 / fast_sqrt(x + 0.0,
1485 isolate); // Convert -0 to +0.
1483 } 1486 }
1484 return power_double_double(x, y); 1487 return power_double_double(x, y);
1485 } 1488 }
1486 1489
1487 1490
1488 // Helper function to compute x^y, where y is known to be an 1491 // Helper function to compute x^y, where y is known to be an
1489 // integer. Uses binary decomposition to limit the number of 1492 // integer. Uses binary decomposition to limit the number of
1490 // multiplications; see the discussion in "Hacker's Delight" by Henry 1493 // multiplications; see the discussion in "Hacker's Delight" by Henry
1491 // S. Warren, Jr., figure 11-6, page 213. 1494 // S. Warren, Jr., figure 11-6, page 213.
1492 double power_double_int(double x, int y) { 1495 double power_double_int(double x, int y) {
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
1902 1905
1903 1906
1904 void Assembler::DataAlign(int m) { 1907 void Assembler::DataAlign(int m) {
1905 DCHECK(m >= 2 && base::bits::IsPowerOfTwo32(m)); 1908 DCHECK(m >= 2 && base::bits::IsPowerOfTwo32(m));
1906 while ((pc_offset() & (m - 1)) != 0) { 1909 while ((pc_offset() & (m - 1)) != 0) {
1907 db(0); 1910 db(0);
1908 } 1911 }
1909 } 1912 }
1910 } // namespace internal 1913 } // namespace internal
1911 } // namespace v8 1914 } // namespace v8
OLDNEW
« no previous file with comments | « src/assembler.h ('k') | src/codegen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698