OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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_ARM64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM64. |
6 #if defined(TARGET_ARCH_ARM64) | 6 #if defined(TARGET_ARCH_ARM64) |
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 1060 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1071 ASSERT(assembler()->constant_pool_allowed()); | 1071 ASSERT(assembler()->constant_pool_allowed()); |
1072 GenerateDeferredCode(); | 1072 GenerateDeferredCode(); |
1073 } | 1073 } |
1074 | 1074 |
1075 | 1075 |
1076 void FlowGraphCompiler::GenerateCall(TokenPosition token_pos, | 1076 void FlowGraphCompiler::GenerateCall(TokenPosition token_pos, |
1077 const StubEntry& stub_entry, | 1077 const StubEntry& stub_entry, |
1078 RawPcDescriptors::Kind kind, | 1078 RawPcDescriptors::Kind kind, |
1079 LocationSummary* locs) { | 1079 LocationSummary* locs) { |
1080 __ BranchLink(stub_entry); | 1080 __ BranchLink(stub_entry); |
1081 AddCurrentDescriptor(kind, Thread::kNoDeoptId, token_pos); | 1081 EmitCallsiteMetaData(token_pos, Thread::kNoDeoptId, kind, locs); |
1082 RecordSafepoint(locs); | |
1083 } | 1082 } |
1084 | 1083 |
1085 | 1084 |
1086 void FlowGraphCompiler::GeneratePatchableCall(TokenPosition token_pos, | 1085 void FlowGraphCompiler::GeneratePatchableCall(TokenPosition token_pos, |
1087 const StubEntry& stub_entry, | 1086 const StubEntry& stub_entry, |
1088 RawPcDescriptors::Kind kind, | 1087 RawPcDescriptors::Kind kind, |
1089 LocationSummary* locs) { | 1088 LocationSummary* locs) { |
1090 __ BranchLinkPatchable(stub_entry); | 1089 __ BranchLinkPatchable(stub_entry); |
1091 AddCurrentDescriptor(kind, Thread::kNoDeoptId, token_pos); | 1090 EmitCallsiteMetaData(token_pos, Thread::kNoDeoptId, kind, locs); |
1092 RecordSafepoint(locs); | |
1093 } | 1091 } |
1094 | 1092 |
1095 | 1093 |
1096 void FlowGraphCompiler::GenerateDartCall(intptr_t deopt_id, | 1094 void FlowGraphCompiler::GenerateDartCall(intptr_t deopt_id, |
1097 TokenPosition token_pos, | 1095 TokenPosition token_pos, |
1098 const StubEntry& stub_entry, | 1096 const StubEntry& stub_entry, |
1099 RawPcDescriptors::Kind kind, | 1097 RawPcDescriptors::Kind kind, |
1100 LocationSummary* locs) { | 1098 LocationSummary* locs) { |
1101 __ BranchLinkPatchable(stub_entry); | 1099 __ BranchLinkPatchable(stub_entry); |
1102 AddCurrentDescriptor(kind, deopt_id, token_pos); | 1100 EmitCallsiteMetaData(token_pos, deopt_id, kind, locs); |
1103 RecordSafepoint(locs); | |
1104 // Marks either the continuation point in unoptimized code or the | 1101 // Marks either the continuation point in unoptimized code or the |
1105 // deoptimization point in optimized code, after call. | 1102 // deoptimization point in optimized code, after call. |
1106 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); | 1103 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); |
1107 if (is_optimizing()) { | 1104 if (is_optimizing()) { |
1108 AddDeoptIndexAtCall(deopt_id_after); | 1105 AddDeoptIndexAtCall(deopt_id_after); |
1109 } else { | 1106 } else { |
1110 // Add deoptimization continuation point after the call and before the | 1107 // Add deoptimization continuation point after the call and before the |
1111 // arguments are removed. | 1108 // arguments are removed. |
1112 AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos); | 1109 AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos); |
1113 } | 1110 } |
1114 } | 1111 } |
1115 | 1112 |
1116 | 1113 |
1117 void FlowGraphCompiler::GenerateStaticDartCall(intptr_t deopt_id, | 1114 void FlowGraphCompiler::GenerateStaticDartCall(intptr_t deopt_id, |
1118 TokenPosition token_pos, | 1115 TokenPosition token_pos, |
1119 const StubEntry& stub_entry, | 1116 const StubEntry& stub_entry, |
1120 RawPcDescriptors::Kind kind, | 1117 RawPcDescriptors::Kind kind, |
1121 LocationSummary* locs, | 1118 LocationSummary* locs, |
1122 const Function& target) { | 1119 const Function& target) { |
1123 // Call sites to the same target can share object pool entries. These | 1120 // Call sites to the same target can share object pool entries. These |
1124 // call sites are never patched for breakpoints: the function is deoptimized | 1121 // call sites are never patched for breakpoints: the function is deoptimized |
1125 // and the unoptimized code with IC calls for static calls is patched instead. | 1122 // and the unoptimized code with IC calls for static calls is patched instead. |
1126 ASSERT(is_optimizing()); | 1123 ASSERT(is_optimizing()); |
1127 __ BranchLinkWithEquivalence(stub_entry, target); | 1124 __ BranchLinkWithEquivalence(stub_entry, target); |
1128 | 1125 |
1129 AddCurrentDescriptor(kind, deopt_id, token_pos); | 1126 EmitCallsiteMetaData(token_pos, deopt_id, kind, locs); |
1130 RecordSafepoint(locs); | |
1131 // Marks either the continuation point in unoptimized code or the | 1127 // Marks either the continuation point in unoptimized code or the |
1132 // deoptimization point in optimized code, after call. | 1128 // deoptimization point in optimized code, after call. |
1133 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); | 1129 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); |
1134 if (is_optimizing()) { | 1130 if (is_optimizing()) { |
1135 AddDeoptIndexAtCall(deopt_id_after); | 1131 AddDeoptIndexAtCall(deopt_id_after); |
1136 } else { | 1132 } else { |
1137 // Add deoptimization continuation point after the call and before the | 1133 // Add deoptimization continuation point after the call and before the |
1138 // arguments are removed. | 1134 // arguments are removed. |
1139 AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos); | 1135 AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos); |
1140 } | 1136 } |
1141 AddStaticCallTarget(target); | 1137 AddStaticCallTarget(target); |
1142 } | 1138 } |
1143 | 1139 |
1144 | 1140 |
1145 void FlowGraphCompiler::GenerateRuntimeCall(TokenPosition token_pos, | 1141 void FlowGraphCompiler::GenerateRuntimeCall(TokenPosition token_pos, |
1146 intptr_t deopt_id, | 1142 intptr_t deopt_id, |
1147 const RuntimeEntry& entry, | 1143 const RuntimeEntry& entry, |
1148 intptr_t argument_count, | 1144 intptr_t argument_count, |
1149 LocationSummary* locs) { | 1145 LocationSummary* locs) { |
1150 __ CallRuntime(entry, argument_count); | 1146 __ CallRuntime(entry, argument_count); |
1151 AddCurrentDescriptor(RawPcDescriptors::kOther, deopt_id, token_pos); | 1147 EmitCallsiteMetaData(token_pos, deopt_id, RawPcDescriptors::kOther, locs); |
1152 RecordSafepoint(locs); | |
1153 if (deopt_id != Thread::kNoDeoptId) { | 1148 if (deopt_id != Thread::kNoDeoptId) { |
1154 // Marks either the continuation point in unoptimized code or the | 1149 // Marks either the continuation point in unoptimized code or the |
1155 // deoptimization point in optimized code, after call. | 1150 // deoptimization point in optimized code, after call. |
1156 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); | 1151 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); |
1157 if (is_optimizing()) { | 1152 if (is_optimizing()) { |
1158 AddDeoptIndexAtCall(deopt_id_after); | 1153 AddDeoptIndexAtCall(deopt_id_after); |
1159 } else { | 1154 } else { |
1160 // Add deoptimization continuation point after the call and before the | 1155 // Add deoptimization continuation point after the call and before the |
1161 // arguments are removed. | 1156 // arguments are removed. |
1162 AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos); | 1157 AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos); |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1276 AddCurrentDescriptor(RawPcDescriptors::kOther, Thread::kNoDeoptId, | 1271 AddCurrentDescriptor(RawPcDescriptors::kOther, Thread::kNoDeoptId, |
1277 token_pos); | 1272 token_pos); |
1278 AddDeoptIndexAtCall(deopt_id_after); | 1273 AddDeoptIndexAtCall(deopt_id_after); |
1279 } else { | 1274 } else { |
1280 AddCurrentDescriptor(RawPcDescriptors::kOther, Thread::kNoDeoptId, | 1275 AddCurrentDescriptor(RawPcDescriptors::kOther, Thread::kNoDeoptId, |
1281 token_pos); | 1276 token_pos); |
1282 // Add deoptimization continuation point after the call and before the | 1277 // Add deoptimization continuation point after the call and before the |
1283 // arguments are removed. | 1278 // arguments are removed. |
1284 AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos); | 1279 AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos); |
1285 } | 1280 } |
| 1281 EmitCatchEntryState(pending_deoptimization_env_, try_index); |
1286 __ Drop(argument_count); | 1282 __ Drop(argument_count); |
1287 } | 1283 } |
1288 | 1284 |
1289 | 1285 |
1290 void FlowGraphCompiler::EmitSwitchableInstanceCall(const ICData& ic_data, | 1286 void FlowGraphCompiler::EmitSwitchableInstanceCall(const ICData& ic_data, |
1291 intptr_t argument_count, | 1287 intptr_t argument_count, |
1292 intptr_t deopt_id, | 1288 intptr_t deopt_id, |
1293 TokenPosition token_pos, | 1289 TokenPosition token_pos, |
1294 LocationSummary* locs) { | 1290 LocationSummary* locs) { |
1295 ASSERT(ic_data.NumArgsTested() == 1); | 1291 ASSERT(ic_data.NumArgsTested() == 1); |
1296 const Code& initial_stub = | 1292 const Code& initial_stub = |
1297 Code::ZoneHandle(StubCode::ICCallThroughFunction_entry()->code()); | 1293 Code::ZoneHandle(StubCode::ICCallThroughFunction_entry()->code()); |
1298 __ Comment("SwitchableCall"); | 1294 __ Comment("SwitchableCall"); |
1299 | 1295 |
1300 __ LoadFromOffset(R0, SP, (argument_count - 1) * kWordSize); | 1296 __ LoadFromOffset(R0, SP, (argument_count - 1) * kWordSize); |
1301 __ LoadUniqueObject(CODE_REG, initial_stub); | 1297 __ LoadUniqueObject(CODE_REG, initial_stub); |
1302 __ ldr(TMP, FieldAddress(CODE_REG, Code::checked_entry_point_offset())); | 1298 __ ldr(TMP, FieldAddress(CODE_REG, Code::checked_entry_point_offset())); |
1303 __ LoadUniqueObject(R5, ic_data); | 1299 __ LoadUniqueObject(R5, ic_data); |
1304 __ blr(TMP); | 1300 __ blr(TMP); |
1305 | 1301 |
1306 AddCurrentDescriptor(RawPcDescriptors::kOther, Thread::kNoDeoptId, token_pos); | 1302 EmitCallsiteMetaData(token_pos, Thread::kNoDeoptId, RawPcDescriptors::kOther, |
1307 RecordSafepoint(locs); | 1303 locs); |
1308 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); | 1304 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); |
1309 if (is_optimizing()) { | 1305 if (is_optimizing()) { |
1310 AddDeoptIndexAtCall(deopt_id_after); | 1306 AddDeoptIndexAtCall(deopt_id_after); |
1311 } else { | 1307 } else { |
1312 // Add deoptimization continuation point after the call and before the | 1308 // Add deoptimization continuation point after the call and before the |
1313 // arguments are removed. | 1309 // arguments are removed. |
1314 AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos); | 1310 AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos); |
1315 } | 1311 } |
1316 __ Drop(argument_count); | 1312 __ Drop(argument_count); |
1317 } | 1313 } |
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1849 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { | 1845 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { |
1850 __ PopDouble(reg); | 1846 __ PopDouble(reg); |
1851 } | 1847 } |
1852 | 1848 |
1853 | 1849 |
1854 #undef __ | 1850 #undef __ |
1855 | 1851 |
1856 } // namespace dart | 1852 } // namespace dart |
1857 | 1853 |
1858 #endif // defined TARGET_ARCH_ARM64 | 1854 #endif // defined TARGET_ARCH_ARM64 |
OLD | NEW |