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_X64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. |
6 #if defined(TARGET_ARCH_X64) | 6 #if defined(TARGET_ARCH_X64) |
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(RBX, ic_data); | 1203 __ LoadObject(RBX, 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, RCX); | 1209 __ Drop(argument_count, RCX); |
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 ASSERT(!edge_counters_array_.IsNull()); |
1219 ASSERT(assembler_->constant_pool_allowed()); | 1220 ASSERT(assembler_->constant_pool_allowed()); |
1220 const Array& counter = Array::ZoneHandle(zone(), Array::New(1, Heap::kOld)); | |
1221 counter.SetAt(0, Smi::Handle(zone(), Smi::New(0))); | |
1222 __ Comment("Edge counter"); | 1221 __ Comment("Edge counter"); |
1223 __ LoadUniqueObject(RAX, counter); | 1222 __ LoadObject(RAX, edge_counters_array_); |
1224 intptr_t increment_start = assembler_->CodeSize(); | 1223 __ IncrementSmiField(FieldAddress(RAX, Array::element_offset(edge_id)), 1); |
1225 __ IncrementSmiField(FieldAddress(RAX, Array::element_offset(0)), 1); | |
1226 int32_t size = assembler_->CodeSize() - increment_start; | |
1227 if (isolate()->edge_counter_increment_size() == -1) { | |
1228 isolate()->set_edge_counter_increment_size(size); | |
1229 } else { | |
1230 ASSERT(size == isolate()->edge_counter_increment_size()); | |
1231 } | |
1232 } | 1224 } |
1233 | 1225 |
1234 | 1226 |
1235 int32_t FlowGraphCompiler::EdgeCounterIncrementSizeInBytes() { | |
1236 const int32_t size = Isolate::Current()->edge_counter_increment_size(); | |
1237 ASSERT(size != -1); | |
1238 return size; | |
1239 } | |
1240 | |
1241 | |
1242 void FlowGraphCompiler::EmitOptimizedInstanceCall( | 1227 void FlowGraphCompiler::EmitOptimizedInstanceCall( |
1243 const StubEntry& stub_entry, | 1228 const StubEntry& stub_entry, |
1244 const ICData& ic_data, | 1229 const ICData& ic_data, |
1245 intptr_t argument_count, | 1230 intptr_t argument_count, |
1246 intptr_t deopt_id, | 1231 intptr_t deopt_id, |
1247 intptr_t token_pos, | 1232 intptr_t token_pos, |
1248 LocationSummary* locs) { | 1233 LocationSummary* locs) { |
1249 ASSERT(Array::Handle(zone(), ic_data.arguments_descriptor()).Length() > 0); | 1234 ASSERT(Array::Handle(zone(), ic_data.arguments_descriptor()).Length() > 0); |
1250 // Each ICData propagated from unoptimized to optimized code contains the | 1235 // Each ICData propagated from unoptimized to optimized code contains the |
1251 // function that corresponds to the Dart function of that IC call. Due | 1236 // function that corresponds to the Dart function of that IC call. Due |
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1765 __ movups(reg, Address(RSP, 0)); | 1750 __ movups(reg, Address(RSP, 0)); |
1766 __ AddImmediate(RSP, Immediate(kFpuRegisterSize)); | 1751 __ AddImmediate(RSP, Immediate(kFpuRegisterSize)); |
1767 } | 1752 } |
1768 | 1753 |
1769 | 1754 |
1770 #undef __ | 1755 #undef __ |
1771 | 1756 |
1772 } // namespace dart | 1757 } // namespace dart |
1773 | 1758 |
1774 #endif // defined TARGET_ARCH_X64 | 1759 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |