Index: src/x64/lithium-codegen-x64.cc |
diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc |
index a94dcee2271d2efd696ea09cb3162b18cb87a44d..2ca75841ff58e844fcd16c90ef9d26f7ae4da202 100644 |
--- a/src/x64/lithium-codegen-x64.cc |
+++ b/src/x64/lithium-codegen-x64.cc |
@@ -3729,6 +3729,20 @@ void LCodeGen::DoMathLog(LMathLog* instr) { |
} |
+void LCodeGen::DoMathClz32(LMathClz32* instr) { |
+ Register input = ToRegister(instr->value()); |
+ Register result = ToRegister(instr->result()); |
+ Label not_zero_input; |
+ __ bsrl(result, input); |
+ |
+ __ j(not_zero, ¬_zero_input); |
+ __ Set(result, 63); // 63^31 == 32 |
+ |
+ __ bind(¬_zero_input); |
+ __ xorl(result, Immediate(31)); // for x in [0..31], 31^x == 31-x. |
+} |
+ |
+ |
void LCodeGen::DoInvokeFunction(LInvokeFunction* instr) { |
ASSERT(ToRegister(instr->context()).is(rsi)); |
ASSERT(ToRegister(instr->function()).is(rdi)); |