| OLD | NEW |
| 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 Loading... |
| 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 |
| 204 class DeferredCommands { | 221 class DeferredCommands { |
| 205 public: | 222 public: |
| 206 enum Command { kReturn, kThrow, kBreak, kContinue }; | 223 enum Command { kReturn, kThrow, kBreak, kContinue }; |
| 207 typedef int TokenId; | 224 typedef int TokenId; |
| 208 struct DeferredCommand { | 225 struct DeferredCommand { |
| 209 Command command; | 226 Command command; |
| 210 TokenId token; | 227 TokenId token; |
| 211 Statement* target; | 228 Statement* target; |
| 212 }; | 229 }; |
| 213 | 230 |
| (...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1038 Address start_; | 1055 Address start_; |
| 1039 Address instruction_start_; | 1056 Address instruction_start_; |
| 1040 uint32_t length_; | 1057 uint32_t length_; |
| 1041 }; | 1058 }; |
| 1042 | 1059 |
| 1043 | 1060 |
| 1044 } // namespace internal | 1061 } // namespace internal |
| 1045 } // namespace v8 | 1062 } // namespace v8 |
| 1046 | 1063 |
| 1047 #endif // V8_FULL_CODEGEN_FULL_CODEGEN_H_ | 1064 #endif // V8_FULL_CODEGEN_FULL_CODEGEN_H_ |
| OLD | NEW |