| OLD | NEW |
| (Empty) | |
| 1 |
| 2 // FROM ARM Code |
| 3 |
| 4 #include "v8.h" |
| 5 |
| 6 #include "codegen-inl.h" |
| 7 #include "jump-target-inl.h" |
| 8 #include "register-allocator-inl.h" |
| 9 |
| 10 namespace v8 { |
| 11 namespace internal { |
| 12 |
| 13 // ------------------------------------------------------------------------- |
| 14 // JumpTarget implementation. |
| 15 |
| 16 #define __ ACCESS_MASM(cgen()->masm()) |
| 17 |
| 18 void JumpTarget::DoJump() { |
| 19 UNIMPLEMENTED_(); |
| 20 // ASSERT(cgen()->has_valid_frame()); |
| 21 // // Live non-frame registers are not allowed at unconditional jumps |
| 22 // // because we have no way of invalidating the corresponding results |
| 23 // // which are still live in the C++ code. |
| 24 // ASSERT(cgen()->HasValidEntryRegisters()); |
| 25 // |
| 26 // if (is_bound()) { |
| 27 // // Backward jump. There already a frame expectation at the target. |
| 28 // ASSERT(direction_ == BIDIRECTIONAL); |
| 29 // cgen()->frame()->MergeTo(entry_frame_); |
| 30 // cgen()->DeleteFrame(); |
| 31 // } else { |
| 32 // // Use the current frame as the expected one at the target if necessary. |
| 33 // if (entry_frame_ == NULL) { |
| 34 // entry_frame_ = cgen()->frame(); |
| 35 // RegisterFile empty; |
| 36 // cgen()->SetFrame(NULL, &empty); |
| 37 // } else { |
| 38 // cgen()->frame()->MergeTo(entry_frame_); |
| 39 // cgen()->DeleteFrame(); |
| 40 // } |
| 41 // |
| 42 // // The predicate is_linked() should be made true. Its implementation |
| 43 // // detects the presence of a frame pointer in the reaching_frames_ list. |
| 44 // if (!is_linked()) { |
| 45 // reaching_frames_.Add(NULL); |
| 46 // ASSERT(is_linked()); |
| 47 // } |
| 48 // } |
| 49 //// __ jmp(&entry_label_); |
| 50 //// __ break_(0x12345); // CURRENT We fail on the following branch |
| 51 // __ b(&entry_label_); |
| 52 // __ nop(); // NOP_ADDED |
| 53 } |
| 54 |
| 55 |
| 56 void JumpTarget::DoBranch(Condition cc, Hint ignored, Register src1, const Opera
nd& src2) { |
| 57 UNIMPLEMENTED_(); |
| 58 // ASSERT(cgen()->has_valid_frame()); |
| 59 // |
| 60 // if (is_bound()) { |
| 61 // ASSERT(direction_ == BIDIRECTIONAL); |
| 62 // // Backward branch. We have an expected frame to merge to on the |
| 63 // // backward edge. |
| 64 // cgen()->frame()->MergeTo(entry_frame_); |
| 65 // } else { |
| 66 // // Clone the current frame to use as the expected one at the target if |
| 67 // // necessary. |
| 68 // if (entry_frame_ == NULL) { |
| 69 // entry_frame_ = new VirtualFrame(cgen()->frame()); |
| 70 // } |
| 71 // // The predicate is_linked() should be made true. Its implementation |
| 72 // // detects the presence of a frame pointer in the reaching_frames_ list. |
| 73 // if (!is_linked()) { |
| 74 // reaching_frames_.Add(NULL); |
| 75 // ASSERT(is_linked()); |
| 76 // } |
| 77 // } |
| 78 //// __ b(cc, &entry_label_); |
| 79 // __ bcond(cc, &entry_label_, src1, src2); |
| 80 // __ nop(); // NOP_ADDED |
| 81 } |
| 82 |
| 83 |
| 84 void JumpTarget::Call() { |
| 85 UNIMPLEMENTED_(); |
| 86 // // Call is used to push the address of the catch block on the stack as |
| 87 // // a return address when compiling try/catch and try/finally. We |
| 88 // // fully spill the frame before making the call. The expected frame |
| 89 // // at the label (which should be the only one) is the spilled current |
| 90 // // frame plus an in-memory return address. The "fall-through" frame |
| 91 // // at the return site is the spilled current frame. |
| 92 // ASSERT(cgen()->has_valid_frame()); |
| 93 // // There are no non-frame references across the call. |
| 94 // ASSERT(cgen()->HasValidEntryRegisters()); |
| 95 // ASSERT(!is_linked()); |
| 96 // |
| 97 // // Calls are always 'forward' so we use a copy of the current frame (plus |
| 98 // // one for a return address) as the expected frame. |
| 99 // ASSERT(entry_frame_ == NULL); |
| 100 // VirtualFrame* target_frame = new VirtualFrame(cgen()->frame()); |
| 101 // target_frame->Adjust(1); |
| 102 // entry_frame_ = target_frame; |
| 103 // |
| 104 // // The predicate is_linked() should now be made true. Its implementation |
| 105 // // detects the presence of a frame pointer in the reaching_frames_ list. |
| 106 // reaching_frames_.Add(NULL); |
| 107 // ASSERT(is_linked()); |
| 108 // |
| 109 // __ bal(&entry_label_); |
| 110 // __ nop(); // NOP_ADDED |
| 111 } |
| 112 |
| 113 |
| 114 void JumpTarget::DoBind() { |
| 115 UNIMPLEMENTED_(); |
| 116 // ASSERT(!is_bound()); |
| 117 // |
| 118 // // Live non-frame registers are not allowed at the start of a basic |
| 119 // // block. |
| 120 // ASSERT(!cgen()->has_valid_frame() || cgen()->HasValidEntryRegisters()); |
| 121 // |
| 122 // if (cgen()->has_valid_frame()) { |
| 123 // // If there is a current frame we can use it on the fall through. |
| 124 // if (entry_frame_ == NULL) { |
| 125 // entry_frame_ = new VirtualFrame(cgen()->frame()); |
| 126 // } else { |
| 127 // ASSERT(cgen()->frame()->Equals(entry_frame_)); |
| 128 // } |
| 129 // } else { |
| 130 // // If there is no current frame we must have an entry frame which we can |
| 131 // // copy. |
| 132 // ASSERT(entry_frame_ != NULL); |
| 133 // RegisterFile empty; |
| 134 // cgen()->SetFrame(new VirtualFrame(entry_frame_), &empty); |
| 135 // } |
| 136 // |
| 137 // // The predicate is_linked() should be made false. Its implementation |
| 138 // // detects the presence (or absence) of frame pointers in the |
| 139 // // reaching_frames_ list. If we inserted a bogus frame to make |
| 140 // // is_linked() true, remove it now. |
| 141 // if (is_linked()) { |
| 142 // reaching_frames_.Clear(); |
| 143 // } |
| 144 // |
| 145 // __ bind(&entry_label_); |
| 146 } |
| 147 |
| 148 |
| 149 void BreakTarget::Jump() { |
| 150 UNIMPLEMENTED_(); |
| 151 // // ARM comment |
| 152 // // On ARM we do not currently emit merge code for jumps, so we need to do |
| 153 // // it explicitly here. The only merging necessary is to drop extra |
| 154 // // statement state from the stack. |
| 155 // ASSERT(cgen()->has_valid_frame()); |
| 156 // int count = cgen()->frame()->height() - expected_height_; |
| 157 // cgen()->frame()->Drop(count); |
| 158 // DoJump(); |
| 159 } |
| 160 |
| 161 |
| 162 void BreakTarget::Jump(Result* arg) { |
| 163 UNIMPLEMENTED_(); |
| 164 // // ARM comment |
| 165 // // On ARM we do not currently emit merge code for jumps, so we need to do |
| 166 // // it explicitly here. The only merging necessary is to drop extra |
| 167 // // statement state from the stack. |
| 168 // ASSERT(cgen()->has_valid_frame()); |
| 169 // int count = cgen()->frame()->height() - expected_height_; |
| 170 // cgen()->frame()->Drop(count); |
| 171 // cgen()->frame()->Push(arg); |
| 172 // DoJump(); |
| 173 } |
| 174 |
| 175 |
| 176 void BreakTarget::Bind() { |
| 177 UNIMPLEMENTED_(); |
| 178 //#ifdef DEBUG |
| 179 // // All the forward-reaching frames should have been adjusted at the |
| 180 // // jumps to this target. |
| 181 // for (int i = 0; i < reaching_frames_.length(); i++) { |
| 182 // ASSERT(reaching_frames_[i] == NULL || |
| 183 // reaching_frames_[i]->height() == expected_height_); |
| 184 // } |
| 185 //#endif |
| 186 // // Drop leftover statement state from the frame before merging, even |
| 187 // // on the fall through. This is so we can bind the return target |
| 188 // // with state on the frame. |
| 189 // if (cgen()->has_valid_frame()) { |
| 190 // int count = cgen()->frame()->height() - expected_height_; |
| 191 // // On ARM we do not currently emit merge code at binding sites, so we need |
| 192 // // to do it explicitly here. The only merging necessary is to drop extra |
| 193 // // statement state from the stack. |
| 194 // cgen()->frame()->Drop(count); |
| 195 // } |
| 196 // |
| 197 // DoBind(); |
| 198 } |
| 199 |
| 200 |
| 201 void BreakTarget::Bind(Result* arg) { |
| 202 UNIMPLEMENTED(); |
| 203 //#ifdef DEBUG |
| 204 // // All the forward-reaching frames should have been adjusted at the |
| 205 // // jumps to this target. |
| 206 // for (int i = 0; i < reaching_frames_.length(); i++) { |
| 207 // ASSERT(reaching_frames_[i] == NULL || |
| 208 // reaching_frames_[i]->height() == expected_height_ + 1); |
| 209 // } |
| 210 //#endif |
| 211 // // Drop leftover statement state from the frame before merging, even |
| 212 // // on the fall through. This is so we can bind the return target |
| 213 // // with state on the frame. |
| 214 // if (cgen()->has_valid_frame()) { |
| 215 // int count = cgen()->frame()->height() - expected_height_; |
| 216 // // ARM comment |
| 217 // // On ARM we do not currently emit merge code at binding sites, so we need |
| 218 // // to do it explicitly here. The only merging necessary is to drop extra |
| 219 // // statement state from the stack. |
| 220 // cgen()->frame()->ForgetElements(count); |
| 221 // cgen()->frame()->Push(arg); |
| 222 // } |
| 223 // DoBind(); |
| 224 // *arg = cgen()->frame()->Pop(); |
| 225 } |
| 226 |
| 227 |
| 228 #undef __ |
| 229 |
| 230 |
| 231 } } // namespace v8::internal |
| OLD | NEW |