| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 // You can't jump backwards to an already bound label unless you admitted | 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 | 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 | 71 // targets will zap their type info when bound in case some later virtual |
| 72 // frame with less precise type info branches to them. | 72 // frame with less precise type info branches to them. |
| 73 ASSERT(direction_ != FORWARD_ONLY); | 73 ASSERT(direction_ != FORWARD_ONLY); |
| 74 } | 74 } |
| 75 __ jmp(&entry_label_); | 75 __ jmp(&entry_label_); |
| 76 } | 76 } |
| 77 | 77 |
| 78 | 78 |
| 79 void JumpTarget::DoBranch(Condition cc, Hint ignored) { | 79 void JumpTarget::DoBranch(Condition cond, Hint ignored) { |
| 80 ASSERT(cgen()->has_valid_frame()); | 80 ASSERT(cgen()->has_valid_frame()); |
| 81 | 81 |
| 82 if (entry_frame_set_) { | 82 if (entry_frame_set_) { |
| 83 if (entry_label_.is_bound()) { | 83 if (entry_label_.is_bound()) { |
| 84 // 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 |
| 85 // is too late to ask for less optimistic type assumptions. | 85 // is too late to ask for less optimistic type assumptions. |
| 86 ASSERT(entry_frame_.IsCompatibleWith(cgen()->frame())); | 86 ASSERT(entry_frame_.IsCompatibleWith(cgen()->frame())); |
| 87 } | 87 } |
| 88 // 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. |
| 89 cgen()->frame()->MergeTo(&entry_frame_, cc); | 89 cgen()->frame()->MergeTo(&entry_frame_, cond); |
| 90 } else { | 90 } else { |
| 91 // 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. |
| 92 set_entry_frame(cgen()->frame()); | 92 set_entry_frame(cgen()->frame()); |
| 93 } | 93 } |
| 94 if (entry_label_.is_bound()) { | 94 if (entry_label_.is_bound()) { |
| 95 // You can't branch backwards to an already bound label unless you admitted | 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 | 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 | 97 // targets will zap their type info when bound in case some later virtual |
| 98 // frame with less precise type info branches to them. | 98 // frame with less precise type info branches to them. |
| 99 ASSERT(direction_ != FORWARD_ONLY); | 99 ASSERT(direction_ != FORWARD_ONLY); |
| 100 } | 100 } |
| 101 __ b(cc, &entry_label_); | 101 __ b(cond, &entry_label_); |
| 102 if (cc == al) { | 102 if (cond == al) { |
| 103 cgen()->DeleteFrame(); | 103 cgen()->DeleteFrame(); |
| 104 } | 104 } |
| 105 } | 105 } |
| 106 | 106 |
| 107 | 107 |
| 108 void JumpTarget::Call() { | 108 void JumpTarget::Call() { |
| 109 // 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 |
| 110 // a return address when compiling try/catch and try/finally. We | 110 // a return address when compiling try/catch and try/finally. We |
| 111 // fully spill the frame before making the call. The expected frame | 111 // fully spill the frame before making the call. The expected frame |
| 112 // at the label (which should be the only one) is the spilled current | 112 // at the label (which should be the only one) is the spilled current |
| (...skipping 23 matching lines...) Expand all Loading... |
| 136 ASSERT(!cgen()->has_valid_frame() || cgen()->HasValidEntryRegisters()); | 136 ASSERT(!cgen()->has_valid_frame() || cgen()->HasValidEntryRegisters()); |
| 137 | 137 |
| 138 if (cgen()->has_valid_frame()) { | 138 if (cgen()->has_valid_frame()) { |
| 139 if (direction_ != FORWARD_ONLY) cgen()->frame()->ForgetTypeInfo(); | 139 if (direction_ != FORWARD_ONLY) cgen()->frame()->ForgetTypeInfo(); |
| 140 // 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. |
| 141 if (!entry_frame_set_) { | 141 if (!entry_frame_set_) { |
| 142 entry_frame_ = *cgen()->frame(); | 142 entry_frame_ = *cgen()->frame(); |
| 143 entry_frame_set_ = true; | 143 entry_frame_set_ = true; |
| 144 } else { | 144 } else { |
| 145 cgen()->frame()->MergeTo(&entry_frame_); | 145 cgen()->frame()->MergeTo(&entry_frame_); |
| 146 // On fall through we may have to merge both ways. |
| 147 if (direction_ != FORWARD_ONLY) { |
| 148 // This will not need to adjust the virtual frame entries that are |
| 149 // register allocated since that was done above and they now match. |
| 150 // But it does need to adjust the entry_frame_ of this jump target |
| 151 // to make it potentially less optimistic. Later code can branch back |
| 152 // to this jump target and we need to assert that that code does not |
| 153 // have weaker assumptions about types. |
| 154 entry_frame_.MergeTo(cgen()->frame()); |
| 155 } |
| 146 } | 156 } |
| 147 } else { | 157 } else { |
| 148 // If there is no current frame we must have an entry frame which we can | 158 // If there is no current frame we must have an entry frame which we can |
| 149 // copy. | 159 // copy. |
| 150 ASSERT(entry_frame_set_); | 160 ASSERT(entry_frame_set_); |
| 151 RegisterFile empty; | 161 RegisterFile empty; |
| 152 cgen()->SetFrame(new VirtualFrame(&entry_frame_), &empty); | 162 cgen()->SetFrame(new VirtualFrame(&entry_frame_), &empty); |
| 153 } | 163 } |
| 154 | 164 |
| 155 __ bind(&entry_label_); | 165 __ bind(&entry_label_); |
| 156 } | 166 } |
| 157 | 167 |
| 158 | 168 |
| 159 #undef __ | 169 #undef __ |
| 160 | 170 |
| 161 | 171 |
| 162 } } // namespace v8::internal | 172 } } // namespace v8::internal |
| 163 | 173 |
| 164 #endif // V8_TARGET_ARCH_ARM | 174 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |