Index: src/x64/lithium-codegen-x64.cc |
diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc |
index 7c1668f1fa11a0334beb6891e91582a365ab7615..c1a85303b62229d64a7be2eb1c440024be72fc20 100644 |
--- a/src/x64/lithium-codegen-x64.cc |
+++ b/src/x64/lithium-codegen-x64.cc |
@@ -5537,9 +5537,16 @@ void LCodeGen::DoFunctionLiteral(LFunctionLiteral* instr) { |
void LCodeGen::DoTypeof(LTypeof* instr) { |
DCHECK(ToRegister(instr->context()).is(rsi)); |
- LOperand* input = instr->value(); |
- EmitPushTaggedOperand(input); |
- CallRuntime(Runtime::kTypeof, 1, instr); |
+ DCHECK(ToRegister(instr->value()).is(rbx)); |
+ Label end, do_call; |
+ Register value_register = ToRegister(instr->value()); |
+ __ JumpIfNotSmi(value_register, &do_call); |
+ __ Move(rax, isolate()->factory()->number_string()); |
+ __ jmp(&end); |
+ __ bind(&do_call); |
+ TypeofStub stub(isolate()); |
+ CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
+ __ bind(&end); |
} |