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

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

Issue 1952633002: [full-codegen] Introduce NestedStatement subclass for class literals. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: More tests Created 4 years, 7 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
« no previous file with comments | « no previous file | src/full-codegen/full-codegen.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_FULL_CODEGEN_FULL_CODEGEN_H_ 5 #ifndef V8_FULL_CODEGEN_FULL_CODEGEN_H_
6 #define V8_FULL_CODEGEN_FULL_CODEGEN_H_ 6 #define V8_FULL_CODEGEN_FULL_CODEGEN_H_
7 7
8 #include "src/allocation.h" 8 #include "src/allocation.h"
9 #include "src/assert-scope.h" 9 #include "src/assert-scope.h"
10 #include "src/ast/ast.h" 10 #include "src/ast/ast.h"
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 204
205 NestedStatement* Exit(int* context_length) override { 205 NestedStatement* Exit(int* context_length) override {
206 auto block_scope = statement()->AsBlock()->scope(); 206 auto block_scope = statement()->AsBlock()->scope();
207 if (block_scope != nullptr) { 207 if (block_scope != nullptr) {
208 if (block_scope->ContextLocalCount() > 0) ++(*context_length); 208 if (block_scope->ContextLocalCount() > 0) ++(*context_length);
209 } 209 }
210 return previous_; 210 return previous_;
211 } 211 }
212 }; 212 };
213 213
214 // A class literal expression
215 class NestedClassLiteral : public NestedStatement {
216 public:
217 NestedClassLiteral(FullCodeGenerator* codegen, ClassLiteral* lit)
218 : NestedStatement(codegen),
219 needs_context_(lit->scope() != nullptr &&
220 lit->scope()->NeedsContext()) {}
221
222 NestedStatement* Exit(int* context_length) override {
223 if (needs_context_) ++(*context_length);
224 return previous_;
225 }
226
227 private:
228 const bool needs_context_;
229 };
230
214 class DeferredCommands { 231 class DeferredCommands {
215 public: 232 public:
216 enum Command { kReturn, kThrow, kBreak, kContinue }; 233 enum Command { kReturn, kThrow, kBreak, kContinue };
217 typedef int TokenId; 234 typedef int TokenId;
218 struct DeferredCommand { 235 struct DeferredCommand {
219 Command command; 236 Command command;
220 TokenId token; 237 TokenId token;
221 Statement* target; 238 Statement* target;
222 }; 239 };
223 240
(...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after
1055 Address start_; 1072 Address start_;
1056 Address instruction_start_; 1073 Address instruction_start_;
1057 uint32_t length_; 1074 uint32_t length_;
1058 }; 1075 };
1059 1076
1060 1077
1061 } // namespace internal 1078 } // namespace internal
1062 } // namespace v8 1079 } // namespace v8
1063 1080
1064 #endif // V8_FULL_CODEGEN_FULL_CODEGEN_H_ 1081 #endif // V8_FULL_CODEGEN_FULL_CODEGEN_H_
OLDNEW
« no previous file with comments | « no previous file | src/full-codegen/full-codegen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698