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

Unified Diff: runtime/vm/flow_graph_builder.cc

Issue 1121303002: VM: Improve unoptimized code size by avoid emitting field guards. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 8 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/flow_graph_compiler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_builder.cc
===================================================================
--- runtime/vm/flow_graph_builder.cc (revision 45494)
+++ runtime/vm/flow_graph_builder.cc (working copy)
@@ -42,6 +42,7 @@
DECLARE_FLAG(bool, enable_type_checks);
DECLARE_FLAG(int, optimization_counter_threshold);
DECLARE_FLAG(bool, warn_on_javascript_compatibility);
+DECLARE_FLAG(bool, use_field_guards);
// Quick access to the locally defined zone() method.
#define Z (zone())
@@ -3502,21 +3503,32 @@
dst_name);
}
- store_value = Bind(BuildStoreExprTemp(store_value));
- GuardFieldClassInstr* guard_field_class =
- new(Z) GuardFieldClassInstr(store_value,
- node->field(),
- isolate()->GetNextDeoptId());
- AddInstruction(guard_field_class);
-
- store_value = Bind(BuildLoadExprTemp());
- GuardFieldLengthInstr* guard_field_length =
- new(Z) GuardFieldLengthInstr(store_value,
+ if (FLAG_use_field_guards) {
+ if (node->field().guarded_cid() != kDynamicCid) {
+ store_value = Bind(BuildStoreExprTemp(store_value));
+ GuardFieldClassInstr* guard_field_class =
+ new(Z) GuardFieldClassInstr(store_value,
node->field(),
isolate()->GetNextDeoptId());
- AddInstruction(guard_field_length);
-
- store_value = Bind(BuildLoadExprTemp());
+ AddInstruction(guard_field_class);
+ store_value = Bind(BuildLoadExprTemp());
+ if (node->field().guarded_list_length() != Field::kNoFixedLength) {
+ GuardFieldLengthInstr* guard_field_length =
+ new(Z) GuardFieldLengthInstr(store_value,
+ node->field(),
+ isolate()->GetNextDeoptId());
+ AddInstruction(guard_field_length);
+ store_value = Bind(BuildLoadExprTemp());
+ } else {
+ // Advance deopt-id counter to remain in sync.
+ isolate()->GetNextDeoptId();
+ }
+ } else {
+ // Advance deopt-id counter to remain in sync.
+ isolate()->GetNextDeoptId();
+ isolate()->GetNextDeoptId();
+ }
+ }
StoreInstanceFieldInstr* store =
new(Z) StoreInstanceFieldInstr(node->field(),
for_instance.value(),
« no previous file with comments | « no previous file | runtime/vm/flow_graph_compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698