Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cherry pick 588e15c and c0d4bb8 from upstream V8 #8038

Closed
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
deps: cherry-pick c0d4bb8 from V8 upstream
Original commit message:
    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}
epertoso authored and cristiancavalli committed Aug 10, 2016

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 83e427db4ca6c8cb958c7d68a3b1d372ba41b4f9
41 changes: 41 additions & 0 deletions deps/v8/test/cctest/test-assembler-ia32.cc
Original file line number Diff line number Diff line change
@@ -1497,4 +1497,45 @@ TEST(AssemblerIa32JumpTables2) {
}
}

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 __