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 12 matching lines...) Expand all Loading... |
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 #include "lithium.h" | 28 #include "lithium.h" |
29 | 29 |
30 namespace v8 { | 30 namespace v8 { |
31 namespace internal { | 31 namespace internal { |
32 | 32 |
| 33 |
| 34 void LOperand::PrintTo(StringStream* stream) { |
| 35 LUnallocated* unalloc = NULL; |
| 36 switch (kind()) { |
| 37 case INVALID: |
| 38 break; |
| 39 case UNALLOCATED: |
| 40 unalloc = LUnallocated::cast(this); |
| 41 stream->Add("v%d", unalloc->virtual_register()); |
| 42 switch (unalloc->policy()) { |
| 43 case LUnallocated::NONE: |
| 44 break; |
| 45 case LUnallocated::FIXED_REGISTER: { |
| 46 const char* register_name = |
| 47 Register::AllocationIndexToString(unalloc->fixed_index()); |
| 48 stream->Add("(=%s)", register_name); |
| 49 break; |
| 50 } |
| 51 case LUnallocated::FIXED_DOUBLE_REGISTER: { |
| 52 const char* double_register_name = |
| 53 DoubleRegister::AllocationIndexToString(unalloc->fixed_index()); |
| 54 stream->Add("(=%s)", double_register_name); |
| 55 break; |
| 56 } |
| 57 case LUnallocated::FIXED_SLOT: |
| 58 stream->Add("(=%dS)", unalloc->fixed_index()); |
| 59 break; |
| 60 case LUnallocated::MUST_HAVE_REGISTER: |
| 61 stream->Add("(R)"); |
| 62 break; |
| 63 case LUnallocated::WRITABLE_REGISTER: |
| 64 stream->Add("(WR)"); |
| 65 break; |
| 66 case LUnallocated::SAME_AS_FIRST_INPUT: |
| 67 stream->Add("(1)"); |
| 68 break; |
| 69 case LUnallocated::ANY: |
| 70 stream->Add("(-)"); |
| 71 break; |
| 72 case LUnallocated::IGNORE: |
| 73 stream->Add("(0)"); |
| 74 break; |
| 75 } |
| 76 break; |
| 77 case CONSTANT_OPERAND: |
| 78 stream->Add("[constant:%d]", index()); |
| 79 break; |
| 80 case STACK_SLOT: |
| 81 stream->Add("[stack:%d]", index()); |
| 82 break; |
| 83 case DOUBLE_STACK_SLOT: |
| 84 stream->Add("[double_stack:%d]", index()); |
| 85 break; |
| 86 case REGISTER: |
| 87 stream->Add("[%s|R]", Register::AllocationIndexToString(index())); |
| 88 break; |
| 89 case DOUBLE_REGISTER: |
| 90 stream->Add("[%s|R]", DoubleRegister::AllocationIndexToString(index())); |
| 91 break; |
| 92 case ARGUMENT: |
| 93 stream->Add("[arg:%d]", index()); |
| 94 break; |
| 95 } |
| 96 } |
| 97 |
| 98 |
| 99 int LOperand::VirtualRegister() { |
| 100 LUnallocated* unalloc = LUnallocated::cast(this); |
| 101 return unalloc->virtual_register(); |
| 102 } |
| 103 |
| 104 |
33 bool LParallelMove::IsRedundant() const { | 105 bool LParallelMove::IsRedundant() const { |
34 for (int i = 0; i < move_operands_.length(); ++i) { | 106 for (int i = 0; i < move_operands_.length(); ++i) { |
35 if (!move_operands_[i].IsRedundant()) return false; | 107 if (!move_operands_[i].IsRedundant()) return false; |
36 } | 108 } |
37 return true; | 109 return true; |
38 } | 110 } |
39 | 111 |
40 | 112 |
41 void LParallelMove::PrintDataTo(StringStream* stream) const { | 113 void LParallelMove::PrintDataTo(StringStream* stream) const { |
42 bool first = true; | 114 bool first = true; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 stream->Add("{"); | 159 stream->Add("{"); |
88 for (int i = 0; i < pointer_operands_.length(); ++i) { | 160 for (int i = 0; i < pointer_operands_.length(); ++i) { |
89 if (i != 0) stream->Add(";"); | 161 if (i != 0) stream->Add(";"); |
90 pointer_operands_[i]->PrintTo(stream); | 162 pointer_operands_[i]->PrintTo(stream); |
91 } | 163 } |
92 stream->Add("} @%d", position()); | 164 stream->Add("} @%d", position()); |
93 } | 165 } |
94 | 166 |
95 | 167 |
96 } } // namespace v8::internal | 168 } } // namespace v8::internal |
OLD | NEW |