| 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 RUNTIME_VM_KERNEL_TO_IL_H_ | 5 #ifndef RUNTIME_VM_KERNEL_TO_IL_H_ |
| 6 #define RUNTIME_VM_KERNEL_TO_IL_H_ | 6 #define RUNTIME_VM_KERNEL_TO_IL_H_ |
| 7 | 7 |
| 8 #if !defined(DART_PRECOMPILED_RUNTIME) | 8 #if !defined(DART_PRECOMPILED_RUNTIME) |
| 9 | 9 |
| 10 #include "vm/growable_array.h" | 10 #include "vm/growable_array.h" |
| (...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 | 467 |
| 468 const Object& RunFunction(const Function& function, | 468 const Object& RunFunction(const Function& function, |
| 469 const Array& arguments, | 469 const Array& arguments, |
| 470 const Array& names); | 470 const Array& names); |
| 471 | 471 |
| 472 RawObject* EvaluateConstConstructorCall(const dart::Class& type_class, | 472 RawObject* EvaluateConstConstructorCall(const dart::Class& type_class, |
| 473 const TypeArguments& type_arguments, | 473 const TypeArguments& type_arguments, |
| 474 const Function& constructor, | 474 const Function& constructor, |
| 475 const Object& argument); | 475 const Object& argument); |
| 476 | 476 |
| 477 void AssertBoolInCheckedMode() { |
| 478 if (isolate_->type_checks() && !result_.IsBool()) { |
| 479 translation_helper_.ReportError("Expected boolean expression."); |
| 480 } |
| 481 } |
| 482 |
| 483 bool EvaluateBooleanExpression(Expression* expression) { |
| 484 EvaluateExpression(expression); |
| 485 AssertBoolInCheckedMode(); |
| 486 return result_.raw() == Bool::True().raw(); |
| 487 } |
| 488 |
| 477 // TODO(27590): Instead of using [dart::kernel::TreeNode]s as keys we | 489 // TODO(27590): Instead of using [dart::kernel::TreeNode]s as keys we |
| 478 // should use [TokenPosition]s as well as the existing functionality in | 490 // should use [TokenPosition]s as well as the existing functionality in |
| 479 // `Parser::CacheConstantValue`. | 491 // `Parser::CacheConstantValue`. |
| 480 bool GetCachedConstant(TreeNode* node, Instance* value); | 492 bool GetCachedConstant(TreeNode* node, Instance* value); |
| 481 void CacheConstantValue(TreeNode* node, const Instance& value); | 493 void CacheConstantValue(TreeNode* node, const Instance& value); |
| 482 | 494 |
| 483 FlowGraphBuilder* builder_; | 495 FlowGraphBuilder* builder_; |
| 484 Isolate* isolate_; | 496 Isolate* isolate_; |
| 485 Zone* zone_; | 497 Zone* zone_; |
| 486 TranslationHelper& translation_helper_; | 498 TranslationHelper& translation_helper_; |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 621 // captured variable. | 633 // captured variable. |
| 622 void LookupVariable(VariableDeclaration* declaration); | 634 void LookupVariable(VariableDeclaration* declaration); |
| 623 | 635 |
| 624 const dart::String& GenerateName(const char* prefix, intptr_t suffix); | 636 const dart::String& GenerateName(const char* prefix, intptr_t suffix); |
| 625 | 637 |
| 626 void HandleLocalFunction(TreeNode* parent, FunctionNode* function); | 638 void HandleLocalFunction(TreeNode* parent, FunctionNode* function); |
| 627 void HandleSpecialLoad(LocalVariable** variable, const dart::String& symbol); | 639 void HandleSpecialLoad(LocalVariable** variable, const dart::String& symbol); |
| 628 void LookupCapturedVariableByName(LocalVariable** variable, | 640 void LookupCapturedVariableByName(LocalVariable** variable, |
| 629 const dart::String& name); | 641 const dart::String& name); |
| 630 | 642 |
| 631 | |
| 632 struct DepthState { | 643 struct DepthState { |
| 633 explicit DepthState(intptr_t function) | 644 explicit DepthState(intptr_t function) |
| 634 : loop_(0), | 645 : loop_(0), |
| 635 function_(function), | 646 function_(function), |
| 636 try_(0), | 647 try_(0), |
| 637 catch_(0), | 648 catch_(0), |
| 638 finally_(0), | 649 finally_(0), |
| 639 for_in_(0) {} | 650 for_in_(0) {} |
| 640 | 651 |
| 641 intptr_t loop_; | 652 intptr_t loop_; |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 861 StoreBarrierType emit_store_barrier = kEmitStoreBarrier); | 872 StoreBarrierType emit_store_barrier = kEmitStoreBarrier); |
| 862 Fragment StoreLocal(TokenPosition position, LocalVariable* variable); | 873 Fragment StoreLocal(TokenPosition position, LocalVariable* variable); |
| 863 Fragment StoreStaticField(const dart::Field& field); | 874 Fragment StoreStaticField(const dart::Field& field); |
| 864 Fragment StringInterpolate(TokenPosition position); | 875 Fragment StringInterpolate(TokenPosition position); |
| 865 Fragment ThrowTypeError(); | 876 Fragment ThrowTypeError(); |
| 866 Fragment ThrowNoSuchMethodError(); | 877 Fragment ThrowNoSuchMethodError(); |
| 867 Fragment BuildImplicitClosureCreation(const Function& target); | 878 Fragment BuildImplicitClosureCreation(const Function& target); |
| 868 Fragment GuardFieldLength(const dart::Field& field, intptr_t deopt_id); | 879 Fragment GuardFieldLength(const dart::Field& field, intptr_t deopt_id); |
| 869 Fragment GuardFieldClass(const dart::Field& field, intptr_t deopt_id); | 880 Fragment GuardFieldClass(const dart::Field& field, intptr_t deopt_id); |
| 870 | 881 |
| 882 Fragment EvaluateAssertion(); |
| 883 Fragment CheckReturnTypeInCheckedMode(); |
| 884 Fragment CheckVariableTypeInCheckedMode(VariableDeclaration* variable); |
| 885 Fragment CheckBooleanInCheckedMode(); |
| 886 Fragment CheckAssignableInCheckedMode(const dart::AbstractType& dst_type, |
| 887 const dart::String& dst_name); |
| 888 |
| 889 Fragment AssertBool(); |
| 890 Fragment AssertAssignable(const dart::AbstractType& dst_type, |
| 891 const dart::String& dst_name); |
| 892 |
| 871 dart::RawFunction* LookupMethodByMember(Member* target, | 893 dart::RawFunction* LookupMethodByMember(Member* target, |
| 872 const dart::String& method_name); | 894 const dart::String& method_name); |
| 873 | 895 |
| 874 LocalVariable* MakeTemporary(); | 896 LocalVariable* MakeTemporary(); |
| 875 LocalVariable* MakeNonTemporary(const dart::String& symbol); | 897 LocalVariable* MakeNonTemporary(const dart::String& symbol); |
| 876 | 898 |
| 877 intptr_t CurrentTryIndex(); | 899 intptr_t CurrentTryIndex(); |
| 878 intptr_t AllocateTryIndex() { return next_used_try_index_++; } | 900 intptr_t AllocateTryIndex() { return next_used_try_index_++; } |
| 879 | 901 |
| 880 void AddVariable(VariableDeclaration* declaration, LocalVariable* variable); | 902 void AddVariable(VariableDeclaration* declaration, LocalVariable* variable); |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1000 namespace kernel { | 1022 namespace kernel { |
| 1001 | 1023 |
| 1002 RawObject* EvaluateMetadata(TreeNode* const kernel_node); | 1024 RawObject* EvaluateMetadata(TreeNode* const kernel_node); |
| 1003 RawObject* BuildParameterDescriptor(TreeNode* const kernel_node); | 1025 RawObject* BuildParameterDescriptor(TreeNode* const kernel_node); |
| 1004 | 1026 |
| 1005 } // namespace kernel | 1027 } // namespace kernel |
| 1006 } // namespace dart | 1028 } // namespace dart |
| 1007 | 1029 |
| 1008 #endif // !defined(DART_PRECOMPILED_RUNTIME) | 1030 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
| 1009 #endif // RUNTIME_VM_KERNEL_TO_IL_H_ | 1031 #endif // RUNTIME_VM_KERNEL_TO_IL_H_ |
| OLD | NEW |