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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 // If we already bound and generated code at the destination then it | 54 // If we already bound and generated code at the destination then it |
55 // is too late to ask for less optimistic type assumptions. | 55 // is too late to ask for less optimistic type assumptions. |
56 ASSERT(entry_frame_.IsCompatibleWith(cgen()->frame())); | 56 ASSERT(entry_frame_.IsCompatibleWith(cgen()->frame())); |
57 } | 57 } |
58 // There already a frame expectation at the target. | 58 // There already a frame expectation at the target. |
59 cgen()->frame()->MergeTo(&entry_frame_); | 59 cgen()->frame()->MergeTo(&entry_frame_); |
60 cgen()->DeleteFrame(); | 60 cgen()->DeleteFrame(); |
61 } else { | 61 } else { |
62 // Clone the current frame to use as the expected one at the target. | 62 // Clone the current frame to use as the expected one at the target. |
63 set_entry_frame(cgen()->frame()); | 63 set_entry_frame(cgen()->frame()); |
| 64 // Zap the fall-through frame since the jump was unconditional. |
64 RegisterFile empty; | 65 RegisterFile empty; |
65 cgen()->SetFrame(NULL, &empty); | 66 cgen()->SetFrame(NULL, &empty); |
66 } | 67 } |
| 68 if (entry_label_.is_bound()) { |
| 69 // You can't jump backwards to an already bound label unless you admitted |
| 70 // up front that this was a bidirectional jump target. Bidirectional jump |
| 71 // targets will zap their type info when bound in case some later virtual |
| 72 // frame with less precise type info branches to them. |
| 73 ASSERT(direction_ != FORWARD_ONLY); |
| 74 } |
67 __ jmp(&entry_label_); | 75 __ jmp(&entry_label_); |
68 } | 76 } |
69 | 77 |
70 | 78 |
71 void JumpTarget::DoBranch(Condition cc, Hint ignored) { | 79 void JumpTarget::DoBranch(Condition cc, Hint ignored) { |
72 ASSERT(cgen()->has_valid_frame()); | 80 ASSERT(cgen()->has_valid_frame()); |
73 | 81 |
74 if (entry_frame_set_) { | 82 if (entry_frame_set_) { |
75 if (entry_label_.is_bound()) { | 83 if (entry_label_.is_bound()) { |
76 // If we already bound and generated code at the destination then it | 84 // If we already bound and generated code at the destination then it |
77 // is too late to ask for less optimistic type assumptions. | 85 // is too late to ask for less optimistic type assumptions. |
78 ASSERT(entry_frame_.IsCompatibleWith(cgen()->frame())); | 86 ASSERT(entry_frame_.IsCompatibleWith(cgen()->frame())); |
79 } | 87 } |
80 // We have an expected frame to merge to on the backward edge. | 88 // We have an expected frame to merge to on the backward edge. |
81 cgen()->frame()->MergeTo(&entry_frame_, cc); | 89 cgen()->frame()->MergeTo(&entry_frame_, cc); |
82 } else { | 90 } else { |
83 // Clone the current frame to use as the expected one at the target. | 91 // Clone the current frame to use as the expected one at the target. |
84 set_entry_frame(cgen()->frame()); | 92 set_entry_frame(cgen()->frame()); |
85 } | 93 } |
| 94 if (entry_label_.is_bound()) { |
| 95 // You can't branch backwards to an already bound label unless you admitted |
| 96 // up front that this was a bidirectional jump target. Bidirectional jump |
| 97 // targets will zap their type info when bound in case some later virtual |
| 98 // frame with less precise type info branches to them. |
| 99 ASSERT(direction_ != FORWARD_ONLY); |
| 100 } |
86 __ b(cc, &entry_label_); | 101 __ b(cc, &entry_label_); |
87 if (cc == al) { | 102 if (cc == al) { |
88 cgen()->DeleteFrame(); | 103 cgen()->DeleteFrame(); |
89 } | 104 } |
90 } | 105 } |
91 | 106 |
92 | 107 |
93 void JumpTarget::Call() { | 108 void JumpTarget::Call() { |
94 // Call is used to push the address of the catch block on the stack as | 109 // Call is used to push the address of the catch block on the stack as |
95 // a return address when compiling try/catch and try/finally. We | 110 // a return address when compiling try/catch and try/finally. We |
(...skipping 18 matching lines...) Expand all Loading... |
114 | 129 |
115 | 130 |
116 void JumpTarget::DoBind() { | 131 void JumpTarget::DoBind() { |
117 ASSERT(!is_bound()); | 132 ASSERT(!is_bound()); |
118 | 133 |
119 // Live non-frame registers are not allowed at the start of a basic | 134 // Live non-frame registers are not allowed at the start of a basic |
120 // block. | 135 // block. |
121 ASSERT(!cgen()->has_valid_frame() || cgen()->HasValidEntryRegisters()); | 136 ASSERT(!cgen()->has_valid_frame() || cgen()->HasValidEntryRegisters()); |
122 | 137 |
123 if (cgen()->has_valid_frame()) { | 138 if (cgen()->has_valid_frame()) { |
| 139 if (direction_ != FORWARD_ONLY) cgen()->frame()->ForgetTypeInfo(); |
124 // If there is a current frame we can use it on the fall through. | 140 // If there is a current frame we can use it on the fall through. |
125 if (!entry_frame_set_) { | 141 if (!entry_frame_set_) { |
126 entry_frame_ = *cgen()->frame(); | 142 entry_frame_ = *cgen()->frame(); |
127 entry_frame_set_ = true; | 143 entry_frame_set_ = true; |
128 } else { | 144 } else { |
129 cgen()->frame()->MergeTo(&entry_frame_); | 145 cgen()->frame()->MergeTo(&entry_frame_); |
130 } | 146 } |
131 } else { | 147 } else { |
132 // If there is no current frame we must have an entry frame which we can | 148 // If there is no current frame we must have an entry frame which we can |
133 // copy. | 149 // copy. |
134 ASSERT(entry_frame_set_); | 150 ASSERT(entry_frame_set_); |
135 RegisterFile empty; | 151 RegisterFile empty; |
136 cgen()->SetFrame(new VirtualFrame(&entry_frame_), &empty); | 152 cgen()->SetFrame(new VirtualFrame(&entry_frame_), &empty); |
137 } | 153 } |
138 | 154 |
139 __ bind(&entry_label_); | 155 __ bind(&entry_label_); |
140 } | 156 } |
141 | 157 |
142 | 158 |
143 #undef __ | 159 #undef __ |
144 | 160 |
145 | 161 |
146 } } // namespace v8::internal | 162 } } // namespace v8::internal |
147 | 163 |
148 #endif // V8_TARGET_ARCH_ARM | 164 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |