| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 // which are still live in the C++ code. | 45 // which are still live in the C++ code. |
| 46 ASSERT(cgen_->HasValidEntryRegisters()); | 46 ASSERT(cgen_->HasValidEntryRegisters()); |
| 47 | 47 |
| 48 if (is_bound()) { | 48 if (is_bound()) { |
| 49 // Backward jump. There is an expected frame to merge to. | 49 // Backward jump. There is an expected frame to merge to. |
| 50 ASSERT(direction_ == BIDIRECTIONAL); | 50 ASSERT(direction_ == BIDIRECTIONAL); |
| 51 cgen_->frame()->MergeTo(entry_frame_); | 51 cgen_->frame()->MergeTo(entry_frame_); |
| 52 cgen_->DeleteFrame(); | 52 cgen_->DeleteFrame(); |
| 53 __ jmp(&entry_label_); | 53 __ jmp(&entry_label_); |
| 54 } else { | 54 } else { |
| 55 // Preconfigured entry frame is not used on ARM. |
| 56 ASSERT(entry_frame_ == NULL); |
| 55 // Forward jump. The current frame is added to the end of the list | 57 // Forward jump. The current frame is added to the end of the list |
| 56 // of frames reaching the target block and a jump to the merge code | 58 // of frames reaching the target block and a jump to the merge code |
| 57 // is emitted. | 59 // is emitted. |
| 58 AddReachingFrame(cgen_->frame()); | 60 AddReachingFrame(cgen_->frame()); |
| 59 RegisterFile empty; | 61 RegisterFile empty; |
| 60 cgen_->SetFrame(NULL, &empty); | 62 cgen_->SetFrame(NULL, &empty); |
| 61 __ jmp(&merge_labels_.last()); | 63 __ jmp(&merge_labels_.last()); |
| 62 } | 64 } |
| 63 | 65 |
| 64 is_linked_ = !is_bound_; | 66 is_linked_ = !is_bound_; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 // around the merge code on the fall through path. | 110 // around the merge code on the fall through path. |
| 109 Label original_fall_through; | 111 Label original_fall_through; |
| 110 __ b(NegateCondition(cc), &original_fall_through); | 112 __ b(NegateCondition(cc), &original_fall_through); |
| 111 cgen_->frame()->MergeTo(entry_frame_); | 113 cgen_->frame()->MergeTo(entry_frame_); |
| 112 cgen_->DeleteFrame(); | 114 cgen_->DeleteFrame(); |
| 113 __ b(&entry_label_); | 115 __ b(&entry_label_); |
| 114 cgen_->SetFrame(fall_through_frame, &non_frame_registers); | 116 cgen_->SetFrame(fall_through_frame, &non_frame_registers); |
| 115 __ bind(&original_fall_through); | 117 __ bind(&original_fall_through); |
| 116 | 118 |
| 117 } else { | 119 } else { |
| 120 // Preconfigured entry frame is not used on ARM. |
| 121 ASSERT(entry_frame_ == NULL); |
| 118 // Forward branch. A copy of the current frame is added to the end | 122 // Forward branch. A copy of the current frame is added to the end |
| 119 // of the list of frames reaching the target block and a branch to | 123 // of the list of frames reaching the target block and a branch to |
| 120 // the merge code is emitted. | 124 // the merge code is emitted. |
| 121 AddReachingFrame(new VirtualFrame(cgen_->frame())); | 125 AddReachingFrame(new VirtualFrame(cgen_->frame())); |
| 122 __ b(cc, &merge_labels_.last()); | 126 __ b(cc, &merge_labels_.last()); |
| 123 is_linked_ = true; | 127 is_linked_ = true; |
| 124 } | 128 } |
| 125 } | 129 } |
| 126 | 130 |
| 127 | 131 |
| 128 void JumpTarget::Call() { | 132 void JumpTarget::Call() { |
| 129 // Call is used to push the address of the catch block on the stack as | 133 // Call is used to push the address of the catch block on the stack as |
| 130 // a return address when compiling try/catch and try/finally. We | 134 // a return address when compiling try/catch and try/finally. We |
| 131 // fully spill the frame before making the call. The expected frame | 135 // fully spill the frame before making the call. The expected frame |
| 132 // at the label (which should be the only one) is the spilled current | 136 // at the label (which should be the only one) is the spilled current |
| 133 // frame plus an in-memory return address. The "fall-through" frame | 137 // frame plus an in-memory return address. The "fall-through" frame |
| 134 // at the return site is the spilled current frame. | 138 // at the return site is the spilled current frame. |
| 135 ASSERT(cgen_ != NULL); | 139 ASSERT(cgen_ != NULL); |
| 136 ASSERT(cgen_->has_valid_frame()); | 140 ASSERT(cgen_->has_valid_frame()); |
| 137 // There are no non-frame references across the call. | 141 // There are no non-frame references across the call. |
| 138 ASSERT(cgen_->HasValidEntryRegisters()); | 142 ASSERT(cgen_->HasValidEntryRegisters()); |
| 139 ASSERT(!is_linked()); | 143 ASSERT(!is_linked()); |
| 140 | 144 |
| 141 cgen_->frame()->SpillAll(); | 145 cgen_->frame()->SpillAll(); |
| 142 VirtualFrame* target_frame = new VirtualFrame(cgen_->frame()); | 146 VirtualFrame* target_frame = new VirtualFrame(cgen_->frame()); |
| 143 target_frame->Adjust(1); | 147 target_frame->Adjust(1); |
| 148 // We do not expect a call with a preconfigured entry frame. |
| 149 ASSERT(entry_frame_ == NULL); |
| 144 AddReachingFrame(target_frame); | 150 AddReachingFrame(target_frame); |
| 145 __ bl(&merge_labels_.last()); | 151 __ bl(&merge_labels_.last()); |
| 146 | 152 |
| 147 is_linked_ = !is_bound_; | 153 is_linked_ = !is_bound_; |
| 148 } | 154 } |
| 149 | 155 |
| 150 | 156 |
| 151 void JumpTarget::DoBind(int mergable_elements) { | 157 void JumpTarget::DoBind(int mergable_elements) { |
| 152 ASSERT(cgen_ != NULL); | 158 ASSERT(cgen_ != NULL); |
| 153 ASSERT(!is_bound()); | 159 ASSERT(!is_bound()); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 is_bound_ = true; | 204 is_bound_ = true; |
| 199 return; | 205 return; |
| 200 } | 206 } |
| 201 } | 207 } |
| 202 | 208 |
| 203 // If there is a current frame, record it as the fall-through. It | 209 // If there is a current frame, record it as the fall-through. It |
| 204 // is owned by the reaching frames for now. | 210 // is owned by the reaching frames for now. |
| 205 bool had_fall_through = false; | 211 bool had_fall_through = false; |
| 206 if (cgen_->has_valid_frame()) { | 212 if (cgen_->has_valid_frame()) { |
| 207 had_fall_through = true; | 213 had_fall_through = true; |
| 208 AddReachingFrame(cgen_->frame()); | 214 AddReachingFrame(cgen_->frame()); // Return value ignored. |
| 209 RegisterFile empty; | 215 RegisterFile empty; |
| 210 cgen_->SetFrame(NULL, &empty); | 216 cgen_->SetFrame(NULL, &empty); |
| 211 } | 217 } |
| 212 | 218 |
| 213 // Compute the frame to use for entry to the block. | 219 // Compute the frame to use for entry to the block. |
| 214 ComputeEntryFrame(mergable_elements); | 220 if (entry_frame_ == NULL) { |
| 221 ComputeEntryFrame(mergable_elements); |
| 222 } |
| 215 | 223 |
| 216 // Some moves required to merge to an expected frame require purely | 224 // Some moves required to merge to an expected frame require purely |
| 217 // frame state changes, and do not require any code generation. | 225 // frame state changes, and do not require any code generation. |
| 218 // Perform those first to increase the possibility of finding equal | 226 // Perform those first to increase the possibility of finding equal |
| 219 // frames below. | 227 // frames below. |
| 220 for (int i = 0; i < reaching_frames_.length(); i++) { | 228 for (int i = 0; i < reaching_frames_.length(); i++) { |
| 221 if (reaching_frames_[i] != NULL) { | 229 if (reaching_frames_[i] != NULL) { |
| 222 reaching_frames_[i]->PrepareMergeTo(entry_frame_); | 230 reaching_frames_[i]->PrepareMergeTo(entry_frame_); |
| 223 } | 231 } |
| 224 } | 232 } |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 } | 334 } |
| 327 | 335 |
| 328 is_linked_ = false; | 336 is_linked_ = false; |
| 329 is_bound_ = true; | 337 is_bound_ = true; |
| 330 } | 338 } |
| 331 | 339 |
| 332 #undef __ | 340 #undef __ |
| 333 | 341 |
| 334 | 342 |
| 335 } } // namespace v8::internal | 343 } } // namespace v8::internal |
| OLD | NEW |