OLD | NEW |
1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 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 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
727 | 727 |
728 Result VirtualFrame::RawCallStub(CodeStub* stub) { | 728 Result VirtualFrame::RawCallStub(CodeStub* stub) { |
729 ASSERT(cgen_->HasValidEntryRegisters()); | 729 ASSERT(cgen_->HasValidEntryRegisters()); |
730 __ CallStub(stub); | 730 __ CallStub(stub); |
731 Result result = cgen_->allocator()->Allocate(eax); | 731 Result result = cgen_->allocator()->Allocate(eax); |
732 ASSERT(result.is_valid()); | 732 ASSERT(result.is_valid()); |
733 return result; | 733 return result; |
734 } | 734 } |
735 | 735 |
736 | 736 |
| 737 Result VirtualFrame::CallStub(CodeStub* stub, Result* arg) { |
| 738 PrepareForCall(0, 0); |
| 739 arg->ToRegister(eax); |
| 740 arg->Unuse(); |
| 741 return RawCallStub(stub); |
| 742 } |
| 743 |
| 744 |
| 745 Result VirtualFrame::CallStub(CodeStub* stub, Result* arg0, Result* arg1) { |
| 746 PrepareForCall(0, 0); |
| 747 |
| 748 if (arg0->is_register() && arg0->reg().is(eax)) { |
| 749 if (arg1->is_register() && arg1->reg().is(edx)) { |
| 750 // Wrong registers. |
| 751 __ xchg(eax, edx); |
| 752 } else { |
| 753 // Register edx is free for arg0, which frees eax for arg1. |
| 754 arg0->ToRegister(edx); |
| 755 arg1->ToRegister(eax); |
| 756 } |
| 757 } else { |
| 758 // Register eax is free for arg1, which guarantees edx is free for |
| 759 // arg0. |
| 760 arg1->ToRegister(eax); |
| 761 arg0->ToRegister(edx); |
| 762 } |
| 763 |
| 764 arg0->Unuse(); |
| 765 arg1->Unuse(); |
| 766 return RawCallStub(stub); |
| 767 } |
| 768 |
| 769 |
737 Result VirtualFrame::CallRuntime(Runtime::Function* f, int arg_count) { | 770 Result VirtualFrame::CallRuntime(Runtime::Function* f, int arg_count) { |
738 PrepareForCall(arg_count, arg_count); | 771 PrepareForCall(arg_count, arg_count); |
739 ASSERT(cgen_->HasValidEntryRegisters()); | 772 ASSERT(cgen_->HasValidEntryRegisters()); |
740 __ CallRuntime(f, arg_count); | 773 __ CallRuntime(f, arg_count); |
741 Result result = cgen_->allocator()->Allocate(eax); | 774 Result result = cgen_->allocator()->Allocate(eax); |
742 ASSERT(result.is_valid()); | 775 ASSERT(result.is_valid()); |
743 return result; | 776 return result; |
744 } | 777 } |
745 | 778 |
746 | 779 |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
992 ASSERT(stack_pointer_ == elements_.length() - 1); | 1025 ASSERT(stack_pointer_ == elements_.length() - 1); |
993 elements_.Add(FrameElement::MemoryElement()); | 1026 elements_.Add(FrameElement::MemoryElement()); |
994 stack_pointer_++; | 1027 stack_pointer_++; |
995 __ push(immediate); | 1028 __ push(immediate); |
996 } | 1029 } |
997 | 1030 |
998 | 1031 |
999 #undef __ | 1032 #undef __ |
1000 | 1033 |
1001 } } // namespace v8::internal | 1034 } } // namespace v8::internal |
OLD | NEW |