Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 31 | 31 |
| 32 #include "code-stubs.h" | 32 #include "code-stubs.h" |
| 33 #include "bootstrapper.h" | 33 #include "bootstrapper.h" |
| 34 #include "jsregexp.h" | 34 #include "jsregexp.h" |
| 35 #include "regexp-macro-assembler.h" | 35 #include "regexp-macro-assembler.h" |
| 36 | 36 |
| 37 namespace v8 { | 37 namespace v8 { |
| 38 namespace internal { | 38 namespace internal { |
| 39 | 39 |
| 40 #define __ ACCESS_MASM(masm) | 40 #define __ ACCESS_MASM(masm) |
| 41 | |
| 42 void ToNumberStub::Generate(MacroAssembler* masm) { | |
| 43 // The ToNumber stub takes one argument in eax. | |
| 44 // It is assumed to be already smi-checked. | |
| 45 NearLabel check_heap_number, call_builtin; | |
| 46 __ test(eax, Immediate(kSmiTagMask)); | |
| 47 __ j(not_zero, &check_heap_number); | |
| 48 __ ret(0); | |
|
William Hesse
2011/01/28 14:12:28
Ret() is an alternative to ret(0)
| |
| 49 | |
| 50 __ bind(&check_heap_number); | |
| 51 __ mov(ebx, FieldOperand(eax, HeapObject::kMapOffset)); | |
| 52 __ cmp(Operand(ebx), Immediate(Factory::heap_number_map())); | |
| 53 __ j(not_equal, &call_builtin); | |
| 54 __ ret(0); | |
| 55 | |
| 56 __ bind(&call_builtin); | |
| 57 __ pop(ecx); // Pop return address. | |
| 58 __ push(eax); | |
| 59 __ push(ecx); // Push return address. | |
| 60 __ InvokeBuiltin(Builtins::TO_NUMBER, JUMP_FUNCTION); | |
| 61 } | |
| 62 | |
| 63 | |
| 41 void FastNewClosureStub::Generate(MacroAssembler* masm) { | 64 void FastNewClosureStub::Generate(MacroAssembler* masm) { |
| 42 // Create a new closure from the given function info in new | 65 // Create a new closure from the given function info in new |
| 43 // space. Set the context to the current context in esi. | 66 // space. Set the context to the current context in esi. |
| 44 Label gc; | 67 Label gc; |
| 45 __ AllocateInNewSpace(JSFunction::kSize, eax, ebx, ecx, &gc, TAG_OBJECT); | 68 __ AllocateInNewSpace(JSFunction::kSize, eax, ebx, ecx, &gc, TAG_OBJECT); |
| 46 | 69 |
| 47 // Get the function info from the stack. | 70 // Get the function info from the stack. |
| 48 __ mov(edx, Operand(esp, 1 * kPointerSize)); | 71 __ mov(edx, Operand(esp, 1 * kPointerSize)); |
| 49 | 72 |
| 50 // Compute the function map in the current global context and set that | 73 // Compute the function map in the current global context and set that |
| (...skipping 6432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6483 // Do a tail call to the rewritten stub. | 6506 // Do a tail call to the rewritten stub. |
| 6484 __ jmp(Operand(edi)); | 6507 __ jmp(Operand(edi)); |
| 6485 } | 6508 } |
| 6486 | 6509 |
| 6487 | 6510 |
| 6488 #undef __ | 6511 #undef __ |
| 6489 | 6512 |
| 6490 } } // namespace v8::internal | 6513 } } // namespace v8::internal |
| 6491 | 6514 |
| 6492 #endif // V8_TARGET_ARCH_IA32 | 6515 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |