Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit fc2a89c

Browse filesBrowse files
epertosoofrobots
authored andcommitted
deps: V8: cherry-pick 588e15c, c0d4bb8
Pick up an upstream bugfix for https://crbug.com/621926 and bump V8 version to 5.1.281.80. Original commit message for 588e15c: Fixes a bug in cmpw. The opcodes for 'cmpw r/m16, r16' and 'cmpw r16, r/m16' were swapped, causing a few issues when less than/greater than comparison were performed. Adds a regression test. BUG=621926 Committed: https://crrev.com/efa7095e3e360fbadbe909d831ac11b268ca26b0 Review-Url: https://codereview.chromium.org/2103713003 Cr-Original-Commit-Position: refs/heads/master@{#37339} Cr-Commit-Position: refs/heads/master@{#37345} Original commit message for c0d4bb8: Fixes a wrong use of Operand in a test. Operand(reg) -> reg Operand(reg, 0) -> [reg] BUG= Review-Url: https://codereview.chromium.org/2111503002 Cr-Commit-Position: refs/heads/master@{#37370} PR-URL: #8038 Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: ofrobots - Ali Ijaz Sheikh <ofrobots@google.com> Reviewed-By: mhdawson - Michael Dawson <michael_dawson@ca.ibm.com>
1 parent cd77ca3 commit fc2a89c
Copy full SHA for fc2a89c

File tree

Expand file treeCollapse file tree

4 files changed

+61
-7
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

4 files changed

+61
-7
lines changed
Open diff view settings
Collapse file

‎deps/v8/include/v8-version.h‎

Copy file name to clipboardExpand all lines: deps/v8/include/v8-version.h
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#define V8_MAJOR_VERSION 5
1212
#define V8_MINOR_VERSION 1
1313
#define V8_BUILD_NUMBER 281
14-
#define V8_PATCH_LEVEL 79
14+
#define V8_PATCH_LEVEL 80
1515

1616
// Use 1 for candidates and 0 otherwise.
1717
// (Boolean macro values are not supported by all preprocessors.)
Collapse file

‎deps/v8/src/ia32/assembler-ia32.cc‎

Copy file name to clipboardExpand all lines: deps/v8/src/ia32/assembler-ia32.cc
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -787,14 +787,14 @@ void Assembler::cmpw(const Operand& op, Immediate imm16) {
787787
void Assembler::cmpw(Register reg, const Operand& op) {
788788
EnsureSpace ensure_space(this);
789789
EMIT(0x66);
790-
EMIT(0x39);
790+
EMIT(0x3B);
791791
emit_operand(reg, op);
792792
}
793793

794794
void Assembler::cmpw(const Operand& op, Register reg) {
795795
EnsureSpace ensure_space(this);
796796
EMIT(0x66);
797-
EMIT(0x3B);
797+
EMIT(0x39);
798798
emit_operand(reg, op);
799799
}
800800

Collapse file

‎deps/v8/src/ia32/disasm-ia32.cc‎

Copy file name to clipboardExpand all lines: deps/v8/src/ia32/disasm-ia32.cc
+17-4Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1602,18 +1602,31 @@ int DisassemblerIA32::InstructionDecode(v8::internal::Vector<char> out_buffer,
16021602
while (*data == 0x66) data++;
16031603
if (*data == 0xf && data[1] == 0x1f) {
16041604
AppendToBuffer("nop"); // 0x66 prefix
1605-
} else if (*data == 0x90) {
1606-
AppendToBuffer("nop"); // 0x66 prefix
1607-
} else if (*data == 0x8B) {
1605+
} else if (*data == 0x39) {
16081606
data++;
1609-
data += PrintOperands("mov_w", REG_OPER_OP_ORDER, data);
1607+
data += PrintOperands("cmpw", OPER_REG_OP_ORDER, data);
1608+
} else if (*data == 0x3B) {
1609+
data++;
1610+
data += PrintOperands("cmpw", REG_OPER_OP_ORDER, data);
1611+
} else if (*data == 0x81) {
1612+
data++;
1613+
AppendToBuffer("cmpw ");
1614+
data += PrintRightOperand(data);
1615+
int imm = *reinterpret_cast<int16_t*>(data);
1616+
AppendToBuffer(",0x%x", imm);
1617+
data += 2;
16101618
} else if (*data == 0x89) {
16111619
data++;
16121620
int mod, regop, rm;
16131621
get_modrm(*data, &mod, &regop, &rm);
16141622
AppendToBuffer("mov_w ");
16151623
data += PrintRightOperand(data);
16161624
AppendToBuffer(",%s", NameOfCPURegister(regop));
1625+
} else if (*data == 0x8B) {
1626+
data++;
1627+
data += PrintOperands("mov_w", REG_OPER_OP_ORDER, data);
1628+
} else if (*data == 0x90) {
1629+
AppendToBuffer("nop"); // 0x66 prefix
16171630
} else if (*data == 0xC7) {
16181631
data++;
16191632
AppendToBuffer("%s ", "mov_w");
Collapse file

‎deps/v8/test/cctest/test-assembler-ia32.cc‎

Copy file name to clipboardExpand all lines: deps/v8/test/cctest/test-assembler-ia32.cc
+41Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1497,4 +1497,45 @@ TEST(AssemblerIa32JumpTables2) {
14971497
}
14981498
}
14991499

1500+
TEST(Regress621926) {
1501+
// Bug description:
1502+
// The opcodes for cmpw r/m16, r16 and cmpw r16, r/m16 were swapped.
1503+
// This was causing non-commutative comparisons to produce the wrong result.
1504+
CcTest::InitializeVM();
1505+
Isolate* isolate = reinterpret_cast<Isolate*>(CcTest::isolate());
1506+
HandleScope scope(isolate);
1507+
Assembler assm(isolate, nullptr, 0);
1508+
1509+
uint16_t a = 42;
1510+
1511+
Label fail;
1512+
__ push(ebx);
1513+
__ mov(ebx, Immediate(reinterpret_cast<intptr_t>(&a)));
1514+
__ mov(eax, Immediate(41));
1515+
__ cmpw(eax, Operand(ebx, 0));
1516+
__ j(above_equal, &fail);
1517+
__ cmpw(Operand(ebx, 0), eax);
1518+
__ j(below_equal, &fail);
1519+
__ mov(eax, 1);
1520+
__ pop(ebx);
1521+
__ ret(0);
1522+
__ bind(&fail);
1523+
__ mov(eax, 0);
1524+
__ pop(ebx);
1525+
__ ret(0);
1526+
1527+
CodeDesc desc;
1528+
assm.GetCode(&desc);
1529+
Handle<Code> code = isolate->factory()->NewCode(
1530+
desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
1531+
1532+
#ifdef OBJECT_PRINT
1533+
OFStream os(stdout);
1534+
code->Print(os);
1535+
#endif
1536+
1537+
F0 f = FUNCTION_CAST<F0>(code->entry());
1538+
CHECK_EQ(f(), 1);
1539+
}
1540+
15001541
#undef __

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.