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

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

Issue 2176653003: Wrap ClassLiterals in DoExpressions instead of giving them BlockScopes. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: address comments Created 4 years, 4 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 | « src/compiler/ast-graph-builder.cc ('k') | 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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 194
195 NestedStatement* Exit(int* context_length) override { 195 NestedStatement* Exit(int* context_length) override {
196 auto block_scope = statement()->AsBlock()->scope(); 196 auto block_scope = statement()->AsBlock()->scope();
197 if (block_scope != nullptr) { 197 if (block_scope != nullptr) {
198 if (block_scope->ContextLocalCount() > 0) ++(*context_length); 198 if (block_scope->ContextLocalCount() > 0) ++(*context_length);
199 } 199 }
200 return previous_; 200 return previous_;
201 } 201 }
202 }; 202 };
203 203
204 // A class literal expression
205 class NestedClassLiteral : public NestedStatement {
206 public:
207 NestedClassLiteral(FullCodeGenerator* codegen, ClassLiteral* lit)
208 : NestedStatement(codegen),
209 needs_context_(lit->scope() != nullptr &&
210 lit->scope()->NeedsContext()) {}
211
212 NestedStatement* Exit(int* context_length) override {
213 if (needs_context_) ++(*context_length);
214 return previous_;
215 }
216
217 private:
218 const bool needs_context_;
219 };
220
221 class DeferredCommands { 204 class DeferredCommands {
222 public: 205 public:
223 enum Command { kReturn, kThrow, kBreak, kContinue }; 206 enum Command { kReturn, kThrow, kBreak, kContinue };
224 typedef int TokenId; 207 typedef int TokenId;
225 struct DeferredCommand { 208 struct DeferredCommand {
226 Command command; 209 Command command;
227 TokenId token; 210 TokenId token;
228 Statement* target; 211 Statement* target;
229 }; 212 };
230 213
(...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after
1055 Address start_; 1038 Address start_;
1056 Address instruction_start_; 1039 Address instruction_start_;
1057 uint32_t length_; 1040 uint32_t length_;
1058 }; 1041 };
1059 1042
1060 1043
1061 } // namespace internal 1044 } // namespace internal
1062 } // namespace v8 1045 } // namespace v8
1063 1046
1064 #endif // V8_FULL_CODEGEN_FULL_CODEGEN_H_ 1047 #endif // V8_FULL_CODEGEN_FULL_CODEGEN_H_
OLDNEW
« no previous file with comments | « src/compiler/ast-graph-builder.cc ('k') | src/full-codegen/full-codegen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698