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 1216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1227 __ LoadObject(RBX, ic_data); | 1227 __ LoadObject(RBX, ic_data); |
1228 GenerateDartCall(deopt_id, | 1228 GenerateDartCall(deopt_id, |
1229 token_pos, | 1229 token_pos, |
1230 *stub_entry, | 1230 *stub_entry, |
1231 RawPcDescriptors::kUnoptStaticCall, | 1231 RawPcDescriptors::kUnoptStaticCall, |
1232 locs); | 1232 locs); |
1233 __ Drop(argument_count, RCX); | 1233 __ Drop(argument_count, RCX); |
1234 } | 1234 } |
1235 | 1235 |
1236 | 1236 |
1237 void FlowGraphCompiler::EmitEdgeCounter() { | 1237 void FlowGraphCompiler::EmitEdgeCounter(intptr_t edge_id) { |
1238 // We do not check for overflow when incrementing the edge counter. The | 1238 // We do not check for overflow when incrementing the edge counter. The |
1239 // function should normally be optimized long before the counter can | 1239 // function should normally be optimized long before the counter can |
1240 // overflow; and though we do not reset the counters when we optimize or | 1240 // overflow; and though we do not reset the counters when we optimize or |
1241 // deoptimize, there is a bound on the number of | 1241 // deoptimize, there is a bound on the number of |
1242 // optimization/deoptimization cycles we will attempt. | 1242 // optimization/deoptimization cycles we will attempt. |
| 1243 ASSERT(!edge_counters_array_.IsNull()); |
1243 ASSERT(assembler_->constant_pool_allowed()); | 1244 ASSERT(assembler_->constant_pool_allowed()); |
1244 const Array& counter = Array::ZoneHandle(zone(), Array::New(1, Heap::kOld)); | |
1245 counter.SetAt(0, Smi::Handle(zone(), Smi::New(0))); | |
1246 __ Comment("Edge counter"); | 1245 __ Comment("Edge counter"); |
1247 __ LoadUniqueObject(RAX, counter); | 1246 __ LoadObject(RAX, edge_counters_array_); |
1248 intptr_t increment_start = assembler_->CodeSize(); | 1247 __ IncrementSmiField(FieldAddress(RAX, Array::element_offset(edge_id)), 1); |
1249 __ IncrementSmiField(FieldAddress(RAX, Array::element_offset(0)), 1); | |
1250 int32_t size = assembler_->CodeSize() - increment_start; | |
1251 if (isolate()->edge_counter_increment_size() == -1) { | |
1252 isolate()->set_edge_counter_increment_size(size); | |
1253 } else { | |
1254 ASSERT(size == isolate()->edge_counter_increment_size()); | |
1255 } | |
1256 } | 1248 } |
1257 | 1249 |
1258 | 1250 |
1259 int32_t FlowGraphCompiler::EdgeCounterIncrementSizeInBytes() { | |
1260 const int32_t size = Isolate::Current()->edge_counter_increment_size(); | |
1261 ASSERT(size != -1); | |
1262 return size; | |
1263 } | |
1264 | |
1265 | |
1266 void FlowGraphCompiler::EmitOptimizedInstanceCall( | 1251 void FlowGraphCompiler::EmitOptimizedInstanceCall( |
1267 const StubEntry& stub_entry, | 1252 const StubEntry& stub_entry, |
1268 const ICData& ic_data, | 1253 const ICData& ic_data, |
1269 intptr_t argument_count, | 1254 intptr_t argument_count, |
1270 intptr_t deopt_id, | 1255 intptr_t deopt_id, |
1271 intptr_t token_pos, | 1256 intptr_t token_pos, |
1272 LocationSummary* locs) { | 1257 LocationSummary* locs) { |
1273 ASSERT(Array::Handle(zone(), ic_data.arguments_descriptor()).Length() > 0); | 1258 ASSERT(Array::Handle(zone(), ic_data.arguments_descriptor()).Length() > 0); |
1274 // Each ICData propagated from unoptimized to optimized code contains the | 1259 // Each ICData propagated from unoptimized to optimized code contains the |
1275 // function that corresponds to the Dart function of that IC call. Due | 1260 // 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... |
1789 __ movups(reg, Address(RSP, 0)); | 1774 __ movups(reg, Address(RSP, 0)); |
1790 __ AddImmediate(RSP, Immediate(kFpuRegisterSize)); | 1775 __ AddImmediate(RSP, Immediate(kFpuRegisterSize)); |
1791 } | 1776 } |
1792 | 1777 |
1793 | 1778 |
1794 #undef __ | 1779 #undef __ |
1795 | 1780 |
1796 } // namespace dart | 1781 } // namespace dart |
1797 | 1782 |
1798 #endif // defined TARGET_ARCH_X64 | 1783 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |