MSan workaround in Simulator::VisitBitfield.

This change shuffles the code in Simulator::VisitBitfield a bit
to work around a MemorySanitizer bug. New code should not be any
slower or less readable than before.

More info:
https://code.google.com/p/memory-sanitizer/issues/detail?id=50

R=jkummerow@chromium.org

Review URL: https://codereview.chromium.org/212863002

Patch from Evgeniy Stepanov <eugenis@chromium.org>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20401 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 725ce114
......@@ -2108,8 +2108,9 @@ void Simulator::VisitBitfield(Instruction* instr) {
// Rotate source bitfield into place.
int64_t result = (static_cast<uint64_t>(src) >> R) | (src << (reg_size - R));
// Determine the sign extension.
int64_t topbits = ((1L << (reg_size - diff - 1)) - 1) << (diff + 1);
int64_t signbits = extend && ((src >> S) & 1) ? topbits : 0;
int64_t topbits_preshift = (1L << (reg_size - diff - 1)) - 1;
int64_t signbits = (extend && ((src >> S) & 1) ? topbits_preshift : 0)
<< (diff + 1);
// Merge sign extension, dest/zero and bitfield.
result = signbits | (result & mask) | (dst & ~mask);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment