OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #ifndef VM_KERNEL_TO_IL_H_ | 5 #ifndef VM_KERNEL_TO_IL_H_ |
6 #define VM_KERNEL_TO_IL_H_ | 6 #define VM_KERNEL_TO_IL_H_ |
7 | 7 |
8 #include "vm/growable_array.h" | 8 #include "vm/growable_array.h" |
9 #include "vm/hash_map.h" | 9 #include "vm/hash_map.h" |
10 | 10 |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 | 375 |
376 | 376 |
377 struct FunctionScope { | 377 struct FunctionScope { |
378 FunctionNode* function; | 378 FunctionNode* function; |
379 LocalScope* scope; | 379 LocalScope* scope; |
380 }; | 380 }; |
381 | 381 |
382 | 382 |
383 class ScopeBuildingResult : public ZoneAllocated { | 383 class ScopeBuildingResult : public ZoneAllocated { |
384 public: | 384 public: |
| 385 ScopeBuildingResult() |
| 386 : this_variable(NULL), |
| 387 type_arguments_variable(NULL), |
| 388 switch_variable(NULL), |
| 389 finally_return_variable(NULL), |
| 390 setter_value(NULL), |
| 391 yield_jump_variable(NULL), |
| 392 yield_context_variable(NULL) {} |
| 393 |
385 Map<VariableDeclaration, LocalVariable*> locals; | 394 Map<VariableDeclaration, LocalVariable*> locals; |
386 Map<TreeNode, LocalScope*> scopes; | 395 Map<TreeNode, LocalScope*> scopes; |
387 GrowableArray<FunctionScope> function_scopes; | 396 GrowableArray<FunctionScope> function_scopes; |
388 | 397 |
389 // Only non-NULL for instance functions. | 398 // Only non-NULL for instance functions. |
390 LocalVariable* this_variable = NULL; | 399 LocalVariable* this_variable; |
391 | 400 |
392 // Only non-NULL for factory constructor functions. | 401 // Only non-NULL for factory constructor functions. |
393 LocalVariable* type_arguments_variable = NULL; | 402 LocalVariable* type_arguments_variable; |
394 | 403 |
395 // Non-NULL when the function contains a switch statement. | 404 // Non-NULL when the function contains a switch statement. |
396 LocalVariable* switch_variable = NULL; | 405 LocalVariable* switch_variable; |
397 | 406 |
398 // Non-NULL when the function contains a return inside a finally block. | 407 // Non-NULL when the function contains a return inside a finally block. |
399 LocalVariable* finally_return_variable = NULL; | 408 LocalVariable* finally_return_variable; |
400 | 409 |
401 // Non-NULL when the function is a setter. | 410 // Non-NULL when the function is a setter. |
402 LocalVariable* setter_value = NULL; | 411 LocalVariable* setter_value; |
403 | 412 |
404 // Non-NULL if the function contains yield statement. | 413 // Non-NULL if the function contains yield statement. |
405 // TODO(27590) actual variable is called :await_jump_var, we should rename | 414 // TODO(27590) actual variable is called :await_jump_var, we should rename |
406 // it to reflect the fact that it is used for both await and yield. | 415 // it to reflect the fact that it is used for both await and yield. |
407 LocalVariable* yield_jump_variable = NULL; | 416 LocalVariable* yield_jump_variable; |
408 | 417 |
409 // Non-NULL if the function contains yield statement. | 418 // Non-NULL if the function contains yield statement. |
410 // TODO(27590) actual variable is called :await_ctx_var, we should rename | 419 // TODO(27590) actual variable is called :await_ctx_var, we should rename |
411 // it to reflect the fact that it is used for both await and yield. | 420 // it to reflect the fact that it is used for both await and yield. |
412 LocalVariable* yield_context_variable = NULL; | 421 LocalVariable* yield_context_variable; |
413 | 422 |
414 // Variables used in exception handlers, one per exception handler nesting | 423 // Variables used in exception handlers, one per exception handler nesting |
415 // level. | 424 // level. |
416 GrowableArray<LocalVariable*> exception_variables; | 425 GrowableArray<LocalVariable*> exception_variables; |
417 GrowableArray<LocalVariable*> stack_trace_variables; | 426 GrowableArray<LocalVariable*> stack_trace_variables; |
418 GrowableArray<LocalVariable*> catch_context_variables; | 427 GrowableArray<LocalVariable*> catch_context_variables; |
419 | 428 |
420 // For-in iterators, one per for-in nesting level. | 429 // For-in iterators, one per for-in nesting level. |
421 GrowableArray<LocalVariable*> iterator_variables; | 430 GrowableArray<LocalVariable*> iterator_variables; |
422 }; | 431 }; |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
821 friend class SwitchBlock; | 830 friend class SwitchBlock; |
822 friend class TryCatchBlock; | 831 friend class TryCatchBlock; |
823 friend class TryFinallyBlock; | 832 friend class TryFinallyBlock; |
824 }; | 833 }; |
825 | 834 |
826 } // namespace kernel | 835 } // namespace kernel |
827 } // namespace dart | 836 } // namespace dart |
828 | 837 |
829 | 838 |
830 #endif // VM_KERNEL_TO_IL_H_ | 839 #endif // VM_KERNEL_TO_IL_H_ |
OLD | NEW |