Chromium Code Reviews| Index: src/x64/code-stubs-x64.cc |
| =================================================================== |
| --- src/x64/code-stubs-x64.cc (revision 6513) |
| +++ src/x64/code-stubs-x64.cc (working copy) |
| @@ -37,6 +37,29 @@ |
| namespace internal { |
| #define __ ACCESS_MASM(masm) |
| + |
| +void ToNumberStub::Generate(MacroAssembler* masm) { |
| + // The ToNumber stub takes one argument in eax. |
| + // It is assumed to be already smi-checked. |
|
William Hesse
2011/01/28 14:12:28
This comment is probably wrong. Otherwise, we wou
fschneider
2011/01/28 14:17:32
Done.
|
| + NearLabel check_heap_number, call_builtin; |
| + __ SmiTest(rax); |
| + __ j(not_zero, &check_heap_number); |
| + __ ret(0); |
|
William Hesse
2011/01/28 14:12:28
Ret() is an alternative to ret(0).
fschneider
2011/01/28 14:17:32
Done.
|
| + |
| + __ bind(&check_heap_number); |
| + __ Move(rbx, Factory::heap_number_map()); |
| + __ cmpq(rbx, FieldOperand(rax, HeapObject::kMapOffset)); |
| + __ j(not_equal, &call_builtin); |
| + __ ret(0); |
| + |
| + __ bind(&call_builtin); |
| + __ pop(rcx); // Pop return address. |
| + __ push(rax); |
| + __ push(rcx); // Push return address. |
| + __ InvokeBuiltin(Builtins::TO_NUMBER, JUMP_FUNCTION); |
| +} |
| + |
| + |
| void FastNewClosureStub::Generate(MacroAssembler* masm) { |
| // Create a new closure from the given function info in new |
| // space. Set the context to the current context in rsi. |