Your idea is going in the right direction, but I think it's possible to make
this cleaner:

0) Add KeyForKeyedOpNeedsSignExtension(HInstruction*) to lithium-x64.h/.cc The implementation should be what your UsedInDehoisted function has now EXCEPT you should additionally check that the use is as the key (no extension is needed for
the value of stores) AND that inst->range()->CanBeNegative() is true

1) Add a virtual method to LInstruction in lithium-x64.h called
"MustSignExtendResult". Default implementation should return return false.
LTemplateResultInstruction should have an implementation that is in
lithium-x64.cc should call KeyForKeyedOpNeedsSignExtension

2) Override LCodeGen::GenerateBodyInstructionPost for x64. It should call
(instr->MustSignExtendResult()), and if the answer is true, always sign extend
the result register.

3) Never sign extend in the key in the KeyedLoad/Store instructions themselves, since you've guaranteed that all inputs to keys are pre-sign extended, no matter
how they were produced.

https://codereview.chromium.org/179773002/

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to