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_ARM. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM. |
6 #if defined(TARGET_ARCH_ARM) | 6 #if defined(TARGET_ARCH_ARM) |
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 1064 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1075 ASSERT(assembler()->constant_pool_allowed()); | 1075 ASSERT(assembler()->constant_pool_allowed()); |
1076 GenerateDeferredCode(); | 1076 GenerateDeferredCode(); |
1077 } | 1077 } |
1078 | 1078 |
1079 | 1079 |
1080 void FlowGraphCompiler::GenerateCall(TokenPosition token_pos, | 1080 void FlowGraphCompiler::GenerateCall(TokenPosition token_pos, |
1081 const StubEntry& stub_entry, | 1081 const StubEntry& stub_entry, |
1082 RawPcDescriptors::Kind kind, | 1082 RawPcDescriptors::Kind kind, |
1083 LocationSummary* locs) { | 1083 LocationSummary* locs) { |
1084 __ BranchLink(stub_entry); | 1084 __ BranchLink(stub_entry); |
1085 EmitCallsiteMetaData(token_pos, Thread::kNoDeoptId, kind, locs); | 1085 AddCurrentDescriptor(kind, Thread::kNoDeoptId, token_pos); |
| 1086 RecordSafepoint(locs); |
1086 } | 1087 } |
1087 | 1088 |
1088 | 1089 |
1089 void FlowGraphCompiler::GeneratePatchableCall(TokenPosition token_pos, | 1090 void FlowGraphCompiler::GeneratePatchableCall(TokenPosition token_pos, |
1090 const StubEntry& stub_entry, | 1091 const StubEntry& stub_entry, |
1091 RawPcDescriptors::Kind kind, | 1092 RawPcDescriptors::Kind kind, |
1092 LocationSummary* locs) { | 1093 LocationSummary* locs) { |
1093 __ BranchLinkPatchable(stub_entry); | 1094 __ BranchLinkPatchable(stub_entry); |
1094 EmitCallsiteMetaData(token_pos, Thread::kNoDeoptId, kind, locs); | 1095 AddCurrentDescriptor(kind, Thread::kNoDeoptId, token_pos); |
| 1096 RecordSafepoint(locs); |
1095 } | 1097 } |
1096 | 1098 |
1097 | 1099 |
1098 void FlowGraphCompiler::GenerateDartCall(intptr_t deopt_id, | 1100 void FlowGraphCompiler::GenerateDartCall(intptr_t deopt_id, |
1099 TokenPosition token_pos, | 1101 TokenPosition token_pos, |
1100 const StubEntry& stub_entry, | 1102 const StubEntry& stub_entry, |
1101 RawPcDescriptors::Kind kind, | 1103 RawPcDescriptors::Kind kind, |
1102 LocationSummary* locs) { | 1104 LocationSummary* locs) { |
1103 __ BranchLinkPatchable(stub_entry); | 1105 __ BranchLinkPatchable(stub_entry); |
1104 EmitCallsiteMetaData(token_pos, deopt_id, kind, locs); | 1106 AddCurrentDescriptor(kind, deopt_id, token_pos); |
| 1107 RecordSafepoint(locs); |
1105 // Marks either the continuation point in unoptimized code or the | 1108 // Marks either the continuation point in unoptimized code or the |
1106 // deoptimization point in optimized code, after call. | 1109 // deoptimization point in optimized code, after call. |
1107 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); | 1110 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); |
1108 if (is_optimizing()) { | 1111 if (is_optimizing()) { |
1109 AddDeoptIndexAtCall(deopt_id_after); | 1112 AddDeoptIndexAtCall(deopt_id_after); |
1110 } else { | 1113 } else { |
1111 // Add deoptimization continuation point after the call and before the | 1114 // Add deoptimization continuation point after the call and before the |
1112 // arguments are removed. | 1115 // arguments are removed. |
1113 AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos); | 1116 AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos); |
1114 } | 1117 } |
1115 } | 1118 } |
1116 | 1119 |
1117 | 1120 |
1118 void FlowGraphCompiler::GenerateStaticDartCall(intptr_t deopt_id, | 1121 void FlowGraphCompiler::GenerateStaticDartCall(intptr_t deopt_id, |
1119 TokenPosition token_pos, | 1122 TokenPosition token_pos, |
1120 const StubEntry& stub_entry, | 1123 const StubEntry& stub_entry, |
1121 RawPcDescriptors::Kind kind, | 1124 RawPcDescriptors::Kind kind, |
1122 LocationSummary* locs, | 1125 LocationSummary* locs, |
1123 const Function& target) { | 1126 const Function& target) { |
1124 // Call sites to the same target can share object pool entries. These | 1127 // Call sites to the same target can share object pool entries. These |
1125 // call sites are never patched for breakpoints: the function is deoptimized | 1128 // call sites are never patched for breakpoints: the function is deoptimized |
1126 // and the unoptimized code with IC calls for static calls is patched instead. | 1129 // and the unoptimized code with IC calls for static calls is patched instead. |
1127 ASSERT(is_optimizing()); | 1130 ASSERT(is_optimizing()); |
1128 __ BranchLinkWithEquivalence(stub_entry, target); | 1131 __ BranchLinkWithEquivalence(stub_entry, target); |
1129 | 1132 |
1130 EmitCallsiteMetaData(token_pos, deopt_id, kind, locs); | 1133 AddCurrentDescriptor(kind, deopt_id, token_pos); |
| 1134 RecordSafepoint(locs); |
1131 // Marks either the continuation point in unoptimized code or the | 1135 // Marks either the continuation point in unoptimized code or the |
1132 // deoptimization point in optimized code, after call. | 1136 // deoptimization point in optimized code, after call. |
1133 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); | 1137 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); |
1134 if (is_optimizing()) { | 1138 if (is_optimizing()) { |
1135 AddDeoptIndexAtCall(deopt_id_after); | 1139 AddDeoptIndexAtCall(deopt_id_after); |
1136 } else { | 1140 } else { |
1137 // Add deoptimization continuation point after the call and before the | 1141 // Add deoptimization continuation point after the call and before the |
1138 // arguments are removed. | 1142 // arguments are removed. |
1139 AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos); | 1143 AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos); |
1140 } | 1144 } |
1141 AddStaticCallTarget(target); | 1145 AddStaticCallTarget(target); |
1142 } | 1146 } |
1143 | 1147 |
1144 | 1148 |
1145 void FlowGraphCompiler::GenerateRuntimeCall(TokenPosition token_pos, | 1149 void FlowGraphCompiler::GenerateRuntimeCall(TokenPosition token_pos, |
1146 intptr_t deopt_id, | 1150 intptr_t deopt_id, |
1147 const RuntimeEntry& entry, | 1151 const RuntimeEntry& entry, |
1148 intptr_t argument_count, | 1152 intptr_t argument_count, |
1149 LocationSummary* locs) { | 1153 LocationSummary* locs) { |
1150 __ CallRuntime(entry, argument_count); | 1154 __ CallRuntime(entry, argument_count); |
1151 EmitCallsiteMetaData(token_pos, deopt_id, RawPcDescriptors::kOther, locs); | 1155 AddCurrentDescriptor(RawPcDescriptors::kOther, deopt_id, token_pos); |
| 1156 RecordSafepoint(locs); |
1152 if (deopt_id != Thread::kNoDeoptId) { | 1157 if (deopt_id != Thread::kNoDeoptId) { |
1153 // Marks either the continuation point in unoptimized code or the | 1158 // Marks either the continuation point in unoptimized code or the |
1154 // deoptimization point in optimized code, after call. | 1159 // deoptimization point in optimized code, after call. |
1155 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); | 1160 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); |
1156 if (is_optimizing()) { | 1161 if (is_optimizing()) { |
1157 AddDeoptIndexAtCall(deopt_id_after); | 1162 AddDeoptIndexAtCall(deopt_id_after); |
1158 } else { | 1163 } else { |
1159 // Add deoptimization continuation point after the call and before the | 1164 // Add deoptimization continuation point after the call and before the |
1160 // arguments are removed. | 1165 // arguments are removed. |
1161 AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos); | 1166 AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos); |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1283 AddCurrentDescriptor(RawPcDescriptors::kOther, Thread::kNoDeoptId, | 1288 AddCurrentDescriptor(RawPcDescriptors::kOther, Thread::kNoDeoptId, |
1284 token_pos); | 1289 token_pos); |
1285 AddDeoptIndexAtCall(deopt_id_after); | 1290 AddDeoptIndexAtCall(deopt_id_after); |
1286 } else { | 1291 } else { |
1287 AddCurrentDescriptor(RawPcDescriptors::kOther, Thread::kNoDeoptId, | 1292 AddCurrentDescriptor(RawPcDescriptors::kOther, Thread::kNoDeoptId, |
1288 token_pos); | 1293 token_pos); |
1289 // Add deoptimization continuation point after the call and before the | 1294 // Add deoptimization continuation point after the call and before the |
1290 // arguments are removed. | 1295 // arguments are removed. |
1291 AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos); | 1296 AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos); |
1292 } | 1297 } |
1293 EmitCatchEntryState(pending_deoptimization_env_, try_index); | |
1294 __ Drop(argument_count); | 1298 __ Drop(argument_count); |
1295 } | 1299 } |
1296 | 1300 |
1297 | 1301 |
1298 void FlowGraphCompiler::EmitSwitchableInstanceCall(const ICData& ic_data, | 1302 void FlowGraphCompiler::EmitSwitchableInstanceCall(const ICData& ic_data, |
1299 intptr_t argument_count, | 1303 intptr_t argument_count, |
1300 intptr_t deopt_id, | 1304 intptr_t deopt_id, |
1301 TokenPosition token_pos, | 1305 TokenPosition token_pos, |
1302 LocationSummary* locs) { | 1306 LocationSummary* locs) { |
1303 ASSERT(ic_data.NumArgsTested() == 1); | 1307 ASSERT(ic_data.NumArgsTested() == 1); |
1304 const Code& initial_stub = | 1308 const Code& initial_stub = |
1305 Code::ZoneHandle(StubCode::ICCallThroughFunction_entry()->code()); | 1309 Code::ZoneHandle(StubCode::ICCallThroughFunction_entry()->code()); |
1306 | 1310 |
1307 __ Comment("SwitchableCall"); | 1311 __ Comment("SwitchableCall"); |
1308 | 1312 |
1309 __ LoadFromOffset(kWord, R0, SP, (argument_count - 1) * kWordSize); | 1313 __ LoadFromOffset(kWord, R0, SP, (argument_count - 1) * kWordSize); |
1310 __ LoadUniqueObject(CODE_REG, initial_stub); | 1314 __ LoadUniqueObject(CODE_REG, initial_stub); |
1311 __ ldr(LR, FieldAddress(CODE_REG, Code::checked_entry_point_offset())); | 1315 __ ldr(LR, FieldAddress(CODE_REG, Code::checked_entry_point_offset())); |
1312 __ LoadUniqueObject(R9, ic_data); | 1316 __ LoadUniqueObject(R9, ic_data); |
1313 __ blx(LR); | 1317 __ blx(LR); |
1314 | 1318 |
1315 EmitCallsiteMetaData(token_pos, Thread::kNoDeoptId, RawPcDescriptors::kOther, | 1319 AddCurrentDescriptor(RawPcDescriptors::kOther, Thread::kNoDeoptId, token_pos); |
1316 locs); | 1320 RecordSafepoint(locs); |
1317 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); | 1321 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); |
1318 if (is_optimizing()) { | 1322 if (is_optimizing()) { |
1319 AddDeoptIndexAtCall(deopt_id_after); | 1323 AddDeoptIndexAtCall(deopt_id_after); |
1320 } else { | 1324 } else { |
1321 // Add deoptimization continuation point after the call and before the | 1325 // Add deoptimization continuation point after the call and before the |
1322 // arguments are removed. | 1326 // arguments are removed. |
1323 AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos); | 1327 AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos); |
1324 } | 1328 } |
1325 __ Drop(argument_count); | 1329 __ Drop(argument_count); |
1326 } | 1330 } |
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1902 DRegister dreg = EvenDRegisterOf(reg); | 1906 DRegister dreg = EvenDRegisterOf(reg); |
1903 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex)); | 1907 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex)); |
1904 } | 1908 } |
1905 | 1909 |
1906 | 1910 |
1907 #undef __ | 1911 #undef __ |
1908 | 1912 |
1909 } // namespace dart | 1913 } // namespace dart |
1910 | 1914 |
1911 #endif // defined TARGET_ARCH_ARM | 1915 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |