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

Side by Side Diff: runtime/vm/kernel_reader.cc

Issue 3001093002: Remove some "namespace" classes from C++ Kernel (Closed)
Patch Set: Created 3 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
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 #include "vm/kernel_reader.h" 5 #include "vm/kernel_reader.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include "vm/dart_api_impl.h" 9 #include "vm/dart_api_impl.h"
10 #include "vm/kernel_binary.h" 10 #include "vm/kernel_binary.h"
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 function.set_kernel_offset(procedure_offset); 603 function.set_kernel_offset(procedure_offset);
604 604
605 ActiveMemberScope active_member(&active_class_, &function); 605 ActiveMemberScope active_member(&active_class_, &function);
606 606
607 procedure_helper.ReadUntilExcluding(ProcedureHelper::kFunction); 607 procedure_helper.ReadUntilExcluding(ProcedureHelper::kFunction);
608 Tag function_node_tag = builder_.ReadTag(); 608 Tag function_node_tag = builder_.ReadTag();
609 ASSERT(function_node_tag == kSomething); 609 ASSERT(function_node_tag == kSomething);
610 FunctionNodeHelper function_node_helper(&builder_); 610 FunctionNodeHelper function_node_helper(&builder_);
611 function_node_helper.ReadUntilIncluding(FunctionNodeHelper::kDartAsyncMarker); 611 function_node_helper.ReadUntilIncluding(FunctionNodeHelper::kDartAsyncMarker);
612 function.set_is_debuggable(function_node_helper.dart_async_marker_ == 612 function.set_is_debuggable(function_node_helper.dart_async_marker_ ==
613 FunctionNode::kSync); 613 FunctionNodeHelper::kSync);
614 switch (function_node_helper.dart_async_marker_) { 614 switch (function_node_helper.dart_async_marker_) {
615 case FunctionNode::kSyncStar: 615 case FunctionNodeHelper::kSyncStar:
616 function.set_modifier(RawFunction::kSyncGen); 616 function.set_modifier(RawFunction::kSyncGen);
617 break; 617 break;
618 case FunctionNode::kAsync: 618 case FunctionNodeHelper::kAsync:
619 function.set_modifier(RawFunction::kAsync); 619 function.set_modifier(RawFunction::kAsync);
620 function.set_is_inlinable(!FLAG_causal_async_stacks); 620 function.set_is_inlinable(!FLAG_causal_async_stacks);
621 break; 621 break;
622 case FunctionNode::kAsyncStar: 622 case FunctionNodeHelper::kAsyncStar:
623 function.set_modifier(RawFunction::kAsyncGen); 623 function.set_modifier(RawFunction::kAsyncGen);
624 function.set_is_inlinable(!FLAG_causal_async_stacks); 624 function.set_is_inlinable(!FLAG_causal_async_stacks);
625 break; 625 break;
626 default: 626 default:
627 // no special modifier 627 // no special modifier
628 break; 628 break;
629 } 629 }
630 ASSERT(function_node_helper.async_marker_ == FunctionNode::kSync); 630 ASSERT(function_node_helper.async_marker_ == FunctionNodeHelper::kSync);
631 631
632 if (native_name != NULL) { 632 if (native_name != NULL) {
633 function.set_native_name(*native_name); 633 function.set_native_name(*native_name);
634 } 634 }
635 635
636 function_node_helper.ReadUntilExcluding(FunctionNodeHelper::kTypeParameters); 636 function_node_helper.ReadUntilExcluding(FunctionNodeHelper::kTypeParameters);
637 if (!function.IsFactory()) { 637 if (!function.IsFactory()) {
638 // Read type_parameters list length. 638 // Read type_parameters list length.
639 intptr_t type_parameter_count = builder_.ReadListLength(); 639 intptr_t type_parameter_count = builder_.ReadListLength();
640 // Set type parameters. 640 // Set type parameters.
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
912 } 912 }
913 // Insert the class in the cache before calling ReadPreliminaryClass so 913 // Insert the class in the cache before calling ReadPreliminaryClass so
914 // we do not risk allocating the class again by calling LookupClass 914 // we do not risk allocating the class again by calling LookupClass
915 // recursively from ReadPreliminaryClass for the same class. 915 // recursively from ReadPreliminaryClass for the same class.
916 classes_.Insert(klass, handle); 916 classes_.Insert(klass, handle);
917 } 917 }
918 return *handle; 918 return *handle;
919 } 919 }
920 920
921 RawFunction::Kind KernelReader::GetFunctionType( 921 RawFunction::Kind KernelReader::GetFunctionType(
922 Procedure::ProcedureKind procedure_kind) { 922 ProcedureHelper::Kind procedure_kind) {
923 intptr_t lookuptable[] = { 923 intptr_t lookuptable[] = {
924 RawFunction::kRegularFunction, // Procedure::kMethod 924 RawFunction::kRegularFunction, // Procedure::kMethod
925 RawFunction::kGetterFunction, // Procedure::kGetter 925 RawFunction::kGetterFunction, // Procedure::kGetter
926 RawFunction::kSetterFunction, // Procedure::kSetter 926 RawFunction::kSetterFunction, // Procedure::kSetter
927 RawFunction::kRegularFunction, // Procedure::kOperator 927 RawFunction::kRegularFunction, // Procedure::kOperator
928 RawFunction::kConstructor, // Procedure::kFactory 928 RawFunction::kConstructor, // Procedure::kFactory
929 }; 929 };
930 intptr_t kind = static_cast<int>(procedure_kind); 930 intptr_t kind = static_cast<int>(procedure_kind);
931 if (kind == Procedure::kIncompleteProcedure) { 931 ASSERT(0 <= kind && kind <= ProcedureHelper::kFactory);
932 return RawFunction::kSignatureFunction; 932 return static_cast<RawFunction::Kind>(lookuptable[kind]);
933 } else {
934 ASSERT(0 <= kind && kind <= Procedure::kFactory);
935 return static_cast<RawFunction::Kind>(lookuptable[kind]);
936 }
937 } 933 }
938 934
939 bool KernelReader::FieldHasFunctionLiteralInitializer(const dart::Field& field, 935 bool KernelReader::FieldHasFunctionLiteralInitializer(const dart::Field& field,
940 TokenPosition* start, 936 TokenPosition* start,
941 TokenPosition* end) { 937 TokenPosition* end) {
942 dart::Zone* zone = Thread::Current()->zone(); 938 dart::Zone* zone = Thread::Current()->zone();
943 const Script& script = Script::Handle(zone, field.Script()); 939 const Script& script = Script::Handle(zone, field.Script());
944 940
945 TranslationHelper translation_helper( 941 TranslationHelper translation_helper(
946 Thread::Current(), script.kernel_string_offsets(), 942 Thread::Current(), script.kernel_string_offsets(),
(...skipping 30 matching lines...) Expand all
977 initializer_fun.set_result_type(AbstractType::Handle(zone, field.type())); 973 initializer_fun.set_result_type(AbstractType::Handle(zone, field.type()));
978 initializer_fun.set_is_debuggable(false); 974 initializer_fun.set_is_debuggable(false);
979 initializer_fun.set_is_reflectable(false); 975 initializer_fun.set_is_reflectable(false);
980 initializer_fun.set_is_inlinable(false); 976 initializer_fun.set_is_inlinable(false);
981 return new (zone) ParsedFunction(thread, initializer_fun); 977 return new (zone) ParsedFunction(thread, initializer_fun);
982 } 978 }
983 979
984 } // namespace kernel 980 } // namespace kernel
985 } // namespace dart 981 } // namespace dart
986 #endif // !defined(DART_PRECOMPILED_RUNTIME) 982 #endif // !defined(DART_PRECOMPILED_RUNTIME)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698