Index: src/arm64/lithium-codegen-arm64.cc |
diff --git a/src/arm64/lithium-codegen-arm64.cc b/src/arm64/lithium-codegen-arm64.cc |
index 78348337270c4adc7be419f3320de71ac13d7e5b..c2a2ff364cc5bc80b1e29c0645a1383bbd68b067 100644 |
--- a/src/arm64/lithium-codegen-arm64.cc |
+++ b/src/arm64/lithium-codegen-arm64.cc |
@@ -5795,9 +5795,17 @@ void LCodeGen::DoTruncateDoubleToIntOrSmi(LTruncateDoubleToIntOrSmi* instr) { |
void LCodeGen::DoTypeof(LTypeof* instr) { |
- Register input = ToRegister(instr->value()); |
- __ Push(input); |
- CallRuntime(Runtime::kTypeof, 1, instr); |
+ DCHECK(ToRegister(instr->value()).is(x3)); |
+ DCHECK(ToRegister(instr->result()).is(x0)); |
+ Label end, do_call; |
+ Register value_register = ToRegister(instr->value()); |
+ __ JumpIfNotSmi(value_register, &do_call); |
+ __ Mov(x0, Immediate(isolate()->factory()->number_string())); |
+ __ B(&end); |
+ __ Bind(&do_call); |
+ TypeofStub stub(isolate()); |
+ CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
+ __ Bind(&end); |
} |