Emit slightly more compact code in untag double.

Review URL: http://codereview.chromium.org/6677111

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7243 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
vitalyr@chromium.org 2011-03-17 15:46:42 +00:00
parent d6caa8872a
commit 02a4ce8cb0
3 changed files with 11 additions and 4 deletions

View File

@ -67,6 +67,7 @@ namespace internal {
const double DoubleConstant::min_int = kMinInt;
const double DoubleConstant::one_half = 0.5;
const double DoubleConstant::minus_zero = -0.0;
const double DoubleConstant::nan = OS::nan_value();
const double DoubleConstant::negative_infinity = -V8_INFINITY;
const char* RelocInfo::kFillerCommentString = "DEOPTIMIZATION PADDING";
@ -745,6 +746,12 @@ ExternalReference ExternalReference::address_of_negative_infinity() {
}
ExternalReference ExternalReference::address_of_nan() {
return ExternalReference(reinterpret_cast<void*>(
const_cast<double*>(&DoubleConstant::nan)));
}
#ifndef V8_INTERPRETED_REGEXP
ExternalReference ExternalReference::re_check_stack_guard_state() {

View File

@ -53,6 +53,7 @@ class DoubleConstant: public AllStatic {
static const double one_half;
static const double minus_zero;
static const double negative_infinity;
static const double nan;
};
@ -590,6 +591,7 @@ class ExternalReference BASE_EMBEDDED {
static ExternalReference address_of_one_half();
static ExternalReference address_of_minus_zero();
static ExternalReference address_of_negative_infinity();
static ExternalReference address_of_nan();
static ExternalReference math_sin_double_function();
static ExternalReference math_cos_double_function();

View File

@ -3276,10 +3276,8 @@ void LCodeGen::EmitNumberUntagD(Register input_reg,
DeoptimizeIf(not_equal, env);
// Convert undefined to NaN.
__ push(input_reg);
__ mov(input_reg, Factory::nan_value());
__ movdbl(result_reg, FieldOperand(input_reg, HeapNumber::kValueOffset));
__ pop(input_reg);
ExternalReference nan = ExternalReference::address_of_nan();
__ movdbl(result_reg, Operand::StaticVariable(nan));
__ jmp(&done);
// Heap number to XMM conversion.