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