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