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

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

Issue 1016973002: Move CHA state keeping from Isolate to Thread. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/flow_graph_optimizer.h ('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/cpu.h" 9 #include "vm/cpu.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 2254 matching lines...) Expand 10 before | Expand all | Expand 10 after
2265 if (!FLAG_use_cha) return true; 2265 if (!FLAG_use_cha) return true;
2266 Definition* callee_receiver = call->ArgumentAt(0); 2266 Definition* callee_receiver = call->ArgumentAt(0);
2267 ASSERT(callee_receiver != NULL); 2267 ASSERT(callee_receiver != NULL);
2268 const Function& function = flow_graph_->function(); 2268 const Function& function = flow_graph_->function();
2269 if (function.IsDynamicFunction() && 2269 if (function.IsDynamicFunction() &&
2270 callee_receiver->IsParameter() && 2270 callee_receiver->IsParameter() &&
2271 (callee_receiver->AsParameter()->index() == 0)) { 2271 (callee_receiver->AsParameter()->index() == 0)) {
2272 const String& name = (kind == RawFunction::kMethodExtractor) 2272 const String& name = (kind == RawFunction::kMethodExtractor)
2273 ? String::Handle(Z, Field::NameFromGetter(call->function_name())) 2273 ? String::Handle(Z, Field::NameFromGetter(call->function_name()))
2274 : call->function_name(); 2274 : call->function_name();
2275 return isolate()->cha()->HasOverride(Class::Handle(Z, function.Owner()), 2275 return thread()->cha()->HasOverride(Class::Handle(Z, function.Owner()),
2276 name); 2276 name);
2277 } 2277 }
2278 return true; 2278 return true;
2279 } 2279 }
2280 2280
2281 2281
2282 void FlowGraphOptimizer::InlineImplicitInstanceGetter(InstanceCallInstr* call) { 2282 void FlowGraphOptimizer::InlineImplicitInstanceGetter(InstanceCallInstr* call) {
2283 ASSERT(call->HasICData()); 2283 ASSERT(call->HasICData());
2284 const ICData& ic_data = *call->ic_data(); 2284 const ICData& ic_data = *call->ic_data();
2285 ASSERT(ic_data.HasOneTarget()); 2285 ASSERT(ic_data.HasOneTarget());
2286 Function& target = Function::Handle(Z); 2286 Function& target = Function::Handle(Z);
(...skipping 1645 matching lines...) Expand 10 before | Expand all | Expand 10 after
3932 // Returns true if checking against this type is a direct class id comparison. 3932 // Returns true if checking against this type is a direct class id comparison.
3933 bool FlowGraphOptimizer::TypeCheckAsClassEquality(const AbstractType& type) { 3933 bool FlowGraphOptimizer::TypeCheckAsClassEquality(const AbstractType& type) {
3934 ASSERT(type.IsFinalized() && !type.IsMalformedOrMalbounded()); 3934 ASSERT(type.IsFinalized() && !type.IsMalformedOrMalbounded());
3935 // Requires CHA. 3935 // Requires CHA.
3936 if (!FLAG_use_cha) return false; 3936 if (!FLAG_use_cha) return false;
3937 if (!type.IsInstantiated()) return false; 3937 if (!type.IsInstantiated()) return false;
3938 const Class& type_class = Class::Handle(type.type_class()); 3938 const Class& type_class = Class::Handle(type.type_class());
3939 // Signature classes have different type checking rules. 3939 // Signature classes have different type checking rules.
3940 if (type_class.IsSignatureClass()) return false; 3940 if (type_class.IsSignatureClass()) return false;
3941 // Could be an interface check? 3941 // Could be an interface check?
3942 if (isolate()->cha()->IsImplemented(type_class)) return false; 3942 if (thread()->cha()->IsImplemented(type_class)) return false;
3943 // Check if there are subclasses. 3943 // Check if there are subclasses.
3944 if (isolate()->cha()->HasSubclasses(type_class)) return false; 3944 if (thread()->cha()->HasSubclasses(type_class)) return false;
3945 const intptr_t num_type_args = type_class.NumTypeArguments(); 3945 const intptr_t num_type_args = type_class.NumTypeArguments();
3946 if (num_type_args > 0) { 3946 if (num_type_args > 0) {
3947 // Only raw types can be directly compared, thus disregarding type 3947 // Only raw types can be directly compared, thus disregarding type
3948 // arguments. 3948 // arguments.
3949 const intptr_t num_type_params = type_class.NumTypeParameters(); 3949 const intptr_t num_type_params = type_class.NumTypeParameters();
3950 const intptr_t from_index = num_type_args - num_type_params; 3950 const intptr_t from_index = num_type_args - num_type_params;
3951 const TypeArguments& type_arguments = 3951 const TypeArguments& type_arguments =
3952 TypeArguments::Handle(type.arguments()); 3952 TypeArguments::Handle(type.arguments());
3953 const bool is_raw_type = type_arguments.IsNull() || 3953 const bool is_raw_type = type_arguments.IsNull() ||
3954 type_arguments.IsRaw(from_index, num_type_params); 3954 type_arguments.IsRaw(from_index, num_type_params);
(...skipping 4654 matching lines...) Expand 10 before | Expand all | Expand 10 after
8609 8609
8610 // Insert materializations at environment uses. 8610 // Insert materializations at environment uses.
8611 for (intptr_t i = 0; i < exits_collector_.exits().length(); i++) { 8611 for (intptr_t i = 0; i < exits_collector_.exits().length(); i++) {
8612 CreateMaterializationAt( 8612 CreateMaterializationAt(
8613 exits_collector_.exits()[i], alloc, *slots); 8613 exits_collector_.exits()[i], alloc, *slots);
8614 } 8614 }
8615 } 8615 }
8616 8616
8617 8617
8618 } // namespace dart 8618 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_optimizer.h ('k') | runtime/vm/flow_graph_type_propagator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698