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

Side by Side Diff: src/ast.h

Issue 42017: Fix issue 265 by handling extra statement state on the frame based on... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 9 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/assembler-ia32.h ('k') | src/codegen-arm.h » ('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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 // The labels associated with this statement. May be NULL; 195 // The labels associated with this statement. May be NULL;
196 // if it is != NULL, guaranteed to contain at least one entry. 196 // if it is != NULL, guaranteed to contain at least one entry.
197 ZoneStringList* labels() const { return labels_; } 197 ZoneStringList* labels() const { return labels_; }
198 198
199 // Type testing & conversion. 199 // Type testing & conversion.
200 virtual BreakableStatement* AsBreakableStatement() { return this; } 200 virtual BreakableStatement* AsBreakableStatement() { return this; }
201 201
202 // Code generation 202 // Code generation
203 BreakTarget* break_target() { return &break_target_; } 203 BreakTarget* break_target() { return &break_target_; }
204 204
205 // Used during code generation for restoring the stack when a
206 // break/continue crosses a statement that keeps stuff on the stack.
207 int break_stack_height() { return break_stack_height_; }
208 void set_break_stack_height(int height) { break_stack_height_ = height; }
209
210 // Testers. 205 // Testers.
211 bool is_target_for_anonymous() const { return type_ == TARGET_FOR_ANONYMOUS; } 206 bool is_target_for_anonymous() const { return type_ == TARGET_FOR_ANONYMOUS; }
212 207
213 protected: 208 protected:
214 BreakableStatement(ZoneStringList* labels, Type type) 209 BreakableStatement(ZoneStringList* labels, Type type)
215 : labels_(labels), type_(type) { 210 : labels_(labels), type_(type) {
216 ASSERT(labels == NULL || labels->length() > 0); 211 ASSERT(labels == NULL || labels->length() > 0);
217 } 212 }
218 213
219 private: 214 private:
220 ZoneStringList* labels_; 215 ZoneStringList* labels_;
221 Type type_; 216 Type type_;
222 BreakTarget break_target_; 217 BreakTarget break_target_;
223 int break_stack_height_;
224 }; 218 };
225 219
226 220
227 class Block: public BreakableStatement { 221 class Block: public BreakableStatement {
228 public: 222 public:
229 Block(ZoneStringList* labels, int capacity, bool is_initializer_block) 223 Block(ZoneStringList* labels, int capacity, bool is_initializer_block)
230 : BreakableStatement(labels, TARGET_FOR_NAMED_ONLY), 224 : BreakableStatement(labels, TARGET_FOR_NAMED_ONLY),
231 statements_(capacity), 225 statements_(capacity),
232 is_initializer_block_(is_initializer_block) { } 226 is_initializer_block_(is_initializer_block) { }
233 227
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 class CaseClause: public ZoneObject { 438 class CaseClause: public ZoneObject {
445 public: 439 public:
446 CaseClause(Expression* label, ZoneList<Statement*>* statements) 440 CaseClause(Expression* label, ZoneList<Statement*>* statements)
447 : label_(label), statements_(statements) { } 441 : label_(label), statements_(statements) { }
448 442
449 bool is_default() const { return label_ == NULL; } 443 bool is_default() const { return label_ == NULL; }
450 Expression* label() const { 444 Expression* label() const {
451 CHECK(!is_default()); 445 CHECK(!is_default());
452 return label_; 446 return label_;
453 } 447 }
454 BreakTarget* body_target() { return &body_target_; } 448 JumpTarget* body_target() { return &body_target_; }
455 ZoneList<Statement*>* statements() const { return statements_; } 449 ZoneList<Statement*>* statements() const { return statements_; }
456 450
457 private: 451 private:
458 Expression* label_; 452 Expression* label_;
459 BreakTarget body_target_; 453 JumpTarget body_target_;
460 ZoneList<Statement*>* statements_; 454 ZoneList<Statement*>* statements_;
461 }; 455 };
462 456
463 457
464 class SwitchStatement: public BreakableStatement { 458 class SwitchStatement: public BreakableStatement {
465 public: 459 public:
466 explicit SwitchStatement(ZoneStringList* labels) 460 explicit SwitchStatement(ZoneStringList* labels)
467 : BreakableStatement(labels, TARGET_FOR_ANONYMOUS), 461 : BreakableStatement(labels, TARGET_FOR_ANONYMOUS),
468 tag_(NULL), cases_(NULL) { } 462 tag_(NULL), cases_(NULL) { }
469 463
(...skipping 1213 matching lines...) Expand 10 before | Expand all | Expand 10 after
1683 #undef DEF_VISIT 1677 #undef DEF_VISIT
1684 1678
1685 private: 1679 private:
1686 bool stack_overflow_; 1680 bool stack_overflow_;
1687 }; 1681 };
1688 1682
1689 1683
1690 } } // namespace v8::internal 1684 } } // namespace v8::internal
1691 1685
1692 #endif // V8_AST_H_ 1686 #endif // V8_AST_H_
OLDNEW
« no previous file with comments | « src/assembler-ia32.h ('k') | src/codegen-arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698