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_MIPS. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS. |
6 #if defined(TARGET_ARCH_MIPS) | 6 #if defined(TARGET_ARCH_MIPS) |
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 1080 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1091 __ break_(0); | 1091 __ break_(0); |
1092 GenerateDeferredCode(); | 1092 GenerateDeferredCode(); |
1093 } | 1093 } |
1094 | 1094 |
1095 | 1095 |
1096 void FlowGraphCompiler::GenerateCall(TokenPosition token_pos, | 1096 void FlowGraphCompiler::GenerateCall(TokenPosition token_pos, |
1097 const StubEntry& stub_entry, | 1097 const StubEntry& stub_entry, |
1098 RawPcDescriptors::Kind kind, | 1098 RawPcDescriptors::Kind kind, |
1099 LocationSummary* locs) { | 1099 LocationSummary* locs) { |
1100 __ BranchLink(stub_entry); | 1100 __ BranchLink(stub_entry); |
1101 EmitCallsiteMetaData(token_pos, Thread::kNoDeoptId, kind, locs); | 1101 AddCurrentDescriptor(kind, Thread::kNoDeoptId, token_pos); |
| 1102 RecordSafepoint(locs); |
1102 } | 1103 } |
1103 | 1104 |
1104 | 1105 |
1105 void FlowGraphCompiler::GeneratePatchableCall(TokenPosition token_pos, | 1106 void FlowGraphCompiler::GeneratePatchableCall(TokenPosition token_pos, |
1106 const StubEntry& stub_entry, | 1107 const StubEntry& stub_entry, |
1107 RawPcDescriptors::Kind kind, | 1108 RawPcDescriptors::Kind kind, |
1108 LocationSummary* locs) { | 1109 LocationSummary* locs) { |
1109 __ BranchLinkPatchable(stub_entry); | 1110 __ BranchLinkPatchable(stub_entry); |
1110 EmitCallsiteMetaData(token_pos, Thread::kNoDeoptId, kind, locs); | 1111 AddCurrentDescriptor(kind, Thread::kNoDeoptId, token_pos); |
| 1112 RecordSafepoint(locs); |
1111 } | 1113 } |
1112 | 1114 |
1113 | 1115 |
1114 void FlowGraphCompiler::GenerateDartCall(intptr_t deopt_id, | 1116 void FlowGraphCompiler::GenerateDartCall(intptr_t deopt_id, |
1115 TokenPosition token_pos, | 1117 TokenPosition token_pos, |
1116 const StubEntry& stub_entry, | 1118 const StubEntry& stub_entry, |
1117 RawPcDescriptors::Kind kind, | 1119 RawPcDescriptors::Kind kind, |
1118 LocationSummary* locs) { | 1120 LocationSummary* locs) { |
1119 __ BranchLinkPatchable(stub_entry); | 1121 __ BranchLinkPatchable(stub_entry); |
1120 EmitCallsiteMetaData(token_pos, deopt_id, kind, locs); | 1122 AddCurrentDescriptor(kind, deopt_id, token_pos); |
| 1123 RecordSafepoint(locs); |
1121 // Marks either the continuation point in unoptimized code or the | 1124 // Marks either the continuation point in unoptimized code or the |
1122 // deoptimization point in optimized code, after call. | 1125 // deoptimization point in optimized code, after call. |
1123 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); | 1126 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); |
1124 if (is_optimizing()) { | 1127 if (is_optimizing()) { |
1125 AddDeoptIndexAtCall(deopt_id_after); | 1128 AddDeoptIndexAtCall(deopt_id_after); |
1126 } else { | 1129 } else { |
1127 // Add deoptimization continuation point after the call and before the | 1130 // Add deoptimization continuation point after the call and before the |
1128 // arguments are removed. | 1131 // arguments are removed. |
1129 AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos); | 1132 AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos); |
1130 } | 1133 } |
1131 } | 1134 } |
1132 | 1135 |
1133 | 1136 |
1134 void FlowGraphCompiler::GenerateStaticDartCall(intptr_t deopt_id, | 1137 void FlowGraphCompiler::GenerateStaticDartCall(intptr_t deopt_id, |
1135 TokenPosition token_pos, | 1138 TokenPosition token_pos, |
1136 const StubEntry& stub_entry, | 1139 const StubEntry& stub_entry, |
1137 RawPcDescriptors::Kind kind, | 1140 RawPcDescriptors::Kind kind, |
1138 LocationSummary* locs, | 1141 LocationSummary* locs, |
1139 const Function& target) { | 1142 const Function& target) { |
1140 // Call sites to the same target can share object pool entries. These | 1143 // Call sites to the same target can share object pool entries. These |
1141 // call sites are never patched for breakpoints: the function is deoptimized | 1144 // call sites are never patched for breakpoints: the function is deoptimized |
1142 // and the unoptimized code with IC calls for static calls is patched instead. | 1145 // and the unoptimized code with IC calls for static calls is patched instead. |
1143 ASSERT(is_optimizing()); | 1146 ASSERT(is_optimizing()); |
1144 __ BranchLinkWithEquivalence(stub_entry, target); | 1147 __ BranchLinkWithEquivalence(stub_entry, target); |
1145 | 1148 |
1146 EmitCallsiteMetaData(token_pos, deopt_id, kind, locs); | 1149 AddCurrentDescriptor(kind, deopt_id, token_pos); |
| 1150 RecordSafepoint(locs); |
1147 // Marks either the continuation point in unoptimized code or the | 1151 // Marks either the continuation point in unoptimized code or the |
1148 // deoptimization point in optimized code, after call. | 1152 // deoptimization point in optimized code, after call. |
1149 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); | 1153 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); |
1150 if (is_optimizing()) { | 1154 if (is_optimizing()) { |
1151 AddDeoptIndexAtCall(deopt_id_after); | 1155 AddDeoptIndexAtCall(deopt_id_after); |
1152 } else { | 1156 } else { |
1153 // Add deoptimization continuation point after the call and before the | 1157 // Add deoptimization continuation point after the call and before the |
1154 // arguments are removed. | 1158 // arguments are removed. |
1155 AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos); | 1159 AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos); |
1156 } | 1160 } |
1157 AddStaticCallTarget(target); | 1161 AddStaticCallTarget(target); |
1158 } | 1162 } |
1159 | 1163 |
1160 | 1164 |
1161 void FlowGraphCompiler::GenerateRuntimeCall(TokenPosition token_pos, | 1165 void FlowGraphCompiler::GenerateRuntimeCall(TokenPosition token_pos, |
1162 intptr_t deopt_id, | 1166 intptr_t deopt_id, |
1163 const RuntimeEntry& entry, | 1167 const RuntimeEntry& entry, |
1164 intptr_t argument_count, | 1168 intptr_t argument_count, |
1165 LocationSummary* locs) { | 1169 LocationSummary* locs) { |
1166 __ CallRuntime(entry, argument_count); | 1170 __ CallRuntime(entry, argument_count); |
1167 EmitCallsiteMetaData(token_pos, deopt_id, RawPcDescriptors::kOther, locs); | 1171 AddCurrentDescriptor(RawPcDescriptors::kOther, deopt_id, token_pos); |
| 1172 RecordSafepoint(locs); |
1168 if (deopt_id != Thread::kNoDeoptId) { | 1173 if (deopt_id != Thread::kNoDeoptId) { |
1169 // Marks either the continuation point in unoptimized code or the | 1174 // Marks either the continuation point in unoptimized code or the |
1170 // deoptimization point in optimized code, after call. | 1175 // deoptimization point in optimized code, after call. |
1171 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); | 1176 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); |
1172 if (is_optimizing()) { | 1177 if (is_optimizing()) { |
1173 AddDeoptIndexAtCall(deopt_id_after); | 1178 AddDeoptIndexAtCall(deopt_id_after); |
1174 } else { | 1179 } else { |
1175 // Add deoptimization continuation point after the call and before the | 1180 // Add deoptimization continuation point after the call and before the |
1176 // arguments are removed. | 1181 // arguments are removed. |
1177 AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos); | 1182 AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos); |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1288 AddCurrentDescriptor(RawPcDescriptors::kOther, Thread::kNoDeoptId, | 1293 AddCurrentDescriptor(RawPcDescriptors::kOther, Thread::kNoDeoptId, |
1289 token_pos); | 1294 token_pos); |
1290 AddDeoptIndexAtCall(deopt_id_after); | 1295 AddDeoptIndexAtCall(deopt_id_after); |
1291 } else { | 1296 } else { |
1292 AddCurrentDescriptor(RawPcDescriptors::kOther, Thread::kNoDeoptId, | 1297 AddCurrentDescriptor(RawPcDescriptors::kOther, Thread::kNoDeoptId, |
1293 token_pos); | 1298 token_pos); |
1294 // Add deoptimization continuation point after the call and before the | 1299 // Add deoptimization continuation point after the call and before the |
1295 // arguments are removed. | 1300 // arguments are removed. |
1296 AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos); | 1301 AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos); |
1297 } | 1302 } |
1298 EmitCatchEntryState(pending_deoptimization_env_, try_index); | |
1299 __ Drop(argument_count); | 1303 __ Drop(argument_count); |
1300 } | 1304 } |
1301 | 1305 |
1302 | 1306 |
1303 void FlowGraphCompiler::EmitSwitchableInstanceCall(const ICData& ic_data, | 1307 void FlowGraphCompiler::EmitSwitchableInstanceCall(const ICData& ic_data, |
1304 intptr_t argument_count, | 1308 intptr_t argument_count, |
1305 intptr_t deopt_id, | 1309 intptr_t deopt_id, |
1306 TokenPosition token_pos, | 1310 TokenPosition token_pos, |
1307 LocationSummary* locs) { | 1311 LocationSummary* locs) { |
1308 ASSERT(ic_data.NumArgsTested() == 1); | 1312 ASSERT(ic_data.NumArgsTested() == 1); |
1309 const Code& initial_stub = | 1313 const Code& initial_stub = |
1310 Code::ZoneHandle(StubCode::ICCallThroughFunction_entry()->code()); | 1314 Code::ZoneHandle(StubCode::ICCallThroughFunction_entry()->code()); |
1311 | 1315 |
1312 __ Comment("SwitchableCall"); | 1316 __ Comment("SwitchableCall"); |
1313 __ lw(T0, Address(SP, (argument_count - 1) * kWordSize)); | 1317 __ lw(T0, Address(SP, (argument_count - 1) * kWordSize)); |
1314 __ LoadUniqueObject(CODE_REG, initial_stub); | 1318 __ LoadUniqueObject(CODE_REG, initial_stub); |
1315 __ lw(T9, FieldAddress(CODE_REG, Code::checked_entry_point_offset())); | 1319 __ lw(T9, FieldAddress(CODE_REG, Code::checked_entry_point_offset())); |
1316 __ LoadUniqueObject(S5, ic_data); | 1320 __ LoadUniqueObject(S5, ic_data); |
1317 __ jalr(T9); | 1321 __ jalr(T9); |
1318 | 1322 |
1319 EmitCallsiteMetaData(token_pos, Thread::kNoDeoptId, RawPcDescriptors::kOther, | 1323 AddCurrentDescriptor(RawPcDescriptors::kOther, Thread::kNoDeoptId, token_pos); |
1320 locs); | 1324 RecordSafepoint(locs); |
1321 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); | 1325 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); |
1322 if (is_optimizing()) { | 1326 if (is_optimizing()) { |
1323 AddDeoptIndexAtCall(deopt_id_after); | 1327 AddDeoptIndexAtCall(deopt_id_after); |
1324 } else { | 1328 } else { |
1325 // Add deoptimization continuation point after the call and before the | 1329 // Add deoptimization continuation point after the call and before the |
1326 // arguments are removed. | 1330 // arguments are removed. |
1327 AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos); | 1331 AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos); |
1328 } | 1332 } |
1329 __ Drop(argument_count); | 1333 __ Drop(argument_count); |
1330 } | 1334 } |
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1865 __ AddImmediate(SP, kDoubleSize); | 1869 __ AddImmediate(SP, kDoubleSize); |
1866 } | 1870 } |
1867 | 1871 |
1868 | 1872 |
1869 #undef __ | 1873 #undef __ |
1870 | 1874 |
1871 | 1875 |
1872 } // namespace dart | 1876 } // namespace dart |
1873 | 1877 |
1874 #endif // defined TARGET_ARCH_MIPS | 1878 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |