Index: src/ia32/builtins-ia32.cc |
diff --git a/src/ia32/builtins-ia32.cc b/src/ia32/builtins-ia32.cc |
index db558a7f5558c2160e2722e3f302b59e9a3f780f..310684b52d160d2125ec303d3cbb8c9abcdde5e6 100644 |
--- a/src/ia32/builtins-ia32.cc |
+++ b/src/ia32/builtins-ia32.cc |
@@ -2648,6 +2648,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 |