OLD | NEW |
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/globals.h" // Needed here to get TARGET_ARCH_ARM. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM. |
6 #if defined(TARGET_ARCH_ARM) | 6 #if defined(TARGET_ARCH_ARM) |
7 | 7 |
8 #include "vm/flow_graph_compiler.h" | 8 #include "vm/flow_graph_compiler.h" |
9 | 9 |
10 #include "vm/ast_printer.h" | 10 #include "vm/ast_printer.h" |
(...skipping 1162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1173 // Add deoptimization continuation point after the call and before the | 1173 // Add deoptimization continuation point after the call and before the |
1174 // arguments are removed. | 1174 // arguments are removed. |
1175 AddCurrentDescriptor(RawPcDescriptors::kDeopt, | 1175 AddCurrentDescriptor(RawPcDescriptors::kDeopt, |
1176 deopt_id_after, | 1176 deopt_id_after, |
1177 token_pos); | 1177 token_pos); |
1178 } | 1178 } |
1179 } | 1179 } |
1180 } | 1180 } |
1181 | 1181 |
1182 | 1182 |
1183 void FlowGraphCompiler::EmitEdgeCounter() { | 1183 void FlowGraphCompiler::EmitEdgeCounter(intptr_t edge_id) { |
1184 // We do not check for overflow when incrementing the edge counter. The | 1184 // We do not check for overflow when incrementing the edge counter. The |
1185 // function should normally be optimized long before the counter can | 1185 // function should normally be optimized long before the counter can |
1186 // overflow; and though we do not reset the counters when we optimize or | 1186 // overflow; and though we do not reset the counters when we optimize or |
1187 // deoptimize, there is a bound on the number of | 1187 // deoptimize, there is a bound on the number of |
1188 // optimization/deoptimization cycles we will attempt. | 1188 // optimization/deoptimization cycles we will attempt. |
| 1189 ASSERT(!edge_counters_array_.IsNull()); |
1189 ASSERT(assembler_->constant_pool_allowed()); | 1190 ASSERT(assembler_->constant_pool_allowed()); |
1190 const Array& counter = Array::ZoneHandle(zone(), Array::New(1, Heap::kOld)); | 1191 const Array& counter = Array::ZoneHandle(zone(), Array::New(1, Heap::kOld)); |
1191 counter.SetAt(0, Smi::Handle(zone(), Smi::New(0))); | 1192 counter.SetAt(0, Smi::Handle(zone(), Smi::New(0))); |
1192 __ Comment("Edge counter"); | 1193 __ Comment("Edge counter"); |
1193 __ LoadUniqueObject(R0, counter); | 1194 __ LoadObject(R0, edge_counters_array_); |
1194 intptr_t increment_start = assembler_->CodeSize(); | |
1195 #if defined(DEBUG) | 1195 #if defined(DEBUG) |
1196 bool old_use_far_branches = assembler_->use_far_branches(); | 1196 bool old_use_far_branches = assembler_->use_far_branches(); |
1197 assembler_->set_use_far_branches(true); | 1197 assembler_->set_use_far_branches(true); |
1198 #endif // DEBUG | 1198 #endif // DEBUG |
1199 __ ldr(IP, FieldAddress(R0, Array::element_offset(0))); | 1199 __ ldr(IP, FieldAddress(R0, Array::element_offset(edge_id))); |
1200 __ add(IP, IP, Operand(Smi::RawValue(1))); | 1200 __ add(IP, IP, Operand(Smi::RawValue(1))); |
1201 __ StoreIntoSmiField(FieldAddress(R0, Array::element_offset(0)), IP); | 1201 __ StoreIntoSmiField(FieldAddress(R0, Array::element_offset(edge_id)), IP); |
1202 int32_t size = assembler_->CodeSize() - increment_start; | |
1203 if (isolate()->edge_counter_increment_size() == -1) { | |
1204 isolate()->set_edge_counter_increment_size(size); | |
1205 } else { | |
1206 ASSERT(size == isolate()->edge_counter_increment_size()); | |
1207 } | |
1208 #if defined(DEBUG) | 1202 #if defined(DEBUG) |
1209 assembler_->set_use_far_branches(old_use_far_branches); | 1203 assembler_->set_use_far_branches(old_use_far_branches); |
1210 #endif // DEBUG | 1204 #endif // DEBUG |
1211 } | 1205 } |
1212 | 1206 |
1213 | 1207 |
1214 int32_t FlowGraphCompiler::EdgeCounterIncrementSizeInBytes() { | |
1215 const int32_t size = Isolate::Current()->edge_counter_increment_size(); | |
1216 ASSERT(size != -1); | |
1217 return size; | |
1218 } | |
1219 | |
1220 | |
1221 void FlowGraphCompiler::EmitOptimizedInstanceCall( | 1208 void FlowGraphCompiler::EmitOptimizedInstanceCall( |
1222 const StubEntry& stub_entry, | 1209 const StubEntry& stub_entry, |
1223 const ICData& ic_data, | 1210 const ICData& ic_data, |
1224 intptr_t argument_count, | 1211 intptr_t argument_count, |
1225 intptr_t deopt_id, | 1212 intptr_t deopt_id, |
1226 intptr_t token_pos, | 1213 intptr_t token_pos, |
1227 LocationSummary* locs) { | 1214 LocationSummary* locs) { |
1228 ASSERT(Array::Handle(zone(), ic_data.arguments_descriptor()).Length() > 0); | 1215 ASSERT(Array::Handle(zone(), ic_data.arguments_descriptor()).Length() > 0); |
1229 // Each ICData propagated from unoptimized to optimized code contains the | 1216 // Each ICData propagated from unoptimized to optimized code contains the |
1230 // function that corresponds to the Dart function of that IC call. Due | 1217 // function that corresponds to the Dart function of that IC call. Due |
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1878 DRegister dreg = EvenDRegisterOf(reg); | 1865 DRegister dreg = EvenDRegisterOf(reg); |
1879 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex)); | 1866 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex)); |
1880 } | 1867 } |
1881 | 1868 |
1882 | 1869 |
1883 #undef __ | 1870 #undef __ |
1884 | 1871 |
1885 } // namespace dart | 1872 } // namespace dart |
1886 | 1873 |
1887 #endif // defined TARGET_ARCH_ARM | 1874 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |