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

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

Issue 12377017: Use enum instead of bool parameter in IL instructions to indicate if a store barrier is needed. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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_builder.cc ('k') | runtime/vm/intermediate_language.h » ('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/flow_graph_builder.h" 9 #include "vm/flow_graph_builder.h"
10 #include "vm/flow_graph_compiler.h" 10 #include "vm/flow_graph_compiler.h"
(...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after
886 value_type, 886 value_type,
887 Symbols::Value()); 887 Symbols::Value());
888 // Newly inserted instructions that can deoptimize or throw an exception 888 // Newly inserted instructions that can deoptimize or throw an exception
889 // must have a deoptimization id that is valid for lookup in the unoptimized 889 // must have a deoptimization id that is valid for lookup in the unoptimized
890 // code. 890 // code.
891 assert_value->deopt_id_ = call->deopt_id(); 891 assert_value->deopt_id_ = call->deopt_id();
892 InsertBefore(call, assert_value, call->env(), Definition::kValue); 892 InsertBefore(call, assert_value, call->env(), Definition::kValue);
893 } 893 }
894 894
895 intptr_t array_cid = PrepareIndexedOp(call, class_id, &array, &index); 895 intptr_t array_cid = PrepareIndexedOp(call, class_id, &array, &index);
896 // Check if store barrier is needed. 896 // Check if store barrier is needed. Byte arrays don't need a store barrier.
897 bool needs_store_barrier = !RawObject::IsByteArrayClassId(array_cid); 897 StoreBarrierType needs_store_barrier =
898 RawObject::IsByteArrayClassId(array_cid)
899 ? kNoStoreBarrier
900 : kEmitStoreBarrier;
898 if (!value_check.IsNull()) { 901 if (!value_check.IsNull()) {
899 needs_store_barrier = false; 902 // No store barrier needed because checked value is a smi, an unboxed mint
903 // or unboxed double.
904 needs_store_barrier = kNoStoreBarrier;
900 AddCheckClass(stored_value, value_check, call->deopt_id(), call->env(), 905 AddCheckClass(stored_value, value_check, call->deopt_id(), call->env(),
901 call); 906 call);
902 } 907 }
903 908
904 Definition* array_op = new StoreIndexedInstr(new Value(array), 909 Definition* array_op = new StoreIndexedInstr(new Value(array),
905 new Value(index), 910 new Value(index),
906 new Value(stored_value), 911 new Value(stored_value),
907 needs_store_barrier, 912 needs_store_barrier,
908 array_cid, 913 array_cid,
909 call->deopt_id()); 914 call->deopt_id());
(...skipping 989 matching lines...) Expand 10 before | Expand all | Expand 10 after
1899 } 1904 }
1900 // Inline implicit instance setter. 1905 // Inline implicit instance setter.
1901 const String& field_name = 1906 const String& field_name =
1902 String::Handle(Field::NameFromSetter(instr->function_name())); 1907 String::Handle(Field::NameFromSetter(instr->function_name()));
1903 const Field& field = Field::Handle(GetField(class_id, field_name)); 1908 const Field& field = Field::Handle(GetField(class_id, field_name));
1904 ASSERT(!field.IsNull()); 1909 ASSERT(!field.IsNull());
1905 1910
1906 if (InstanceCallNeedsClassCheck(instr)) { 1911 if (InstanceCallNeedsClassCheck(instr)) {
1907 AddReceiverCheck(instr); 1912 AddReceiverCheck(instr);
1908 } 1913 }
1909 bool needs_store_barrier = true; 1914 StoreBarrierType needs_store_barrier = kEmitStoreBarrier;
1910 if (ArgIsAlwaysSmi(*instr->ic_data(), 1)) { 1915 if (ArgIsAlwaysSmi(*instr->ic_data(), 1)) {
1911 InsertBefore(instr, 1916 InsertBefore(instr,
1912 new CheckSmiInstr(new Value(instr->ArgumentAt(1)), 1917 new CheckSmiInstr(new Value(instr->ArgumentAt(1)),
1913 instr->deopt_id()), 1918 instr->deopt_id()),
1914 instr->env(), 1919 instr->env(),
1915 Definition::kEffect); 1920 Definition::kEffect);
1916 needs_store_barrier = false; 1921 needs_store_barrier = kNoStoreBarrier;
1917 } 1922 }
1918 StoreInstanceFieldInstr* store = new StoreInstanceFieldInstr( 1923 StoreInstanceFieldInstr* store = new StoreInstanceFieldInstr(
1919 field, 1924 field,
1920 new Value(instr->ArgumentAt(0)), 1925 new Value(instr->ArgumentAt(0)),
1921 new Value(instr->ArgumentAt(1)), 1926 new Value(instr->ArgumentAt(1)),
1922 needs_store_barrier); 1927 needs_store_barrier);
1923 // Detach environment from the original instruction because it can't 1928 // Detach environment from the original instruction because it can't
1924 // deoptimize. 1929 // deoptimize.
1925 for (Environment::DeepIterator it(instr->env()); !it.Done(); it.Advance()) { 1930 for (Environment::DeepIterator it(instr->env()); !it.Done(); it.Advance()) {
1926 it.CurrentValue()->RemoveFromUseList(); 1931 it.CurrentValue()->RemoveFromUseList();
(...skipping 2450 matching lines...) Expand 10 before | Expand all | Expand 10 after
4377 4382
4378 if (FLAG_trace_constant_propagation) { 4383 if (FLAG_trace_constant_propagation) {
4379 OS::Print("\n==== After constant propagation ====\n"); 4384 OS::Print("\n==== After constant propagation ====\n");
4380 FlowGraphPrinter printer(*graph_); 4385 FlowGraphPrinter printer(*graph_);
4381 printer.PrintBlocks(); 4386 printer.PrintBlocks();
4382 } 4387 }
4383 } 4388 }
4384 4389
4385 4390
4386 } // namespace dart 4391 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_builder.cc ('k') | runtime/vm/intermediate_language.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698