Index: src/assembler.cc |
diff --git a/src/assembler.cc b/src/assembler.cc |
index 0bec57752f31ef410d8eb4b6c53d37b382c1e7d6..f1a2c2115135d54e369179e5ea9cedeb955de46b 100644 |
--- a/src/assembler.cc |
+++ b/src/assembler.cc |
@@ -45,6 +45,7 @@ |
#include "ic.h" |
#include "isolate.h" |
#include "jsregexp.h" |
+#include "lazy-instance.h" |
#include "platform.h" |
#include "regexp-macro-assembler.h" |
#include "regexp-stack.h" |
@@ -84,15 +85,36 @@ |
namespace v8 { |
namespace internal { |
+// ----------------------------------------------------------------------------- |
+// Common double constants. |
+ |
+struct DoubleConstant BASE_EMBEDDED { |
+ double min_int; |
+ double one_half; |
+ double minus_zero; |
+ double zero; |
+ double uint8_max_value; |
+ double negative_infinity; |
+ double canonical_non_hole_nan; |
+ double the_hole_nan; |
+}; |
+ |
+struct InitializeDoubleConstants { |
+ static void Construct(DoubleConstant* double_constants) { |
+ double_constants->min_int = kMinInt; |
+ double_constants->one_half = 0.5; |
+ double_constants->minus_zero = -0.0; |
+ double_constants->uint8_max_value = 255; |
+ double_constants->zero = 0.0; |
+ double_constants->canonical_non_hole_nan = OS::nan_value(); |
+ double_constants->the_hole_nan = BitCast<double>(kHoleNanInt64); |
+ double_constants->negative_infinity = -V8_INFINITY; |
+ } |
+}; |
+ |
+static LazyInstance<DoubleConstant, InitializeDoubleConstants>::type |
+ double_constants = LAZY_INSTANCE_INITIALIZER; |
-const double DoubleConstant::min_int = kMinInt; |
-const double DoubleConstant::one_half = 0.5; |
-const double DoubleConstant::minus_zero = -0.0; |
-const double DoubleConstant::uint8_max_value = 255; |
-const double DoubleConstant::zero = 0.0; |
-const double DoubleConstant::canonical_non_hole_nan = OS::nan_value(); |
-const double DoubleConstant::the_hole_nan = BitCast<double>(kHoleNanInt64); |
-const double DoubleConstant::negative_infinity = -V8_INFINITY; |
const char* const RelocInfo::kFillerCommentString = "DEOPTIMIZATION PADDING"; |
// ----------------------------------------------------------------------------- |
@@ -926,49 +948,49 @@ ExternalReference ExternalReference::scheduled_exception_address( |
ExternalReference ExternalReference::address_of_min_int() { |
return ExternalReference(reinterpret_cast<void*>( |
- const_cast<double*>(&DoubleConstant::min_int))); |
+ &double_constants.Pointer()->min_int)); |
} |
ExternalReference ExternalReference::address_of_one_half() { |
return ExternalReference(reinterpret_cast<void*>( |
- const_cast<double*>(&DoubleConstant::one_half))); |
+ &double_constants.Pointer()->one_half)); |
} |
ExternalReference ExternalReference::address_of_minus_zero() { |
return ExternalReference(reinterpret_cast<void*>( |
- const_cast<double*>(&DoubleConstant::minus_zero))); |
+ &double_constants.Pointer()->minus_zero)); |
} |
ExternalReference ExternalReference::address_of_zero() { |
return ExternalReference(reinterpret_cast<void*>( |
- const_cast<double*>(&DoubleConstant::zero))); |
+ &double_constants.Pointer()->zero)); |
} |
ExternalReference ExternalReference::address_of_uint8_max_value() { |
return ExternalReference(reinterpret_cast<void*>( |
- const_cast<double*>(&DoubleConstant::uint8_max_value))); |
+ &double_constants.Pointer()->uint8_max_value)); |
} |
ExternalReference ExternalReference::address_of_negative_infinity() { |
return ExternalReference(reinterpret_cast<void*>( |
- const_cast<double*>(&DoubleConstant::negative_infinity))); |
+ &double_constants.Pointer()->negative_infinity)); |
} |
ExternalReference ExternalReference::address_of_canonical_non_hole_nan() { |
return ExternalReference(reinterpret_cast<void*>( |
- const_cast<double*>(&DoubleConstant::canonical_non_hole_nan))); |
+ &double_constants.Pointer()->canonical_non_hole_nan)); |
} |
ExternalReference ExternalReference::address_of_the_hole_nan() { |
return ExternalReference(reinterpret_cast<void*>( |
- const_cast<double*>(&DoubleConstant::the_hole_nan))); |
+ &double_constants.Pointer()->the_hole_nan)); |
} |