| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 698 | 698 |
| 699 Result VirtualFrame::RawCallStub(CodeStub* stub) { | 699 Result VirtualFrame::RawCallStub(CodeStub* stub) { |
| 700 ASSERT(cgen()->HasValidEntryRegisters()); | 700 ASSERT(cgen()->HasValidEntryRegisters()); |
| 701 __ CallStub(stub); | 701 __ CallStub(stub); |
| 702 Result result = cgen()->allocator()->Allocate(rax); | 702 Result result = cgen()->allocator()->Allocate(rax); |
| 703 ASSERT(result.is_valid()); | 703 ASSERT(result.is_valid()); |
| 704 return result; | 704 return result; |
| 705 } | 705 } |
| 706 | 706 |
| 707 | 707 |
| 708 Result VirtualFrame::CallStub(CodeStub* stub, Result* arg) { |
| 709 PrepareForCall(0, 0); |
| 710 arg->ToRegister(rax); |
| 711 arg->Unuse(); |
| 712 return RawCallStub(stub); |
| 713 } |
| 714 |
| 715 |
| 716 Result VirtualFrame::CallStub(CodeStub* stub, Result* arg0, Result* arg1) { |
| 717 PrepareForCall(0, 0); |
| 718 |
| 719 if (arg0->is_register() && arg0->reg().is(rax)) { |
| 720 if (arg1->is_register() && arg1->reg().is(rdx)) { |
| 721 // Wrong registers. |
| 722 __ xchg(rax, rdx); |
| 723 } else { |
| 724 // Register rdx is free for arg0, which frees rax for arg1. |
| 725 arg0->ToRegister(rdx); |
| 726 arg1->ToRegister(rax); |
| 727 } |
| 728 } else { |
| 729 // Register rax is free for arg1, which guarantees rdx is free for |
| 730 // arg0. |
| 731 arg1->ToRegister(rax); |
| 732 arg0->ToRegister(rdx); |
| 733 } |
| 734 |
| 735 arg0->Unuse(); |
| 736 arg1->Unuse(); |
| 737 return RawCallStub(stub); |
| 738 } |
| 739 |
| 740 |
| 708 void VirtualFrame::SyncElementBelowStackPointer(int index) { | 741 void VirtualFrame::SyncElementBelowStackPointer(int index) { |
| 709 // Emit code to write elements below the stack pointer to their | 742 // Emit code to write elements below the stack pointer to their |
| 710 // (already allocated) stack address. | 743 // (already allocated) stack address. |
| 711 ASSERT(index <= stack_pointer_); | 744 ASSERT(index <= stack_pointer_); |
| 712 FrameElement element = elements_[index]; | 745 FrameElement element = elements_[index]; |
| 713 ASSERT(!element.is_synced()); | 746 ASSERT(!element.is_synced()); |
| 714 switch (element.type()) { | 747 switch (element.type()) { |
| 715 case FrameElement::INVALID: | 748 case FrameElement::INVALID: |
| 716 break; | 749 break; |
| 717 | 750 |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 957 | 990 |
| 958 name.Unuse(); | 991 name.Unuse(); |
| 959 value.Unuse(); | 992 value.Unuse(); |
| 960 return RawCallCodeObject(ic, RelocInfo::CODE_TARGET); | 993 return RawCallCodeObject(ic, RelocInfo::CODE_TARGET); |
| 961 } | 994 } |
| 962 | 995 |
| 963 | 996 |
| 964 #undef __ | 997 #undef __ |
| 965 | 998 |
| 966 } } // namespace v8::internal | 999 } } // namespace v8::internal |
| OLD | NEW |