Index: src/arm/code-stubs-arm.cc |
diff --git a/src/arm/code-stubs-arm.cc b/src/arm/code-stubs-arm.cc |
index a5a34a4b9771b643d2d4b46e0faa72cf57356444..a0e7e4a33ecb899bed91522970b315308c1a3fe5 100644 |
--- a/src/arm/code-stubs-arm.cc |
+++ b/src/arm/code-stubs-arm.cc |
@@ -3187,6 +3187,24 @@ void SubStringStub::Generate(MacroAssembler* masm) { |
} |
+void ToNumberStub::Generate(MacroAssembler* masm) { |
+ // The ToNumber stub takes one argument in r0. |
+ Label check_heap_number, call_builtin; |
+ __ JumpIfNotSmi(r0, &check_heap_number); |
+ __ Ret(); |
+ |
+ __ bind(&check_heap_number); |
+ __ ldr(r1, FieldMemOperand(r0, HeapObject::kMapOffset)); |
+ __ CompareRoot(r1, Heap::kHeapNumberMapRootIndex); |
+ __ b(ne, &call_builtin); |
+ __ Ret(); |
+ |
+ __ bind(&call_builtin); |
+ __ push(r0); |
+ __ InvokeBuiltin(Builtins::TO_NUMBER, JUMP_FUNCTION); |
+} |
+ |
+ |
void StringHelper::GenerateFlatOneByteStringEquals( |
MacroAssembler* masm, Register left, Register right, Register scratch1, |
Register scratch2, Register scratch3) { |