Index: src/x87/builtins-x87.cc |
diff --git a/src/x87/builtins-x87.cc b/src/x87/builtins-x87.cc |
index 1926648646dd184f4687c3fc2c4176d533c65e87..5a17736b89962970907b132ab91bbd225db05513 100644 |
--- a/src/x87/builtins-x87.cc |
+++ b/src/x87/builtins-x87.cc |
@@ -2657,6 +2657,27 @@ void Builtins::Generate_AllocateInOldSpace(MacroAssembler* masm) { |
__ TailCallRuntime(Runtime::kAllocateInTargetSpace); |
} |
+// static |
+void Builtins::Generate_StringToNumber(MacroAssembler* masm) { |
+ // The StringToNumber stub takes one argument in eax. |
+ __ AssertString(eax); |
+ |
+ // Check if string has a cached array index. |
+ Label runtime; |
+ __ test(FieldOperand(eax, String::kHashFieldOffset), |
+ Immediate(String::kContainsCachedArrayIndexMask)); |
+ __ j(not_zero, &runtime, Label::kNear); |
+ __ mov(eax, FieldOperand(eax, String::kHashFieldOffset)); |
+ __ IndexFromHash(eax, eax); |
+ __ Ret(); |
+ |
+ __ bind(&runtime); |
+ __ PopReturnAddressTo(ecx); // Pop return address. |
+ __ Push(eax); // Push argument. |
+ __ PushReturnAddressFrom(ecx); // Push return address. |
+ __ TailCallRuntime(Runtime::kStringToNumber); |
+} |
+ |
void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { |
// ----------- S t a t e ------------- |
// -- eax : actual number of arguments |