Reviewers: danno,

Message:
I tried to construct a test case to catch it, but from what I have observed from my test case is that V8 does not do this kind of rematerialization, instead it will spill the constant into stack and reload the double register from the stack
slot.

This might save you an hour to debug it when this branch is really executed for
some big JS application.

Description:
Fix LGapResolver::EmitMove for X64 when the dst is a double register and src is
a constant

Please review this at https://codereview.chromium.org/18301015/

SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/

Affected files:
  M     src/x64/lithium-gap-resolver-x64.cc


Index: src/x64/lithium-gap-resolver-x64.cc
===================================================================
--- src/x64/lithium-gap-resolver-x64.cc (revision 15613)
+++ src/x64/lithium-gap-resolver-x64.cc (working copy)
@@ -205,16 +205,12 @@
     } else if (destination->IsDoubleRegister()) {
       double v = cgen_->ToDouble(constant_source);
       uint64_t int_val = BitCast<uint64_t, double>(v);
-      int32_t lower = static_cast<int32_t>(int_val);
-      int32_t upper = static_cast<int32_t>(int_val >> (kBitsPerInt));
       XMMRegister dst = cgen_->ToDoubleRegister(destination);
       if (int_val == 0) {
         __ xorps(dst, dst);
       } else {
-        __ push(Immediate(upper));
-        __ push(Immediate(lower));
-        __ movsd(dst, Operand(rsp, 0));
-        __ addq(rsp, Immediate(kDoubleSize));
+        __ movq(kScratchRegister, int_val, RelocInfo::NONE64);
+        __ movq(dst, kScratchRegister);
       }
     } else {
       ASSERT(destination->IsStackSlot());


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to