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 NearLabel check_heap_number, call_builtin; |
| 45 __ test(eax, Immediate(kSmiTagMask)); |
| 46 __ j(not_zero, &check_heap_number); |
| 47 __ ret(0); |
| 48 |
| 49 __ bind(&check_heap_number); |
| 50 __ mov(ebx, FieldOperand(eax, HeapObject::kMapOffset)); |
| 51 __ cmp(Operand(ebx), Immediate(Factory::heap_number_map())); |
| 52 __ j(not_equal, &call_builtin); |
| 53 __ ret(0); |
| 54 |
| 55 __ bind(&call_builtin); |
| 56 __ pop(ecx); // Pop return address. |
| 57 __ push(eax); |
| 58 __ push(ecx); // Push return address. |
| 59 __ InvokeBuiltin(Builtins::TO_NUMBER, JUMP_FUNCTION); |
| 60 } |
| 61 |
| 62 |
41 void FastNewClosureStub::Generate(MacroAssembler* masm) { | 63 void FastNewClosureStub::Generate(MacroAssembler* masm) { |
42 // Create a new closure from the given function info in new | 64 // Create a new closure from the given function info in new |
43 // space. Set the context to the current context in esi. | 65 // space. Set the context to the current context in esi. |
44 Label gc; | 66 Label gc; |
45 __ AllocateInNewSpace(JSFunction::kSize, eax, ebx, ecx, &gc, TAG_OBJECT); | 67 __ AllocateInNewSpace(JSFunction::kSize, eax, ebx, ecx, &gc, TAG_OBJECT); |
46 | 68 |
47 // Get the function info from the stack. | 69 // Get the function info from the stack. |
48 __ mov(edx, Operand(esp, 1 * kPointerSize)); | 70 __ mov(edx, Operand(esp, 1 * kPointerSize)); |
49 | 71 |
50 // Compute the function map in the current global context and set that | 72 // 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. | 6505 // Do a tail call to the rewritten stub. |
6484 __ jmp(Operand(edi)); | 6506 __ jmp(Operand(edi)); |
6485 } | 6507 } |
6486 | 6508 |
6487 | 6509 |
6488 #undef __ | 6510 #undef __ |
6489 | 6511 |
6490 } } // namespace v8::internal | 6512 } } // namespace v8::internal |
6491 | 6513 |
6492 #endif // V8_TARGET_ARCH_IA32 | 6514 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |