| 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_IA32. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. |
| 6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
| 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 1192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1203 __ LoadObject(ECX, ic_data); | 1203 __ LoadObject(ECX, ic_data); |
| 1204 GenerateDartCall(deopt_id, | 1204 GenerateDartCall(deopt_id, |
| 1205 token_pos, | 1205 token_pos, |
| 1206 stub_entry, | 1206 stub_entry, |
| 1207 RawPcDescriptors::kUnoptStaticCall, | 1207 RawPcDescriptors::kUnoptStaticCall, |
| 1208 locs); | 1208 locs); |
| 1209 __ Drop(argument_count); | 1209 __ Drop(argument_count); |
| 1210 } | 1210 } |
| 1211 | 1211 |
| 1212 | 1212 |
| 1213 void FlowGraphCompiler::EmitEdgeCounter() { | 1213 void FlowGraphCompiler::EmitEdgeCounter(intptr_t edge_id) { |
| 1214 // We do not check for overflow when incrementing the edge counter. The | 1214 // We do not check for overflow when incrementing the edge counter. The |
| 1215 // function should normally be optimized long before the counter can | 1215 // function should normally be optimized long before the counter can |
| 1216 // overflow; and though we do not reset the counters when we optimize or | 1216 // overflow; and though we do not reset the counters when we optimize or |
| 1217 // deoptimize, there is a bound on the number of | 1217 // deoptimize, there is a bound on the number of |
| 1218 // optimization/deoptimization cycles we will attempt. | 1218 // optimization/deoptimization cycles we will attempt. |
| 1219 const Array& counter = Array::ZoneHandle(zone(), Array::New(1, Heap::kOld)); | 1219 ASSERT(!edge_counters_array_.IsNull()); |
| 1220 counter.SetAt(0, Smi::Handle(zone(), Smi::New(0))); | |
| 1221 __ Comment("Edge counter"); | 1220 __ Comment("Edge counter"); |
| 1222 __ LoadObject(EAX, counter); | 1221 __ LoadObject(EAX, edge_counters_array_); |
| 1223 intptr_t increment_start = assembler_->CodeSize(); | 1222 __ IncrementSmiField(FieldAddress(EAX, Array::element_offset(edge_id)), 1); |
| 1224 __ IncrementSmiField(FieldAddress(EAX, Array::element_offset(0)), 1); | |
| 1225 int32_t size = assembler_->CodeSize() - increment_start; | |
| 1226 if (isolate()->edge_counter_increment_size() == -1) { | |
| 1227 isolate()->set_edge_counter_increment_size(size); | |
| 1228 } else { | |
| 1229 ASSERT(size == isolate()->edge_counter_increment_size()); | |
| 1230 } | |
| 1231 } | 1223 } |
| 1232 | 1224 |
| 1233 | 1225 |
| 1234 int32_t FlowGraphCompiler::EdgeCounterIncrementSizeInBytes() { | |
| 1235 const int32_t size = Isolate::Current()->edge_counter_increment_size(); | |
| 1236 ASSERT(size != -1); | |
| 1237 return size; | |
| 1238 } | |
| 1239 | |
| 1240 | |
| 1241 void FlowGraphCompiler::EmitOptimizedInstanceCall( | 1226 void FlowGraphCompiler::EmitOptimizedInstanceCall( |
| 1242 const StubEntry& stub_entry, | 1227 const StubEntry& stub_entry, |
| 1243 const ICData& ic_data, | 1228 const ICData& ic_data, |
| 1244 intptr_t argument_count, | 1229 intptr_t argument_count, |
| 1245 intptr_t deopt_id, | 1230 intptr_t deopt_id, |
| 1246 intptr_t token_pos, | 1231 intptr_t token_pos, |
| 1247 LocationSummary* locs) { | 1232 LocationSummary* locs) { |
| 1248 ASSERT(Array::Handle(ic_data.arguments_descriptor()).Length() > 0); | 1233 ASSERT(Array::Handle(ic_data.arguments_descriptor()).Length() > 0); |
| 1249 // Each ICData propagated from unoptimized to optimized code contains the | 1234 // Each ICData propagated from unoptimized to optimized code contains the |
| 1250 // function that corresponds to the Dart function of that IC call. Due | 1235 // function that corresponds to the Dart function of that IC call. Due |
| (...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1837 __ movups(reg, Address(ESP, 0)); | 1822 __ movups(reg, Address(ESP, 0)); |
| 1838 __ addl(ESP, Immediate(kFpuRegisterSize)); | 1823 __ addl(ESP, Immediate(kFpuRegisterSize)); |
| 1839 } | 1824 } |
| 1840 | 1825 |
| 1841 | 1826 |
| 1842 #undef __ | 1827 #undef __ |
| 1843 | 1828 |
| 1844 } // namespace dart | 1829 } // namespace dart |
| 1845 | 1830 |
| 1846 #endif // defined TARGET_ARCH_IA32 | 1831 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |