| 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 1179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1190 // Add deoptimization continuation point after the call and before the | 1190 // Add deoptimization continuation point after the call and before the |
| 1191 // arguments are removed. | 1191 // arguments are removed. |
| 1192 AddCurrentDescriptor(RawPcDescriptors::kDeopt, | 1192 AddCurrentDescriptor(RawPcDescriptors::kDeopt, |
| 1193 deopt_id_after, | 1193 deopt_id_after, |
| 1194 token_pos); | 1194 token_pos); |
| 1195 } | 1195 } |
| 1196 } | 1196 } |
| 1197 } | 1197 } |
| 1198 | 1198 |
| 1199 | 1199 |
| 1200 void FlowGraphCompiler::EmitEdgeCounter() { | 1200 void FlowGraphCompiler::EmitEdgeCounter(intptr_t edge_id) { |
| 1201 // We do not check for overflow when incrementing the edge counter. The | 1201 // We do not check for overflow when incrementing the edge counter. The |
| 1202 // function should normally be optimized long before the counter can | 1202 // function should normally be optimized long before the counter can |
| 1203 // overflow; and though we do not reset the counters when we optimize or | 1203 // overflow; and though we do not reset the counters when we optimize or |
| 1204 // deoptimize, there is a bound on the number of | 1204 // deoptimize, there is a bound on the number of |
| 1205 // optimization/deoptimization cycles we will attempt. | 1205 // optimization/deoptimization cycles we will attempt. |
| 1206 ASSERT(!edge_counters_array_.IsNull()); |
| 1206 ASSERT(assembler_->constant_pool_allowed()); | 1207 ASSERT(assembler_->constant_pool_allowed()); |
| 1207 const Array& counter = Array::ZoneHandle(zone(), Array::New(1, Heap::kOld)); | 1208 const Array& counter = Array::ZoneHandle(zone(), Array::New(1, Heap::kOld)); |
| 1208 counter.SetAt(0, Smi::Handle(zone(), Smi::New(0))); | 1209 counter.SetAt(0, Smi::Handle(zone(), Smi::New(0))); |
| 1209 __ Comment("Edge counter"); | 1210 __ Comment("Edge counter"); |
| 1210 __ LoadUniqueObject(R0, counter); | 1211 __ LoadObject(R0, edge_counters_array_); |
| 1211 intptr_t increment_start = assembler_->CodeSize(); | |
| 1212 #if defined(DEBUG) | 1212 #if defined(DEBUG) |
| 1213 bool old_use_far_branches = assembler_->use_far_branches(); | 1213 bool old_use_far_branches = assembler_->use_far_branches(); |
| 1214 assembler_->set_use_far_branches(true); | 1214 assembler_->set_use_far_branches(true); |
| 1215 #endif // DEBUG | 1215 #endif // DEBUG |
| 1216 __ ldr(IP, FieldAddress(R0, Array::element_offset(0))); | 1216 __ ldr(IP, FieldAddress(R0, Array::element_offset(edge_id))); |
| 1217 __ add(IP, IP, Operand(Smi::RawValue(1))); | 1217 __ add(IP, IP, Operand(Smi::RawValue(1))); |
| 1218 __ StoreIntoSmiField(FieldAddress(R0, Array::element_offset(0)), IP); | 1218 __ StoreIntoSmiField(FieldAddress(R0, Array::element_offset(edge_id)), IP); |
| 1219 int32_t size = assembler_->CodeSize() - increment_start; | |
| 1220 if (isolate()->edge_counter_increment_size() == -1) { | |
| 1221 isolate()->set_edge_counter_increment_size(size); | |
| 1222 } else { | |
| 1223 ASSERT(size == isolate()->edge_counter_increment_size()); | |
| 1224 } | |
| 1225 #if defined(DEBUG) | 1219 #if defined(DEBUG) |
| 1226 assembler_->set_use_far_branches(old_use_far_branches); | 1220 assembler_->set_use_far_branches(old_use_far_branches); |
| 1227 #endif // DEBUG | 1221 #endif // DEBUG |
| 1228 } | 1222 } |
| 1229 | 1223 |
| 1230 | 1224 |
| 1231 int32_t FlowGraphCompiler::EdgeCounterIncrementSizeInBytes() { | |
| 1232 const int32_t size = Isolate::Current()->edge_counter_increment_size(); | |
| 1233 ASSERT(size != -1); | |
| 1234 return size; | |
| 1235 } | |
| 1236 | |
| 1237 | |
| 1238 void FlowGraphCompiler::EmitOptimizedInstanceCall( | 1225 void FlowGraphCompiler::EmitOptimizedInstanceCall( |
| 1239 const StubEntry& stub_entry, | 1226 const StubEntry& stub_entry, |
| 1240 const ICData& ic_data, | 1227 const ICData& ic_data, |
| 1241 intptr_t argument_count, | 1228 intptr_t argument_count, |
| 1242 intptr_t deopt_id, | 1229 intptr_t deopt_id, |
| 1243 intptr_t token_pos, | 1230 intptr_t token_pos, |
| 1244 LocationSummary* locs) { | 1231 LocationSummary* locs) { |
| 1245 ASSERT(Array::Handle(zone(), ic_data.arguments_descriptor()).Length() > 0); | 1232 ASSERT(Array::Handle(zone(), ic_data.arguments_descriptor()).Length() > 0); |
| 1246 // Each ICData propagated from unoptimized to optimized code contains the | 1233 // Each ICData propagated from unoptimized to optimized code contains the |
| 1247 // function that corresponds to the Dart function of that IC call. Due | 1234 // 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... |
| 1895 DRegister dreg = EvenDRegisterOf(reg); | 1882 DRegister dreg = EvenDRegisterOf(reg); |
| 1896 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex)); | 1883 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex)); |
| 1897 } | 1884 } |
| 1898 | 1885 |
| 1899 | 1886 |
| 1900 #undef __ | 1887 #undef __ |
| 1901 | 1888 |
| 1902 } // namespace dart | 1889 } // namespace dart |
| 1903 | 1890 |
| 1904 #endif // defined TARGET_ARCH_ARM | 1891 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |