Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(820)

Side by Side Diff: src/jump-target.h

Issue 125045: First round of JumpTarget simplification. Remove dead functions... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/ia32/virtual-frame-ia32.cc ('k') | src/jump-target.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 } 100 }
101 bool is_unused() const { 101 bool is_unused() const {
102 // This is !is_bound() && !is_linked(). 102 // This is !is_bound() && !is_linked().
103 return !is_bound() && reaching_frames_.is_empty(); 103 return !is_bound() && reaching_frames_.is_empty();
104 } 104 }
105 105
106 // Emit a jump to the target. There must be a current frame at the 106 // Emit a jump to the target. There must be a current frame at the
107 // jump and there will be no current frame after the jump. 107 // jump and there will be no current frame after the jump.
108 virtual void Jump(); 108 virtual void Jump();
109 virtual void Jump(Result* arg); 109 virtual void Jump(Result* arg);
110 void Jump(Result* arg0, Result* arg1);
111 void Jump(Result* arg0, Result* arg1, Result* arg2);
112 110
113 // Emit a conditional branch to the target. There must be a current 111 // Emit a conditional branch to the target. There must be a current
114 // frame at the branch. The current frame will fall through to the 112 // frame at the branch. The current frame will fall through to the
115 // code after the branch. 113 // code after the branch.
116 virtual void Branch(Condition cc, Hint hint = no_hint); 114 virtual void Branch(Condition cc, Hint hint = no_hint);
117 virtual void Branch(Condition cc, Result* arg, Hint hint = no_hint); 115 virtual void Branch(Condition cc, Result* arg, Hint hint = no_hint);
118 void Branch(Condition cc, Result* arg0, Result* arg1, Hint hint = no_hint); 116 void Branch(Condition cc, Result* arg0, Result* arg1, Hint hint = no_hint);
119 void Branch(Condition cc,
120 Result* arg0,
121 Result* arg1,
122 Result* arg2,
123 Hint hint = no_hint);
124 void Branch(Condition cc,
125 Result* arg0,
126 Result* arg1,
127 Result* arg2,
128 Result* arg3,
129 Hint hint = no_hint);
130 117
131 // Bind a jump target. If there is no current frame at the binding 118 // Bind a jump target. If there is no current frame at the binding
132 // site, there must be at least one frame reaching via a forward 119 // site, there must be at least one frame reaching via a forward
133 // jump. 120 // jump.
134 // 121 virtual void Bind();
135 // The number of mergable elements is a number of frame elements 122 virtual void Bind(Result* arg);
136 // counting from the top down which must be "mergable" (not 123 void Bind(Result* arg0, Result* arg1);
137 // constants or copies) in the entry frame at the jump target.
138 // Backward jumps to the target must contain the same constants and
139 // sharing as the entry frame, except for the mergable elements.
140 //
141 // A mergable elements argument of kAllElements indicates that all
142 // frame elements must be mergable. Mergable elements are ignored
143 // completely for forward-only jump targets.
144 virtual void Bind(int mergable_elements = kAllElements);
145 virtual void Bind(Result* arg, int mergable_elements = kAllElements);
146 void Bind(Result* arg0, Result* arg1, int mergable_elements = kAllElements);
147 void Bind(Result* arg0,
148 Result* arg1,
149 Result* arg2,
150 int mergable_elements = kAllElements);
151 void Bind(Result* arg0,
152 Result* arg1,
153 Result* arg2,
154 Result* arg3,
155 int mergable_elements = kAllElements);
156 124
157 // Emit a call to a jump target. There must be a current frame at 125 // Emit a call to a jump target. There must be a current frame at
158 // the call. The frame at the target is the same as the current 126 // the call. The frame at the target is the same as the current
159 // frame except for an extra return address on top of it. The frame 127 // frame except for an extra return address on top of it. The frame
160 // after the call is the same as the frame before the call. 128 // after the call is the same as the frame before the call.
161 void Call(); 129 void Call();
162 130
163 static const int kAllElements = -1; // Not a valid number of elements.
164
165 static void set_compiling_deferred_code(bool flag) { 131 static void set_compiling_deferred_code(bool flag) {
166 compiling_deferred_code_ = flag; 132 compiling_deferred_code_ = flag;
167 } 133 }
168 134
169 protected: 135 protected:
170 // Directionality flag set at initialization time. 136 // Directionality flag set at initialization time.
171 Directionality direction_; 137 Directionality direction_;
172 138
173 // A list of frames reaching this block via forward jumps. 139 // A list of frames reaching this block via forward jumps.
174 ZoneList<VirtualFrame*> reaching_frames_; 140 ZoneList<VirtualFrame*> reaching_frames_;
175 141
176 // A parallel list of labels for merge code. 142 // A parallel list of labels for merge code.
177 ZoneList<Label> merge_labels_; 143 ZoneList<Label> merge_labels_;
178 144
179 // The frame used on entry to the block and expected at backward 145 // The frame used on entry to the block and expected at backward
180 // jumps to the block. Set when the jump target is bound, but may 146 // jumps to the block. Set when the jump target is bound, but may
181 // or may not be set for forward-only blocks. 147 // or may not be set for forward-only blocks.
182 VirtualFrame* entry_frame_; 148 VirtualFrame* entry_frame_;
183 149
184 // The actual entry label of the block. 150 // The actual entry label of the block.
185 Label entry_label_; 151 Label entry_label_;
186 152
187 // Implementations of Jump, Branch, and Bind with all arguments and 153 // Implementations of Jump, Branch, and Bind with all arguments and
188 // return values using the virtual frame. 154 // return values using the virtual frame.
189 void DoJump(); 155 void DoJump();
190 void DoBranch(Condition cc, Hint hint); 156 void DoBranch(Condition cc, Hint hint);
191 void DoBind(int mergable_elements); 157 void DoBind();
192 158
193 private: 159 private:
194 static bool compiling_deferred_code_; 160 static bool compiling_deferred_code_;
195 161
196 // Add a virtual frame reaching this labeled block via a forward jump, 162 // Add a virtual frame reaching this labeled block via a forward jump,
197 // and a corresponding merge code label. 163 // and a corresponding merge code label.
198 void AddReachingFrame(VirtualFrame* frame); 164 void AddReachingFrame(VirtualFrame* frame);
199 165
200 // Perform initialization required during entry frame computation 166 // Perform initialization required during entry frame computation
201 // after setting the virtual frame element at index in frame to be 167 // after setting the virtual frame element at index in frame to be
202 // target. 168 // target.
203 inline void InitializeEntryElement(int index, FrameElement* target); 169 inline void InitializeEntryElement(int index, FrameElement* target);
204 170
205 // Compute a frame to use for entry to this block. Mergable 171 // Compute a frame to use for entry to this block.
206 // elements is as described for the Bind function. 172 void ComputeEntryFrame();
207 void ComputeEntryFrame(int mergable_elements);
208 173
209 DISALLOW_COPY_AND_ASSIGN(JumpTarget); 174 DISALLOW_COPY_AND_ASSIGN(JumpTarget);
210 }; 175 };
211 176
212 177
213 // ------------------------------------------------------------------------- 178 // -------------------------------------------------------------------------
214 // Break targets 179 // Break targets
215 // 180 //
216 // A break target is a jump target that can be used to break out of a 181 // A break target is a jump target that can be used to break out of a
217 // statement that keeps extra state on the stack (eg, for/in or 182 // statement that keeps extra state on the stack (eg, for/in or
(...skipping 26 matching lines...) Expand all
244 209
245 // Emit a conditional branch to the target. There must be a current 210 // Emit a conditional branch to the target. There must be a current
246 // frame at the branch. The current frame will fall through to the 211 // frame at the branch. The current frame will fall through to the
247 // code after the branch. 212 // code after the branch.
248 virtual void Branch(Condition cc, Hint hint = no_hint); 213 virtual void Branch(Condition cc, Hint hint = no_hint);
249 virtual void Branch(Condition cc, Result* arg, Hint hint = no_hint); 214 virtual void Branch(Condition cc, Result* arg, Hint hint = no_hint);
250 215
251 // Bind a break target. If there is no current frame at the binding 216 // Bind a break target. If there is no current frame at the binding
252 // site, there must be at least one frame reaching via a forward 217 // site, there must be at least one frame reaching via a forward
253 // jump. 218 // jump.
254 virtual void Bind(int mergable_elements = kAllElements); 219 virtual void Bind();
255 virtual void Bind(Result* arg, int mergable_elements = kAllElements); 220 virtual void Bind(Result* arg);
256 221
257 // Setter for expected height. 222 // Setter for expected height.
258 void set_expected_height(int expected) { expected_height_ = expected; } 223 void set_expected_height(int expected) { expected_height_ = expected; }
259 224
260 private: 225 private:
261 // The expected height of the expression stack where the target will 226 // The expected height of the expression stack where the target will
262 // be bound, statically known at initialization time. 227 // be bound, statically known at initialization time.
263 int expected_height_; 228 int expected_height_;
264 229
265 DISALLOW_COPY_AND_ASSIGN(BreakTarget); 230 DISALLOW_COPY_AND_ASSIGN(BreakTarget);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 bool is_shadowing_; 270 bool is_shadowing_;
306 #endif 271 #endif
307 272
308 DISALLOW_COPY_AND_ASSIGN(ShadowTarget); 273 DISALLOW_COPY_AND_ASSIGN(ShadowTarget);
309 }; 274 };
310 275
311 276
312 } } // namespace v8::internal 277 } } // namespace v8::internal
313 278
314 #endif // V8_JUMP_TARGET_H_ 279 #endif // V8_JUMP_TARGET_H_
OLDNEW
« no previous file with comments | « src/ia32/virtual-frame-ia32.cc ('k') | src/jump-target.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698