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

Unified Diff: runtime/vm/flow_graph_optimizer.cc

Issue 1278003002: Change heuristic to determine which fields contain modifieable double boxes: do it if field was ini… (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: s Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/vm/intermediate_language.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_optimizer.cc
diff --git a/runtime/vm/flow_graph_optimizer.cc b/runtime/vm/flow_graph_optimizer.cc
index f2572a15df57d4bc2c84b8e2d73adf8f081809fb..cf0713209c5d4b6470c2fe36045c277ed1c821e7 100644
--- a/runtime/vm/flow_graph_optimizer.cc
+++ b/runtime/vm/flow_graph_optimizer.cc
@@ -51,6 +51,7 @@ DEFINE_FLAG(bool, trace_smi_widening, false, "Trace Smi->Int32 widening pass.");
DECLARE_FLAG(bool, polymorphic_with_deopt);
DECLARE_FLAG(bool, source_lines);
+DECLARE_FLAG(bool, trace_field_guards);
DECLARE_FLAG(bool, trace_type_check_elimination);
DECLARE_FLAG(bool, warn_on_javascript_compatibility);
@@ -4596,14 +4597,25 @@ void FlowGraphOptimizer::VisitStoreInstanceField(
Function::Handle(Z, owner.LookupGetterFunction(field_name));
const Function& setter =
Function::Handle(Z, owner.LookupSetterFunction(field_name));
- bool result = !getter.IsNull()
- && !setter.IsNull()
- && (setter.usage_counter() > 0)
- && (FLAG_getter_setter_ratio * setter.usage_counter() >=
- getter.usage_counter());
- if (!result) {
- if (FLAG_trace_optimization) {
+ bool unboxed_field = false;
+ if (!getter.IsNull() && !setter.IsNull()) {
+ if (field.is_double_initialized()) {
+ unboxed_field = true;
+ } else if ((setter.usage_counter() > 0) &&
+ ((FLAG_getter_setter_ratio * setter.usage_counter()) >=
+ getter.usage_counter())) {
+ unboxed_field = true;
+ }
+ }
+ if (!unboxed_field) {
+ if (FLAG_trace_optimization || FLAG_trace_field_guards) {
ISL_Print("Disabling unboxing of %s\n", field.ToCString());
+ if (!setter.IsNull()) {
+ OS::Print(" setter usage count: %" Pd "\n", setter.usage_counter());
+ }
+ if (!getter.IsNull()) {
+ OS::Print(" getter usage count: %" Pd "\n", getter.usage_counter());
+ }
}
field.set_is_unboxing_candidate(false);
field.DeoptimizeDependentCode();
« no previous file with comments | « no previous file | runtime/vm/intermediate_language.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698