Index: src/x64/code-stubs-x64.cc |
diff --git a/src/x64/code-stubs-x64.cc b/src/x64/code-stubs-x64.cc |
index 01bddaf970fc5ea384a5b444d60f05188eac06ae..5ea5f724978ee082dd5a622e63e39ae78f7a7807 100644 |
--- a/src/x64/code-stubs-x64.cc |
+++ b/src/x64/code-stubs-x64.cc |
@@ -3122,6 +3122,26 @@ void SubStringStub::Generate(MacroAssembler* masm) { |
} |
+void ToNumberStub::Generate(MacroAssembler* masm) { |
+ // The ToNumber stub takes one argument in rax. |
+ Label check_heap_number, call_builtin; |
+ __ JumpIfNotSmi(rax, &check_heap_number, Label::kNear); |
+ __ Ret(); |
+ |
+ __ bind(&check_heap_number); |
+ __ CompareRoot(FieldOperand(rax, HeapObject::kMapOffset), |
+ Heap::kHeapNumberMapRootIndex); |
+ __ j(not_equal, &call_builtin, Label::kNear); |
+ __ Ret(); |
+ |
+ __ bind(&call_builtin); |
+ __ popq(rcx); // Pop return address. |
+ __ pushq(rax); |
+ __ pushq(rcx); // Push return address. |
+ __ InvokeBuiltin(Builtins::TO_NUMBER, JUMP_FUNCTION); |
+} |
+ |
+ |
void StringHelper::GenerateFlatOneByteStringEquals(MacroAssembler* masm, |
Register left, |
Register right, |