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

Side by Side Diff: runtime/vm/kernel_to_il.h

Issue 2659363003: VM: [Kernel] Partial support for checked mode. (Closed)
Patch Set: Revert changes to test Created 3 years, 10 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 | runtime/vm/kernel_to_il.cc » ('j') | runtime/vm/kernel_to_il.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 MaybeCheckBool() {
Vyacheslav Egorov (Google) 2017/01/30 18:30:28 I would call it AssertBoolInCheckedMode() to match
kustermann 2017/01/31 10:39:45 Done.
478 if (isolate_->type_checks() && !result_.IsBool()) {
479 translation_helper_.ReportError("Expected boolean expression.");
480 }
481 }
482
477 // TODO(27590): Instead of using [dart::kernel::TreeNode]s as keys we 483 // TODO(27590): Instead of using [dart::kernel::TreeNode]s as keys we
478 // should use [TokenPosition]s as well as the existing functionality in 484 // should use [TokenPosition]s as well as the existing functionality in
479 // `Parser::CacheConstantValue`. 485 // `Parser::CacheConstantValue`.
480 bool GetCachedConstant(TreeNode* node, Instance* value); 486 bool GetCachedConstant(TreeNode* node, Instance* value);
481 void CacheConstantValue(TreeNode* node, const Instance& value); 487 void CacheConstantValue(TreeNode* node, const Instance& value);
482 488
483 FlowGraphBuilder* builder_; 489 FlowGraphBuilder* builder_;
484 Isolate* isolate_; 490 Isolate* isolate_;
485 Zone* zone_; 491 Zone* zone_;
486 TranslationHelper& translation_helper_; 492 TranslationHelper& translation_helper_;
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 // captured variable. 627 // captured variable.
622 void LookupVariable(VariableDeclaration* declaration); 628 void LookupVariable(VariableDeclaration* declaration);
623 629
624 const dart::String& GenerateName(const char* prefix, intptr_t suffix); 630 const dart::String& GenerateName(const char* prefix, intptr_t suffix);
625 631
626 void HandleLocalFunction(TreeNode* parent, FunctionNode* function); 632 void HandleLocalFunction(TreeNode* parent, FunctionNode* function);
627 void HandleSpecialLoad(LocalVariable** variable, const dart::String& symbol); 633 void HandleSpecialLoad(LocalVariable** variable, const dart::String& symbol);
628 void LookupCapturedVariableByName(LocalVariable** variable, 634 void LookupCapturedVariableByName(LocalVariable** variable,
629 const dart::String& name); 635 const dart::String& name);
630 636
631
632 struct DepthState { 637 struct DepthState {
633 explicit DepthState(intptr_t function) 638 explicit DepthState(intptr_t function)
634 : loop_(0), 639 : loop_(0),
635 function_(function), 640 function_(function),
636 try_(0), 641 try_(0),
637 catch_(0), 642 catch_(0),
638 finally_(0), 643 finally_(0),
639 for_in_(0) {} 644 for_in_(0) {}
640 645
641 intptr_t loop_; 646 intptr_t loop_;
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
861 StoreBarrierType emit_store_barrier = kEmitStoreBarrier); 866 StoreBarrierType emit_store_barrier = kEmitStoreBarrier);
862 Fragment StoreLocal(TokenPosition position, LocalVariable* variable); 867 Fragment StoreLocal(TokenPosition position, LocalVariable* variable);
863 Fragment StoreStaticField(const dart::Field& field); 868 Fragment StoreStaticField(const dart::Field& field);
864 Fragment StringInterpolate(TokenPosition position); 869 Fragment StringInterpolate(TokenPosition position);
865 Fragment ThrowTypeError(); 870 Fragment ThrowTypeError();
866 Fragment ThrowNoSuchMethodError(); 871 Fragment ThrowNoSuchMethodError();
867 Fragment BuildImplicitClosureCreation(const Function& target); 872 Fragment BuildImplicitClosureCreation(const Function& target);
868 Fragment GuardFieldLength(const dart::Field& field, intptr_t deopt_id); 873 Fragment GuardFieldLength(const dart::Field& field, intptr_t deopt_id);
869 Fragment GuardFieldClass(const dart::Field& field, intptr_t deopt_id); 874 Fragment GuardFieldClass(const dart::Field& field, intptr_t deopt_id);
870 875
876 Fragment EvaluateAssertion();
877 Fragment MaybeCheckReturnType();
878 Fragment MaybeCheckVariableType(VariableDeclaration* variable);
879 Fragment MaybeCheckBool();
880 Fragment MaybeCheckAssignable(const dart::AbstractType& dst_type,
881 const dart::String& dst_name);
882
883 Fragment AssertBool();
884 Fragment AssertAssignable(const dart::AbstractType& dst_type,
885 const dart::String& dst_name);
886
871 dart::RawFunction* LookupMethodByMember(Member* target, 887 dart::RawFunction* LookupMethodByMember(Member* target,
872 const dart::String& method_name); 888 const dart::String& method_name);
873 889
874 LocalVariable* MakeTemporary(); 890 LocalVariable* MakeTemporary();
875 LocalVariable* MakeNonTemporary(const dart::String& symbol); 891 LocalVariable* MakeNonTemporary(const dart::String& symbol);
876 892
877 intptr_t CurrentTryIndex(); 893 intptr_t CurrentTryIndex();
878 intptr_t AllocateTryIndex() { return next_used_try_index_++; } 894 intptr_t AllocateTryIndex() { return next_used_try_index_++; }
879 895
880 void AddVariable(VariableDeclaration* declaration, LocalVariable* variable); 896 void AddVariable(VariableDeclaration* declaration, LocalVariable* variable);
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
1000 namespace kernel { 1016 namespace kernel {
1001 1017
1002 RawObject* EvaluateMetadata(TreeNode* const kernel_node); 1018 RawObject* EvaluateMetadata(TreeNode* const kernel_node);
1003 RawObject* BuildParameterDescriptor(TreeNode* const kernel_node); 1019 RawObject* BuildParameterDescriptor(TreeNode* const kernel_node);
1004 1020
1005 } // namespace kernel 1021 } // namespace kernel
1006 } // namespace dart 1022 } // namespace dart
1007 1023
1008 #endif // !defined(DART_PRECOMPILED_RUNTIME) 1024 #endif // !defined(DART_PRECOMPILED_RUNTIME)
1009 #endif // RUNTIME_VM_KERNEL_TO_IL_H_ 1025 #endif // RUNTIME_VM_KERNEL_TO_IL_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/kernel_to_il.cc » ('j') | runtime/vm/kernel_to_il.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698