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

Side by Side Diff: src/full-codegen.h

Issue 7792100: Simplfy handling of exits from scoped blocks. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 3 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 | « no previous file | src/full-codegen.cc » ('j') | src/parser.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 virtual bool IsContinueTarget(Statement* target) { 184 virtual bool IsContinueTarget(Statement* target) {
185 return statement() == target; 185 return statement() == target;
186 } 186 }
187 187
188 Label* continue_label() { return &continue_label_; } 188 Label* continue_label() { return &continue_label_; }
189 189
190 private: 190 private:
191 Label continue_label_; 191 Label continue_label_;
192 }; 192 };
193 193
194 // A nested block statement.
195 class NestedBlock : public Breakable {
196 public:
197 explicit NestedBlock(FullCodeGenerator* codegen, Block* block)
Kevin Millikin (Chromium) 2011/09/02 15:17:44 No need for explicit for two argument constructors
Steven 2011/09/05 08:54:50 Done.
198 : Breakable(codegen, block), block_(block) {
199 }
200 virtual ~NestedBlock() {}
201
202 virtual NestedStatement* Exit(int* stack_depth, int* context_length) {
203 if (block_->block_scope() != NULL) {
204 ++(*context_length);
205 }
206 return previous_;
207 };
208 private:
209 Block* block_;
Kevin Millikin (Chromium) 2011/09/02 15:17:44 This class doesn't need to store the block since t
Steven 2011/09/05 08:54:50 Done.
210 };
211
194 // The try block of a try/catch statement. 212 // The try block of a try/catch statement.
195 class TryCatch : public NestedStatement { 213 class TryCatch : public NestedStatement {
196 public: 214 public:
197 explicit TryCatch(FullCodeGenerator* codegen) : NestedStatement(codegen) { 215 explicit TryCatch(FullCodeGenerator* codegen) : NestedStatement(codegen) {
198 } 216 }
199 virtual ~TryCatch() {} 217 virtual ~TryCatch() {}
200 218
201 virtual NestedStatement* Exit(int* stack_depth, int* context_length); 219 virtual NestedStatement* Exit(int* stack_depth, int* context_length);
202 }; 220 };
203 221
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after
804 822
805 friend class NestedStatement; 823 friend class NestedStatement;
806 824
807 DISALLOW_COPY_AND_ASSIGN(FullCodeGenerator); 825 DISALLOW_COPY_AND_ASSIGN(FullCodeGenerator);
808 }; 826 };
809 827
810 828
811 } } // namespace v8::internal 829 } } // namespace v8::internal
812 830
813 #endif // V8_FULL_CODEGEN_H_ 831 #endif // V8_FULL_CODEGEN_H_
OLDNEW
« no previous file with comments | « no previous file | src/full-codegen.cc » ('j') | src/parser.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698