Merge V8 5.2.361.47 DO NOT MERGE
https://chromium.googlesource.com/v8/v8/+/5.2.361.47
FPIIM-449
Change-Id: Ibec421b85a9b88cb3a432ada642e469fe7e78346
(cherry picked from commit bcf72ee8e3b26f1d0726869c7ddb3921c68b09a8)
diff --git a/test/cctest/test-assembler-ia32.cc b/test/cctest/test-assembler-ia32.cc
index 12733c2..e4cac56 100644
--- a/test/cctest/test-assembler-ia32.cc
+++ b/test/cctest/test-assembler-ia32.cc
@@ -1497,4 +1497,45 @@
}
}
+TEST(Regress621926) {
+ // Bug description:
+ // The opcodes for cmpw r/m16, r16 and cmpw r16, r/m16 were swapped.
+ // This was causing non-commutative comparisons to produce the wrong result.
+ CcTest::InitializeVM();
+ Isolate* isolate = reinterpret_cast<Isolate*>(CcTest::isolate());
+ HandleScope scope(isolate);
+ Assembler assm(isolate, nullptr, 0);
+
+ uint16_t a = 42;
+
+ Label fail;
+ __ push(ebx);
+ __ mov(ebx, Immediate(reinterpret_cast<intptr_t>(&a)));
+ __ mov(eax, Immediate(41));
+ __ cmpw(eax, Operand(ebx, 0));
+ __ j(above_equal, &fail);
+ __ cmpw(Operand(ebx, 0), eax);
+ __ j(below_equal, &fail);
+ __ mov(eax, 1);
+ __ pop(ebx);
+ __ ret(0);
+ __ bind(&fail);
+ __ mov(eax, 0);
+ __ pop(ebx);
+ __ ret(0);
+
+ CodeDesc desc;
+ assm.GetCode(&desc);
+ Handle<Code> code = isolate->factory()->NewCode(
+ desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
+
+#ifdef OBJECT_PRINT
+ OFStream os(stdout);
+ code->Print(os);
+#endif
+
+ F0 f = FUNCTION_CAST<F0>(code->entry());
+ CHECK_EQ(f(), 1);
+}
+
#undef __