Properly export uin32_bias double constant.
authorolivf@chromium.org <olivf@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 15 Oct 2013 16:12:25 +0000 (16:12 +0000)
committerolivf@chromium.org <olivf@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 15 Oct 2013 16:12:25 +0000 (16:12 +0000)
This makes LoadUint32 snapshot safe.

BUG=
R=svenpanne@chromium.org

Review URL: https://codereview.chromium.org/27156004

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@17223 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/assembler.cc
src/assembler.h
src/code-stubs.cc
src/ia32/macro-assembler-ia32.cc
src/serialize.cc

index 54ee69a..0a049a4 100644 (file)
@@ -98,6 +98,7 @@ struct DoubleConstant BASE_EMBEDDED {
   double negative_infinity;
   double canonical_non_hole_nan;
   double the_hole_nan;
+  double uint32_bias;
 };
 
 static DoubleConstant double_constants;
@@ -908,6 +909,8 @@ void ExternalReference::SetUp() {
   double_constants.canonical_non_hole_nan = OS::nan_value();
   double_constants.the_hole_nan = BitCast<double>(kHoleNanInt64);
   double_constants.negative_infinity = -V8_INFINITY;
+  double_constants.uint32_bias =
+    static_cast<double>(static_cast<uint32_t>(0xFFFFFFFF)) + 1;
 
   math_exp_data_mutex = new Mutex();
 }
@@ -1341,6 +1344,12 @@ ExternalReference ExternalReference::record_object_allocation_function(
 }
 
 
+ExternalReference ExternalReference::address_of_uint32_bias() {
+  return ExternalReference(
+      reinterpret_cast<void*>(&double_constants.uint32_bias));
+}
+
+
 #ifndef V8_INTERPRETED_REGEXP
 
 ExternalReference ExternalReference::re_check_stack_guard_state(
index 9888ac2..e34b13a 100644 (file)
@@ -813,6 +813,7 @@ class ExternalReference BASE_EMBEDDED {
   static ExternalReference address_of_negative_infinity();
   static ExternalReference address_of_canonical_non_hole_nan();
   static ExternalReference address_of_the_hole_nan();
+  static ExternalReference address_of_uint32_bias();
 
   static ExternalReference math_sin_double_function(Isolate* isolate);
   static ExternalReference math_cos_double_function(Isolate* isolate);
index 2a60d15..0681137 100644 (file)
@@ -473,6 +473,7 @@ void BinaryOpStub::GenerateAheadOfTime(Isolate* isolate) {
   Generate(Token::SHR, INT32, SMI, SMI, OVERWRITE_RIGHT, isolate);
   Generate(Token::SHR, NUMBER, SMI, SMI, NO_OVERWRITE, isolate);
   Generate(Token::SHR, NUMBER, SMI, SMI, OVERWRITE_LEFT, isolate);
+  Generate(Token::SHR, NUMBER, SMI, INT32, OVERWRITE_RIGHT, isolate);
   Generate(Token::SHR, SMI, SMI, SMI, NO_OVERWRITE, isolate);
   Generate(Token::SHR, SMI, SMI, SMI, OVERWRITE_LEFT, isolate);
   Generate(Token::SHR, SMI, SMI, SMI, OVERWRITE_RIGHT, isolate);
index 9136ace..9dfc0e2 100644 (file)
@@ -445,19 +445,14 @@ void MacroAssembler::TaggedToI(Register result_reg,
 }
 
 
-
-static double kUint32Bias =
-    static_cast<double>(static_cast<uint32_t>(0xFFFFFFFF)) + 1;
-
-
 void MacroAssembler::LoadUint32(XMMRegister dst,
                                 Register src,
                                 XMMRegister scratch) {
-  ASSERT(!Serializer::enabled());
   Label done;
   cmp(src, Immediate(0));
-  movdbl(scratch,
-         Operand(reinterpret_cast<int32_t>(&kUint32Bias), RelocInfo::NONE32));
+  ExternalReference uint32_bias =
+        ExternalReference::address_of_uint32_bias();
+  movdbl(scratch, Operand::StaticVariable(uint32_bias));
   Cvtsi2sd(dst, src);
   j(not_sign, &done, Label::kNear);
   addsd(dst, scratch);
@@ -466,13 +461,14 @@ void MacroAssembler::LoadUint32(XMMRegister dst,
 
 
 void MacroAssembler::LoadUint32NoSSE2(Register src) {
-  ASSERT(!Serializer::enabled());
   Label done;
   push(src);
   fild_s(Operand(esp, 0));
   cmp(src, Immediate(0));
   j(not_sign, &done, Label::kNear);
-  fld_d(Operand(reinterpret_cast<int32_t>(&kUint32Bias), RelocInfo::NONE32));
+  ExternalReference uint32_bias =
+        ExternalReference::address_of_uint32_bias();
+  fld_d(Operand::StaticVariable(uint32_bias));
   faddp(1);
   bind(&done);
   add(esp, Immediate(kPointerSize));
index e7dbbe5..7e7c42c 100644 (file)
@@ -585,6 +585,10 @@ void ExternalReferenceTable::PopulateTable(Isolate* isolate) {
       UNCLASSIFIED,
       64,
       "HeapProfiler::RecordObjectAllocationFromMasm");
+  Add(ExternalReference::address_of_uint32_bias().address(),
+      UNCLASSIFIED,
+      65,
+      "uint32_bias");
 
   // Add a small set of deopt entry addresses to encoder without generating the
   // deopt table code, which isn't possible at deserialization time.