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 19 matching lines...) Expand all Loading... |
30 #include "codegen-inl.h" | 30 #include "codegen-inl.h" |
31 #include "register-allocator-inl.h" | 31 #include "register-allocator-inl.h" |
32 | 32 |
33 namespace v8 { namespace internal { | 33 namespace v8 { namespace internal { |
34 | 34 |
35 // ------------------------------------------------------------------------- | 35 // ------------------------------------------------------------------------- |
36 // JumpTarget implementation. | 36 // JumpTarget implementation. |
37 | 37 |
38 #define __ masm_-> | 38 #define __ masm_-> |
39 | 39 |
40 void JumpTarget::Jump() { | 40 void JumpTarget::DoJump() { |
41 ASSERT(cgen_ != NULL); | 41 ASSERT(cgen_ != NULL); |
42 ASSERT(cgen_->has_valid_frame()); | 42 ASSERT(cgen_->has_valid_frame()); |
43 // Live non-frame registers are not allowed at unconditional jumps | 43 // Live non-frame registers are not allowed at unconditional jumps |
44 // because we have no way of invalidating the corresponding results | 44 // because we have no way of invalidating the corresponding results |
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 // Forward jump. The current frame is added to the end of the list | 55 // 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 | 56 // of frames reaching the target block and a jump to the merge code |
57 // is emitted. | 57 // is emitted. |
58 AddReachingFrame(cgen_->frame()); | 58 AddReachingFrame(cgen_->frame()); |
59 RegisterFile empty; | 59 RegisterFile empty; |
60 cgen_->SetFrame(NULL, &empty); | 60 cgen_->SetFrame(NULL, &empty); |
61 __ jmp(&merge_labels_.last()); | 61 __ jmp(&merge_labels_.last()); |
62 } | 62 } |
63 | 63 |
64 is_linked_ = !is_bound_; | 64 is_linked_ = !is_bound_; |
65 } | 65 } |
66 | 66 |
67 | 67 |
68 void JumpTarget::Branch(Condition cc, Hint hint) { | 68 void JumpTarget::DoBranch(Condition cc, Hint hint) { |
69 ASSERT(cgen_ != NULL); | 69 ASSERT(cgen_ != NULL); |
70 ASSERT(cgen_->has_valid_frame()); | 70 ASSERT(cgen_->has_valid_frame()); |
71 | 71 |
72 if (is_bound()) { | 72 if (is_bound()) { |
73 ASSERT(direction_ == BIDIRECTIONAL); | 73 ASSERT(direction_ == BIDIRECTIONAL); |
74 // Backward branch. We have an expected frame to merge to on the | 74 // Backward branch. We have an expected frame to merge to on the |
75 // backward edge. | 75 // backward edge. |
76 | 76 |
77 // Swap the current frame for a copy (we do the swapping to get | 77 // Swap the current frame for a copy (we do the swapping to get |
78 // the off-frame registers off the fall through) to use for the | 78 // the off-frame registers off the fall through) to use for the |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 cgen_->frame()->SpillAll(); | 141 cgen_->frame()->SpillAll(); |
142 VirtualFrame* target_frame = new VirtualFrame(cgen_->frame()); | 142 VirtualFrame* target_frame = new VirtualFrame(cgen_->frame()); |
143 target_frame->Adjust(1); | 143 target_frame->Adjust(1); |
144 AddReachingFrame(target_frame); | 144 AddReachingFrame(target_frame); |
145 __ call(&merge_labels_.last()); | 145 __ call(&merge_labels_.last()); |
146 | 146 |
147 is_linked_ = !is_bound_; | 147 is_linked_ = !is_bound_; |
148 } | 148 } |
149 | 149 |
150 | 150 |
151 void JumpTarget::Bind(int mergable_elements) { | 151 void JumpTarget::DoBind(int mergable_elements) { |
152 ASSERT(cgen_ != NULL); | 152 ASSERT(cgen_ != NULL); |
153 ASSERT(!is_bound()); | 153 ASSERT(!is_bound()); |
154 | 154 |
155 // Live non-frame registers are not allowed at the start of a basic | 155 // Live non-frame registers are not allowed at the start of a basic |
156 // block. | 156 // block. |
157 ASSERT(!cgen_->has_valid_frame() || cgen_->HasValidEntryRegisters()); | 157 ASSERT(!cgen_->has_valid_frame() || cgen_->HasValidEntryRegisters()); |
158 | 158 |
159 if (direction_ == FORWARD_ONLY) { | 159 if (direction_ == FORWARD_ONLY) { |
160 // A simple case: no forward jumps and no possible backward jumps. | 160 // A simple case: no forward jumps and no possible backward jumps. |
161 if (!is_linked()) { | 161 if (!is_linked()) { |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 } | 326 } |
327 | 327 |
328 is_linked_ = false; | 328 is_linked_ = false; |
329 is_bound_ = true; | 329 is_bound_ = true; |
330 } | 330 } |
331 | 331 |
332 #undef __ | 332 #undef __ |
333 | 333 |
334 | 334 |
335 } } // namespace v8::internal | 335 } } // namespace v8::internal |
OLD | NEW |