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

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

Issue 1584223006: Remove signature classes from the VM. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: sync Created 4 years, 11 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 | « runtime/vm/flow_graph_inliner.cc ('k') | runtime/vm/flow_graph_type_propagator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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/flow_graph_optimizer.h" 5 #include "vm/flow_graph_optimizer.h"
6 6
7 #include "vm/bit_vector.h" 7 #include "vm/bit_vector.h"
8 #include "vm/cha.h" 8 #include "vm/cha.h"
9 #include "vm/compiler.h" 9 #include "vm/compiler.h"
10 #include "vm/cpu.h" 10 #include "vm/cpu.h"
(...skipping 3886 matching lines...) Expand 10 before | Expand all | Expand 10 after
3897 // If all tests yield the same result, return it otherwise return Bool::null. 3897 // If all tests yield the same result, return it otherwise return Bool::null.
3898 // If no mapping is possible, 'results' is empty. 3898 // If no mapping is possible, 'results' is empty.
3899 // An instance-of test returning all same results can be converted to a class 3899 // An instance-of test returning all same results can be converted to a class
3900 // check. 3900 // check.
3901 RawBool* FlowGraphOptimizer::InstanceOfAsBool( 3901 RawBool* FlowGraphOptimizer::InstanceOfAsBool(
3902 const ICData& ic_data, 3902 const ICData& ic_data,
3903 const AbstractType& type, 3903 const AbstractType& type,
3904 ZoneGrowableArray<intptr_t>* results) const { 3904 ZoneGrowableArray<intptr_t>* results) const {
3905 ASSERT(results->is_empty()); 3905 ASSERT(results->is_empty());
3906 ASSERT(ic_data.NumArgsTested() == 1); // Unary checks only. 3906 ASSERT(ic_data.NumArgsTested() == 1); // Unary checks only.
3907 if (!type.IsInstantiated() || type.IsMalformedOrMalbounded()) { 3907 if (type.IsFunctionType() || type.IsDartFunctionType() ||
3908 !type.IsInstantiated() || type.IsMalformedOrMalbounded()) {
3908 return Bool::null(); 3909 return Bool::null();
3909 } 3910 }
3910 const Class& type_class = Class::Handle(Z, type.type_class()); 3911 const Class& type_class = Class::Handle(Z, type.type_class());
3911 const intptr_t num_type_args = type_class.NumTypeArguments(); 3912 const intptr_t num_type_args = type_class.NumTypeArguments();
3912 if (num_type_args > 0) { 3913 if (num_type_args > 0) {
3913 // Only raw types can be directly compared, thus disregarding type 3914 // Only raw types can be directly compared, thus disregarding type
3914 // arguments. 3915 // arguments.
3915 const intptr_t num_type_params = type_class.NumTypeParameters(); 3916 const intptr_t num_type_params = type_class.NumTypeParameters();
3916 const intptr_t from_index = num_type_args - num_type_params; 3917 const intptr_t from_index = num_type_args - num_type_params;
3917 const TypeArguments& type_arguments = 3918 const TypeArguments& type_arguments =
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
3952 } 3953 }
3953 return results_differ ? Bool::null() : prev.raw(); 3954 return results_differ ? Bool::null() : prev.raw();
3954 } 3955 }
3955 3956
3956 3957
3957 // Returns true if checking against this type is a direct class id comparison. 3958 // Returns true if checking against this type is a direct class id comparison.
3958 bool FlowGraphOptimizer::TypeCheckAsClassEquality(const AbstractType& type) { 3959 bool FlowGraphOptimizer::TypeCheckAsClassEquality(const AbstractType& type) {
3959 ASSERT(type.IsFinalized() && !type.IsMalformedOrMalbounded()); 3960 ASSERT(type.IsFinalized() && !type.IsMalformedOrMalbounded());
3960 // Requires CHA. 3961 // Requires CHA.
3961 if (!type.IsInstantiated()) return false; 3962 if (!type.IsInstantiated()) return false;
3963 // Function types have different type checking rules.
3964 if (type.IsFunctionType()) return false;
3962 const Class& type_class = Class::Handle(type.type_class()); 3965 const Class& type_class = Class::Handle(type.type_class());
3963 // Signature classes have different type checking rules.
3964 if (type_class.IsSignatureClass()) return false;
3965 // Could be an interface check? 3966 // Could be an interface check?
3966 if (CHA::IsImplemented(type_class)) return false; 3967 if (CHA::IsImplemented(type_class)) return false;
3967 // Check if there are subclasses. 3968 // Check if there are subclasses.
3968 if (CHA::HasSubclasses(type_class)) { 3969 if (CHA::HasSubclasses(type_class)) {
3969 return false; 3970 return false;
3970 } 3971 }
3971 3972
3972 // Private classes cannot be subclassed by later loaded libs. 3973 // Private classes cannot be subclassed by later loaded libs.
3973 if (!type_class.IsPrivate()) { 3974 if (!type_class.IsPrivate()) {
3974 if (FLAG_use_cha_deopt || isolate()->all_classes_finalized()) { 3975 if (FLAG_use_cha_deopt || isolate()->all_classes_finalized()) {
(...skipping 4883 matching lines...) Expand 10 before | Expand all | Expand 10 after
8858 8859
8859 // Insert materializations at environment uses. 8860 // Insert materializations at environment uses.
8860 for (intptr_t i = 0; i < exits_collector_.exits().length(); i++) { 8861 for (intptr_t i = 0; i < exits_collector_.exits().length(); i++) {
8861 CreateMaterializationAt( 8862 CreateMaterializationAt(
8862 exits_collector_.exits()[i], alloc, *slots); 8863 exits_collector_.exits()[i], alloc, *slots);
8863 } 8864 }
8864 } 8865 }
8865 8866
8866 8867
8867 } // namespace dart 8868 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_inliner.cc ('k') | runtime/vm/flow_graph_type_propagator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698