Skip to content

Commit 66bc931

Browse files
committed
VM: Fix bug in the new edge counter code on ARM and MIPS.
The offset into the edge counter array may exceed the limit of what fits into an Address operand on ARM and MIPS. BUG= [email protected] Review URL: https://codereview.chromium.org//1373013002 .
1 parent da006ac commit 66bc931

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

runtime/vm/flow_graph_compiler_arm.cc

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,17 +1188,16 @@ void FlowGraphCompiler::EmitEdgeCounter(intptr_t edge_id) {
11881188
// optimization/deoptimization cycles we will attempt.
11891189
ASSERT(!edge_counters_array_.IsNull());
11901190
ASSERT(assembler_->constant_pool_allowed());
1191-
const Array& counter = Array::ZoneHandle(zone(), Array::New(1, Heap::kOld));
1192-
counter.SetAt(0, Smi::Handle(zone(), Smi::New(0)));
11931191
__ Comment("Edge counter");
11941192
__ LoadObject(R0, edge_counters_array_);
11951193
#if defined(DEBUG)
11961194
bool old_use_far_branches = assembler_->use_far_branches();
11971195
assembler_->set_use_far_branches(true);
11981196
#endif // DEBUG
1199-
__ ldr(IP, FieldAddress(R0, Array::element_offset(edge_id)));
1200-
__ add(IP, IP, Operand(Smi::RawValue(1)));
1201-
__ StoreIntoSmiField(FieldAddress(R0, Array::element_offset(edge_id)), IP);
1197+
__ LoadFieldFromOffset(kWord, R1, R0, Array::element_offset(edge_id));
1198+
__ add(R1, R1, Operand(Smi::RawValue(1)));
1199+
__ StoreIntoObjectNoBarrierOffset(
1200+
R0, Array::element_offset(edge_id), R1, Assembler::kOnlySmi);
12021201
#if defined(DEBUG)
12031202
assembler_->set_use_far_branches(old_use_far_branches);
12041203
#endif // DEBUG

runtime/vm/flow_graph_compiler_mips.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1207,9 +1207,9 @@ void FlowGraphCompiler::EmitEdgeCounter(intptr_t edge_id) {
12071207
ASSERT(!edge_counters_array_.IsNull());
12081208
__ Comment("Edge counter");
12091209
__ LoadObject(T0, edge_counters_array_);
1210-
__ lw(T1, FieldAddress(T0, Array::element_offset(edge_id)));
1210+
__ LoadFieldFromOffset(T1, T0, Array::element_offset(edge_id));
12111211
__ AddImmediate(T1, T1, Smi::RawValue(1));
1212-
__ sw(T1, FieldAddress(T0, Array::element_offset(edge_id)));
1212+
__ StoreFieldToOffset(T1, T0, Array::element_offset(edge_id));
12131213
}
12141214

12151215

0 commit comments

Comments
 (0)