| 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 __ jmp(&label_); | 130 __ jmp(&label_); |
| 131 __ bind(&original_fall_through); | 131 __ bind(&original_fall_through); |
| 132 } else { | 132 } else { |
| 133 expected_frame_->MakeMergable(); | 133 expected_frame_->MakeMergable(); |
| 134 ASSERT(cgen_->HasValidEntryRegisters()); | 134 ASSERT(cgen_->HasValidEntryRegisters()); |
| 135 __ j(cc, &label_, hint); | 135 __ j(cc, &label_, hint); |
| 136 } | 136 } |
| 137 } else { | 137 } else { |
| 138 // No code needs to be emitted to merge to the expected frame at the | 138 // No code needs to be emitted to merge to the expected frame at the |
| 139 // actual function return. | 139 // actual function return. |
| 140 if (!cgen_->IsActualFunctionReturn(this)) { | 140 if (cgen_->IsActualFunctionReturn(this)) { |
| 141 current_frame->MergeTo(expected_frame_); | 141 ASSERT(cgen_->HasValidEntryRegisters()); |
| 142 __ j(cc, &label_, hint); |
| 143 } else { |
| 144 // We negate the condition and emit the code to merge to the expected |
| 145 // frame immediately. |
| 146 // |
| 147 // TODO(): This should be replaced with a solution that emits the |
| 148 // merge code for forward CFG edges at the appropriate entry to the |
| 149 // target block. |
| 150 Label original_fall_through; |
| 151 __ j(NegateCondition(cc), &original_fall_through, NegateHint(hint)); |
| 152 VirtualFrame* working_frame = new VirtualFrame(current_frame); |
| 153 cgen_->SetFrame(working_frame); |
| 154 working_frame->MergeTo(expected_frame_); |
| 155 ASSERT(cgen_->HasValidEntryRegisters()); |
| 156 __ jmp(&label_); |
| 157 cgen_->SetFrame(current_frame); |
| 158 delete working_frame; |
| 159 __ bind(&original_fall_through); |
| 142 } | 160 } |
| 143 ASSERT(cgen_->HasValidEntryRegisters()); | |
| 144 __ j(cc, &label_, hint); | |
| 145 } | 161 } |
| 146 // Postcondition: there is both a current frame and an expected frame at | 162 // Postcondition: there is both a current frame and an expected frame at |
| 147 // the label and they match. | 163 // the label and they match. |
| 148 } | 164 } |
| 149 | 165 |
| 150 | 166 |
| 151 void JumpTarget::Branch(Condition cc, Result* arg, Hint hint) { | 167 void JumpTarget::Branch(Condition cc, Result* arg, Hint hint) { |
| 152 ASSERT(cgen_ != NULL); | 168 ASSERT(cgen_ != NULL); |
| 153 ASSERT(cgen_->has_valid_frame()); | 169 ASSERT(cgen_->has_valid_frame()); |
| 154 | 170 |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 | 374 |
| 359 #ifdef DEBUG | 375 #ifdef DEBUG |
| 360 is_shadowing_ = false; | 376 is_shadowing_ = false; |
| 361 #endif | 377 #endif |
| 362 } | 378 } |
| 363 | 379 |
| 364 #undef __ | 380 #undef __ |
| 365 | 381 |
| 366 | 382 |
| 367 } } // namespace v8::internal | 383 } } // namespace v8::internal |
| OLD | NEW |