| 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 1154 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1165                                          const StubEntry& stub_entry, |  1165                                          const StubEntry& stub_entry, | 
|  1166                                          RawPcDescriptors::Kind kind, |  1166                                          RawPcDescriptors::Kind kind, | 
|  1167                                          LocationSummary* locs) { |  1167                                          LocationSummary* locs) { | 
|  1168   __ CallPatchable(stub_entry); |  1168   __ CallPatchable(stub_entry); | 
|  1169   AddCurrentDescriptor(kind, deopt_id, token_pos); |  1169   AddCurrentDescriptor(kind, deopt_id, token_pos); | 
|  1170   RecordSafepoint(locs); |  1170   RecordSafepoint(locs); | 
|  1171   // Marks either the continuation point in unoptimized code or the |  1171   // Marks either the continuation point in unoptimized code or the | 
|  1172   // deoptimization point in optimized code, after call. |  1172   // deoptimization point in optimized code, after call. | 
|  1173   const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); |  1173   const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); | 
|  1174   if (is_optimizing()) { |  1174   if (is_optimizing()) { | 
|  1175     AddDeoptIndexAtCall(deopt_id_after, token_pos); |  1175     AddDeoptIndexAtCall(deopt_id_after); | 
|  1176   } else { |  1176   } else { | 
|  1177     // Add deoptimization continuation point after the call and before the |  1177     // Add deoptimization continuation point after the call and before the | 
|  1178     // arguments are removed. |  1178     // arguments are removed. | 
|  1179     AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos); |  1179     AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos); | 
|  1180   } |  1180   } | 
|  1181 } |  1181 } | 
|  1182  |  1182  | 
|  1183  |  1183  | 
|  1184 void FlowGraphCompiler::GenerateStaticDartCall(intptr_t deopt_id, |  1184 void FlowGraphCompiler::GenerateStaticDartCall(intptr_t deopt_id, | 
|  1185                                                TokenPosition token_pos, |  1185                                                TokenPosition token_pos, | 
|  1186                                                const StubEntry& stub_entry, |  1186                                                const StubEntry& stub_entry, | 
|  1187                                                RawPcDescriptors::Kind kind, |  1187                                                RawPcDescriptors::Kind kind, | 
|  1188                                                LocationSummary* locs, |  1188                                                LocationSummary* locs, | 
|  1189                                                const Function& target) { |  1189                                                const Function& target) { | 
|  1190   // Call sites to the same target can share object pool entries. These |  1190   // Call sites to the same target can share object pool entries. These | 
|  1191   // call sites are never patched for breakpoints: the function is deoptimized |  1191   // call sites are never patched for breakpoints: the function is deoptimized | 
|  1192   // and the unoptimized code with IC calls for static calls is patched instead. |  1192   // and the unoptimized code with IC calls for static calls is patched instead. | 
|  1193   ASSERT(is_optimizing()); |  1193   ASSERT(is_optimizing()); | 
|  1194   __ CallWithEquivalence(stub_entry, target); |  1194   __ CallWithEquivalence(stub_entry, target); | 
|  1195  |  1195  | 
|  1196   AddCurrentDescriptor(kind, deopt_id, token_pos); |  1196   AddCurrentDescriptor(kind, deopt_id, token_pos); | 
|  1197   RecordSafepoint(locs); |  1197   RecordSafepoint(locs); | 
|  1198   // Marks either the continuation point in unoptimized code or the |  1198   // Marks either the continuation point in unoptimized code or the | 
|  1199   // deoptimization point in optimized code, after call. |  1199   // deoptimization point in optimized code, after call. | 
|  1200   const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); |  1200   const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); | 
|  1201   if (is_optimizing()) { |  1201   if (is_optimizing()) { | 
|  1202     AddDeoptIndexAtCall(deopt_id_after, token_pos); |  1202     AddDeoptIndexAtCall(deopt_id_after); | 
|  1203   } else { |  1203   } else { | 
|  1204     // Add deoptimization continuation point after the call and before the |  1204     // Add deoptimization continuation point after the call and before the | 
|  1205     // arguments are removed. |  1205     // arguments are removed. | 
|  1206     AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos); |  1206     AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos); | 
|  1207   } |  1207   } | 
|  1208   AddStaticCallTarget(target); |  1208   AddStaticCallTarget(target); | 
|  1209 } |  1209 } | 
|  1210  |  1210  | 
|  1211  |  1211  | 
|  1212 void FlowGraphCompiler::GenerateRuntimeCall(TokenPosition token_pos, |  1212 void FlowGraphCompiler::GenerateRuntimeCall(TokenPosition token_pos, | 
|  1213                                             intptr_t deopt_id, |  1213                                             intptr_t deopt_id, | 
|  1214                                             const RuntimeEntry& entry, |  1214                                             const RuntimeEntry& entry, | 
|  1215                                             intptr_t argument_count, |  1215                                             intptr_t argument_count, | 
|  1216                                             LocationSummary* locs) { |  1216                                             LocationSummary* locs) { | 
|  1217   __ CallRuntime(entry, argument_count); |  1217   __ CallRuntime(entry, argument_count); | 
|  1218   AddCurrentDescriptor(RawPcDescriptors::kOther, deopt_id, token_pos); |  1218   AddCurrentDescriptor(RawPcDescriptors::kOther, deopt_id, token_pos); | 
|  1219   RecordSafepoint(locs); |  1219   RecordSafepoint(locs); | 
|  1220   if (deopt_id != Thread::kNoDeoptId) { |  1220   if (deopt_id != Thread::kNoDeoptId) { | 
|  1221     // Marks either the continuation point in unoptimized code or the |  1221     // Marks either the continuation point in unoptimized code or the | 
|  1222     // deoptimization point in optimized code, after call. |  1222     // deoptimization point in optimized code, after call. | 
|  1223     const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); |  1223     const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); | 
|  1224     if (is_optimizing()) { |  1224     if (is_optimizing()) { | 
|  1225       AddDeoptIndexAtCall(deopt_id_after, token_pos); |  1225       AddDeoptIndexAtCall(deopt_id_after); | 
|  1226     } else { |  1226     } else { | 
|  1227       // Add deoptimization continuation point after the call and before the |  1227       // Add deoptimization continuation point after the call and before the | 
|  1228       // arguments are removed. |  1228       // arguments are removed. | 
|  1229       AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos); |  1229       AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos); | 
|  1230     } |  1230     } | 
|  1231   } |  1231   } | 
|  1232 } |  1232 } | 
|  1233  |  1233  | 
|  1234  |  1234  | 
|  1235 void FlowGraphCompiler::EmitUnoptimizedStaticCall( |  1235 void FlowGraphCompiler::EmitUnoptimizedStaticCall( | 
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1353       try_index = CurrentTryIndex(); |  1353       try_index = CurrentTryIndex(); | 
|  1354     } |  1354     } | 
|  1355     pc_descriptors_list()->AddDescriptor(RawPcDescriptors::kOther, |  1355     pc_descriptors_list()->AddDescriptor(RawPcDescriptors::kOther, | 
|  1356                                          assembler()->CodeSize(), |  1356                                          assembler()->CodeSize(), | 
|  1357                                          Thread::kNoDeoptId, |  1357                                          Thread::kNoDeoptId, | 
|  1358                                          token_pos, |  1358                                          token_pos, | 
|  1359                                          try_index); |  1359                                          try_index); | 
|  1360   } else if (is_optimizing()) { |  1360   } else if (is_optimizing()) { | 
|  1361     AddCurrentDescriptor(RawPcDescriptors::kOther, |  1361     AddCurrentDescriptor(RawPcDescriptors::kOther, | 
|  1362         Thread::kNoDeoptId, token_pos); |  1362         Thread::kNoDeoptId, token_pos); | 
|  1363     AddDeoptIndexAtCall(deopt_id_after, token_pos); |  1363     AddDeoptIndexAtCall(deopt_id_after); | 
|  1364   } else { |  1364   } else { | 
|  1365     AddCurrentDescriptor(RawPcDescriptors::kOther, |  1365     AddCurrentDescriptor(RawPcDescriptors::kOther, | 
|  1366         Thread::kNoDeoptId, token_pos); |  1366         Thread::kNoDeoptId, token_pos); | 
|  1367     // Add deoptimization continuation point after the call and before the |  1367     // Add deoptimization continuation point after the call and before the | 
|  1368     // arguments are removed. |  1368     // arguments are removed. | 
|  1369     AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos); |  1369     AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos); | 
|  1370   } |  1370   } | 
|  1371   __ Drop(argument_count, RCX); |  1371   __ Drop(argument_count, RCX); | 
|  1372 } |  1372 } | 
|  1373  |  1373  | 
| (...skipping 13 matching lines...) Expand all  Loading... | 
|  1387   __ LoadUniqueObject(RBX, ic_data); |  1387   __ LoadUniqueObject(RBX, ic_data); | 
|  1388   __ LoadUniqueObject(CODE_REG, initial_stub); |  1388   __ LoadUniqueObject(CODE_REG, initial_stub); | 
|  1389   __ movq(RCX, FieldAddress(CODE_REG, Code::checked_entry_point_offset())); |  1389   __ movq(RCX, FieldAddress(CODE_REG, Code::checked_entry_point_offset())); | 
|  1390   __ call(RCX); |  1390   __ call(RCX); | 
|  1391  |  1391  | 
|  1392   AddCurrentDescriptor(RawPcDescriptors::kOther, |  1392   AddCurrentDescriptor(RawPcDescriptors::kOther, | 
|  1393                        Thread::kNoDeoptId, token_pos); |  1393                        Thread::kNoDeoptId, token_pos); | 
|  1394   RecordSafepoint(locs); |  1394   RecordSafepoint(locs); | 
|  1395   const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); |  1395   const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); | 
|  1396   if (is_optimizing()) { |  1396   if (is_optimizing()) { | 
|  1397     AddDeoptIndexAtCall(deopt_id_after, token_pos); |  1397     AddDeoptIndexAtCall(deopt_id_after); | 
|  1398   } else { |  1398   } else { | 
|  1399     // Add deoptimization continuation point after the call and before the |  1399     // Add deoptimization continuation point after the call and before the | 
|  1400     // arguments are removed. |  1400     // arguments are removed. | 
|  1401     AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos); |  1401     AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos); | 
|  1402   } |  1402   } | 
|  1403   __ Drop(argument_count, RCX); |  1403   __ Drop(argument_count, RCX); | 
|  1404 } |  1404 } | 
|  1405  |  1405  | 
|  1406  |  1406  | 
|  1407 void FlowGraphCompiler::EmitOptimizedStaticCall( |  1407 void FlowGraphCompiler::EmitOptimizedStaticCall( | 
| (...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1864   __ movups(reg, Address(RSP, 0)); |  1864   __ movups(reg, Address(RSP, 0)); | 
|  1865   __ AddImmediate(RSP, Immediate(kFpuRegisterSize)); |  1865   __ AddImmediate(RSP, Immediate(kFpuRegisterSize)); | 
|  1866 } |  1866 } | 
|  1867  |  1867  | 
|  1868  |  1868  | 
|  1869 #undef __ |  1869 #undef __ | 
|  1870  |  1870  | 
|  1871 }  // namespace dart |  1871 }  // namespace dart | 
|  1872  |  1872  | 
|  1873 #endif  // defined TARGET_ARCH_X64 |  1873 #endif  // defined TARGET_ARCH_X64 | 
| OLD | NEW |