Version 3.30.34 (based on 813b071b3059081f42bd85ee3078b4d677a0eb14)
Cr-Commit-Position: refs/heads/candidates@{#25156}
git-svn-id: https://v8.googlecode.com/svn/trunk@25156 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
diff --git a/src/compiler/x64/instruction-selector-x64.cc b/src/compiler/x64/instruction-selector-x64.cc
index f927501..c70944b 100644
--- a/src/compiler/x64/instruction-selector-x64.cc
+++ b/src/compiler/x64/instruction-selector-x64.cc
@@ -320,6 +320,17 @@
void InstructionSelector::VisitWord64Shl(Node* node) {
+ X64OperandGenerator g(this);
+ Int64BinopMatcher m(node);
+ if ((m.left().IsChangeInt32ToInt64() || m.left().IsChangeUint32ToUint64()) &&
+ m.right().IsInRange(32, 63)) {
+ // There's no need to sign/zero-extend to 64-bit if we shift out the upper
+ // 32 bits anyway.
+ Emit(kX64Shl, g.DefineSameAsFirst(node),
+ g.UseRegister(m.left().node()->InputAt(0)),
+ g.UseImmediate(m.right().node()));
+ return;
+ }
VisitWord64Shift(this, node, kX64Shl);
}
diff --git a/src/version.cc b/src/version.cc
index 70a1f9d..5366111 100644
--- a/src/version.cc
+++ b/src/version.cc
@@ -34,7 +34,7 @@
// system so their names cannot be changed without changing the scripts.
#define MAJOR_VERSION 3
#define MINOR_VERSION 30
-#define BUILD_NUMBER 33
+#define BUILD_NUMBER 34
#define PATCH_LEVEL 0
// Use 1 for candidates and 0 otherwise.
// (Boolean macro values are not supported by all preprocessors.)
diff --git a/src/x87/interface-descriptors-x87.cc b/src/x87/interface-descriptors-x87.cc
index 7640343..26ce4dc 100644
--- a/src/x87/interface-descriptors-x87.cc
+++ b/src/x87/interface-descriptors-x87.cc
@@ -155,6 +155,15 @@
}
+void AllocateHeapNumberDescriptor::Initialize(
+ CallInterfaceDescriptorData* data) {
+ // register state
+ // esi -- context
+ Register registers[] = {esi};
+ data->Initialize(arraysize(registers), registers, nullptr);
+}
+
+
void ArrayConstructorConstantArgCountDescriptor::Initialize(
CallInterfaceDescriptorData* data) {
// register state
diff --git a/src/x87/lithium-codegen-x87.cc b/src/x87/lithium-codegen-x87.cc
index 2766b65..f8872d7 100644
--- a/src/x87/lithium-codegen-x87.cc
+++ b/src/x87/lithium-codegen-x87.cc
@@ -2272,6 +2272,8 @@
if (instr->op() != Token::MOD) {
X87PrepareBinaryOp(left, right, result);
}
+ // Set the precision control to double-precision.
+ __ X87SetFPUCW(0x027F);
switch (instr->op()) {
case Token::ADD:
__ fadd_i(1);
@@ -2306,12 +2308,8 @@
break;
}
- // Only always explicitly storing to memory to force the round-down for double
- // arithmetic.
- __ lea(esp, Operand(esp, -kDoubleSize));
- __ fstp_d(Operand(esp, 0));
- __ fld_d(Operand(esp, 0));
- __ lea(esp, Operand(esp, kDoubleSize));
+ // Restore the default value of control word.
+ __ X87SetFPUCW(0x037F);
}
diff --git a/src/x87/macro-assembler-x87.cc b/src/x87/macro-assembler-x87.cc
index ff5db7b..3f522fc 100644
--- a/src/x87/macro-assembler-x87.cc
+++ b/src/x87/macro-assembler-x87.cc
@@ -767,6 +767,13 @@
}
+void MacroAssembler::X87SetFPUCW(int cw) {
+ push(Immediate(cw));
+ fldcw(MemOperand(esp, 0));
+ add(esp, Immediate(kPointerSize));
+}
+
+
void MacroAssembler::AssertNumber(Register object) {
if (emit_debug_code()) {
Label ok;
diff --git a/src/x87/macro-assembler-x87.h b/src/x87/macro-assembler-x87.h
index 0796456..ad308a4 100644
--- a/src/x87/macro-assembler-x87.h
+++ b/src/x87/macro-assembler-x87.h
@@ -425,6 +425,7 @@
void FXamSign();
void X87CheckIA();
void X87SetRC(int rc);
+ void X87SetFPUCW(int cw);
void ClampUint8(Register reg);
void ClampTOSToUint8(Register result_reg);
diff --git a/test/unittests/compiler/x64/instruction-selector-x64-unittest.cc b/test/unittests/compiler/x64/instruction-selector-x64-unittest.cc
index fe50ca5..48c074e 100644
--- a/test/unittests/compiler/x64/instruction-selector-x64-unittest.cc
+++ b/test/unittests/compiler/x64/instruction-selector-x64-unittest.cc
@@ -323,6 +323,48 @@
EXPECT_TRUE(s.IsFixed(s[0]->OutputAt(0), rdx));
}
+
+// -----------------------------------------------------------------------------
+// Word64Shl.
+
+
+TEST_F(InstructionSelectorTest, Word64ShlWithChangeInt32ToInt64) {
+ TRACED_FORRANGE(int64_t, x, 32, 63) {
+ StreamBuilder m(this, kMachInt64, kMachInt32);
+ Node* const p0 = m.Parameter(0);
+ Node* const n = m.Word64Shl(m.ChangeInt32ToInt64(p0), m.Int64Constant(x));
+ m.Return(n);
+ Stream s = m.Build();
+ ASSERT_EQ(1U, s.size());
+ EXPECT_EQ(kX64Shl, s[0]->arch_opcode());
+ ASSERT_EQ(2U, s[0]->InputCount());
+ EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
+ EXPECT_EQ(x, s.ToInt32(s[0]->InputAt(1)));
+ ASSERT_EQ(1U, s[0]->OutputCount());
+ EXPECT_TRUE(s.IsSameAsFirst(s[0]->Output()));
+ EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
+ }
+}
+
+
+TEST_F(InstructionSelectorTest, Word64ShlWithChangeUint32ToUint64) {
+ TRACED_FORRANGE(int64_t, x, 32, 63) {
+ StreamBuilder m(this, kMachInt64, kMachUint32);
+ Node* const p0 = m.Parameter(0);
+ Node* const n = m.Word64Shl(m.ChangeUint32ToUint64(p0), m.Int64Constant(x));
+ m.Return(n);
+ Stream s = m.Build();
+ ASSERT_EQ(1U, s.size());
+ EXPECT_EQ(kX64Shl, s[0]->arch_opcode());
+ ASSERT_EQ(2U, s[0]->InputCount());
+ EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
+ EXPECT_EQ(x, s.ToInt32(s[0]->InputAt(1)));
+ ASSERT_EQ(1U, s[0]->OutputCount());
+ EXPECT_TRUE(s.IsSameAsFirst(s[0]->Output()));
+ EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
+ }
+}
+
} // namespace compiler
} // namespace internal
} // namespace v8