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

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

Issue 397010: A start on allowing non-local control flow, for exceptions, try-finally, and ... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 1 month 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/fast-codegen.h ('k') | src/x64/fast-codegen-x64.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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 177
178 // ------------------------------------------------------------------------- 178 // -------------------------------------------------------------------------
179 // Break targets 179 // Break targets
180 // 180 //
181 // 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
182 // 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
183 // try/finally). They know the expected stack height at the target 183 // try/finally). They know the expected stack height at the target
184 // and will drop state from nested statements as part of merging. 184 // and will drop state from nested statements as part of merging.
185 // 185 //
186 // Break targets are used for return, break, and continue targets. 186 // Break targets are used for return, break, and continue targets.
187 //
188 // The fast compiler needs a similar object, containing a Label and
189 // the stack height. Since the parser already creates break targets
190 // at all the appropriate sites, and creates the necessary links from
191 // the AST to the break targets, we add an interface to break targets that
192 // simply exposes the stack height and their underlying label, for use
193 // in the fast compiler.
194
187 195
188 class BreakTarget : public JumpTarget { 196 class BreakTarget : public JumpTarget {
189 public: 197 public:
190 // Construct a break target. 198 // Construct a break target.
191 BreakTarget() {} 199 BreakTarget() {}
192 200
193 virtual ~BreakTarget() {} 201 virtual ~BreakTarget() {}
194 202
195 // Set the direction of the break target. 203 // Set the direction of the break target.
196 virtual void set_direction(Directionality direction); 204 virtual void set_direction(Directionality direction);
(...skipping 18 matching lines...) Expand all
215 223
216 // Bind a break target. If there is no current frame at the binding 224 // Bind a break target. If there is no current frame at the binding
217 // site, there must be at least one frame reaching via a forward 225 // site, there must be at least one frame reaching via a forward
218 // jump. 226 // jump.
219 virtual void Bind(); 227 virtual void Bind();
220 virtual void Bind(Result* arg); 228 virtual void Bind(Result* arg);
221 229
222 // Setter for expected height. 230 // Setter for expected height.
223 void set_expected_height(int expected) { expected_height_ = expected; } 231 void set_expected_height(int expected) { expected_height_ = expected; }
224 232
233 // Added interface for the fast compiler:
234 int expected_height() { return expected_height_; }
235 // Label* entry_label() is already declared public in JumpTarget.
225 private: 236 private:
226 // The expected height of the expression stack where the target will 237 // The expected height of the expression stack where the target will
227 // be bound, statically known at initialization time. 238 // be bound, statically known at initialization time.
228 int expected_height_; 239 int expected_height_;
229 240
230 DISALLOW_COPY_AND_ASSIGN(BreakTarget); 241 DISALLOW_COPY_AND_ASSIGN(BreakTarget);
231 }; 242 };
232 243
233 244
234 // ------------------------------------------------------------------------- 245 // -------------------------------------------------------------------------
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 bool is_shadowing_; 281 bool is_shadowing_;
271 #endif 282 #endif
272 283
273 DISALLOW_COPY_AND_ASSIGN(ShadowTarget); 284 DISALLOW_COPY_AND_ASSIGN(ShadowTarget);
274 }; 285 };
275 286
276 287
277 } } // namespace v8::internal 288 } } // namespace v8::internal
278 289
279 #endif // V8_JUMP_TARGET_H_ 290 #endif // V8_JUMP_TARGET_H_
OLDNEW
« no previous file with comments | « src/fast-codegen.h ('k') | src/x64/fast-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698