| 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 19 matching lines...) Expand all Loading... |
| 30 #if defined(V8_TARGET_ARCH_X64) | 30 #if defined(V8_TARGET_ARCH_X64) |
| 31 | 31 |
| 32 #include "bootstrapper.h" | 32 #include "bootstrapper.h" |
| 33 #include "code-stubs.h" | 33 #include "code-stubs.h" |
| 34 #include "regexp-macro-assembler.h" | 34 #include "regexp-macro-assembler.h" |
| 35 | 35 |
| 36 namespace v8 { | 36 namespace v8 { |
| 37 namespace internal { | 37 namespace internal { |
| 38 | 38 |
| 39 #define __ ACCESS_MASM(masm) | 39 #define __ ACCESS_MASM(masm) |
| 40 |
| 41 void ToNumberStub::Generate(MacroAssembler* masm) { |
| 42 // The ToNumber stub takes one argument in eax. |
| 43 NearLabel check_heap_number, call_builtin; |
| 44 __ SmiTest(rax); |
| 45 __ j(not_zero, &check_heap_number); |
| 46 __ Ret(); |
| 47 |
| 48 __ bind(&check_heap_number); |
| 49 __ Move(rbx, Factory::heap_number_map()); |
| 50 __ cmpq(rbx, FieldOperand(rax, HeapObject::kMapOffset)); |
| 51 __ j(not_equal, &call_builtin); |
| 52 __ Ret(); |
| 53 |
| 54 __ bind(&call_builtin); |
| 55 __ pop(rcx); // Pop return address. |
| 56 __ push(rax); |
| 57 __ push(rcx); // Push return address. |
| 58 __ InvokeBuiltin(Builtins::TO_NUMBER, JUMP_FUNCTION); |
| 59 } |
| 60 |
| 61 |
| 40 void FastNewClosureStub::Generate(MacroAssembler* masm) { | 62 void FastNewClosureStub::Generate(MacroAssembler* masm) { |
| 41 // Create a new closure from the given function info in new | 63 // Create a new closure from the given function info in new |
| 42 // space. Set the context to the current context in rsi. | 64 // space. Set the context to the current context in rsi. |
| 43 Label gc; | 65 Label gc; |
| 44 __ AllocateInNewSpace(JSFunction::kSize, rax, rbx, rcx, &gc, TAG_OBJECT); | 66 __ AllocateInNewSpace(JSFunction::kSize, rax, rbx, rcx, &gc, TAG_OBJECT); |
| 45 | 67 |
| 46 // Get the function info from the stack. | 68 // Get the function info from the stack. |
| 47 __ movq(rdx, Operand(rsp, 1 * kPointerSize)); | 69 __ movq(rdx, Operand(rsp, 1 * kPointerSize)); |
| 48 | 70 |
| 49 // Compute the function map in the current global context and set that | 71 // Compute the function map in the current global context and set that |
| (...skipping 4340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4390 | 4412 |
| 4391 // Do a tail call to the rewritten stub. | 4413 // Do a tail call to the rewritten stub. |
| 4392 __ jmp(rdi); | 4414 __ jmp(rdi); |
| 4393 } | 4415 } |
| 4394 | 4416 |
| 4395 #undef __ | 4417 #undef __ |
| 4396 | 4418 |
| 4397 } } // namespace v8::internal | 4419 } } // namespace v8::internal |
| 4398 | 4420 |
| 4399 #endif // V8_TARGET_ARCH_X64 | 4421 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |