Properly export uin32_bias double constant.

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
This commit is contained in:
olivf@chromium.org 2013-10-15 16:12:25 +00:00
parent f4edc076d8
commit 5b9f8f32e7
5 changed files with 21 additions and 10 deletions

View 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(

View 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);

View 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);

View 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));

View 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.