| 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 current = current->outer(); | 119 current = current->outer(); |
| 120 while (current != NULL) { | 120 while (current != NULL) { |
| 121 builder->AddPp(current->function(), slot_ix++); | 121 builder->AddPp(current->function(), slot_ix++); |
| 122 builder->AddPcMarker(previous->function(), slot_ix++); | 122 builder->AddPcMarker(previous->function(), slot_ix++); |
| 123 builder->AddCallerFp(slot_ix++); | 123 builder->AddCallerFp(slot_ix++); |
| 124 | 124 |
| 125 // For any outer environment the deopt id is that of the call instruction | 125 // For any outer environment the deopt id is that of the call instruction |
| 126 // which is recorded in the outer environment. | 126 // which is recorded in the outer environment. |
| 127 builder->AddReturnAddress( | 127 builder->AddReturnAddress( |
| 128 current->function(), | 128 current->function(), |
| 129 Isolate::ToDeoptAfter(current->deopt_id()), | 129 Thread::ToDeoptAfter(current->deopt_id()), |
| 130 slot_ix++); | 130 slot_ix++); |
| 131 | 131 |
| 132 // The values of outgoing arguments can be changed from the inlined call so | 132 // The values of outgoing arguments can be changed from the inlined call so |
| 133 // we must read them from the previous environment. | 133 // we must read them from the previous environment. |
| 134 for (intptr_t i = previous->fixed_parameter_count() - 1; i >= 0; i--) { | 134 for (intptr_t i = previous->fixed_parameter_count() - 1; i >= 0; i--) { |
| 135 builder->AddCopy(previous->ValueAt(i), | 135 builder->AddCopy(previous->ValueAt(i), |
| 136 previous->LocationAt(i), | 136 previous->LocationAt(i), |
| 137 slot_ix++); | 137 slot_ix++); |
| 138 } | 138 } |
| 139 | 139 |
| (...skipping 1004 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1144 __ Branch(*StubCode::DeoptimizeLazy_entry()); | 1144 __ Branch(*StubCode::DeoptimizeLazy_entry()); |
| 1145 } | 1145 } |
| 1146 } | 1146 } |
| 1147 | 1147 |
| 1148 | 1148 |
| 1149 void FlowGraphCompiler::GenerateCall(intptr_t token_pos, | 1149 void FlowGraphCompiler::GenerateCall(intptr_t token_pos, |
| 1150 const StubEntry& stub_entry, | 1150 const StubEntry& stub_entry, |
| 1151 RawPcDescriptors::Kind kind, | 1151 RawPcDescriptors::Kind kind, |
| 1152 LocationSummary* locs) { | 1152 LocationSummary* locs) { |
| 1153 __ BranchLinkPatchable(stub_entry); | 1153 __ BranchLinkPatchable(stub_entry); |
| 1154 AddCurrentDescriptor(kind, Isolate::kNoDeoptId, token_pos); | 1154 AddCurrentDescriptor(kind, Thread::kNoDeoptId, token_pos); |
| 1155 RecordSafepoint(locs); | 1155 RecordSafepoint(locs); |
| 1156 } | 1156 } |
| 1157 | 1157 |
| 1158 | 1158 |
| 1159 void FlowGraphCompiler::GenerateDartCall(intptr_t deopt_id, | 1159 void FlowGraphCompiler::GenerateDartCall(intptr_t deopt_id, |
| 1160 intptr_t token_pos, | 1160 intptr_t token_pos, |
| 1161 const StubEntry& stub_entry, | 1161 const StubEntry& stub_entry, |
| 1162 RawPcDescriptors::Kind kind, | 1162 RawPcDescriptors::Kind kind, |
| 1163 LocationSummary* locs) { | 1163 LocationSummary* locs) { |
| 1164 __ BranchLinkPatchable(stub_entry); | 1164 __ BranchLinkPatchable(stub_entry); |
| 1165 AddCurrentDescriptor(kind, deopt_id, token_pos); | 1165 AddCurrentDescriptor(kind, deopt_id, token_pos); |
| 1166 RecordSafepoint(locs); | 1166 RecordSafepoint(locs); |
| 1167 // Marks either the continuation point in unoptimized code or the | 1167 // Marks either the continuation point in unoptimized code or the |
| 1168 // deoptimization point in optimized code, after call. | 1168 // deoptimization point in optimized code, after call. |
| 1169 const intptr_t deopt_id_after = Isolate::ToDeoptAfter(deopt_id); | 1169 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); |
| 1170 if (is_optimizing()) { | 1170 if (is_optimizing()) { |
| 1171 AddDeoptIndexAtCall(deopt_id_after, token_pos); | 1171 AddDeoptIndexAtCall(deopt_id_after, token_pos); |
| 1172 } else { | 1172 } else { |
| 1173 // Add deoptimization continuation point after the call and before the | 1173 // Add deoptimization continuation point after the call and before the |
| 1174 // arguments are removed. | 1174 // arguments are removed. |
| 1175 AddCurrentDescriptor(RawPcDescriptors::kDeopt, | 1175 AddCurrentDescriptor(RawPcDescriptors::kDeopt, |
| 1176 deopt_id_after, | 1176 deopt_id_after, |
| 1177 token_pos); | 1177 token_pos); |
| 1178 } | 1178 } |
| 1179 } | 1179 } |
| 1180 | 1180 |
| 1181 | 1181 |
| 1182 void FlowGraphCompiler::GenerateRuntimeCall(intptr_t token_pos, | 1182 void FlowGraphCompiler::GenerateRuntimeCall(intptr_t token_pos, |
| 1183 intptr_t deopt_id, | 1183 intptr_t deopt_id, |
| 1184 const RuntimeEntry& entry, | 1184 const RuntimeEntry& entry, |
| 1185 intptr_t argument_count, | 1185 intptr_t argument_count, |
| 1186 LocationSummary* locs) { | 1186 LocationSummary* locs) { |
| 1187 __ CallRuntime(entry, argument_count); | 1187 __ CallRuntime(entry, argument_count); |
| 1188 AddCurrentDescriptor(RawPcDescriptors::kOther, deopt_id, token_pos); | 1188 AddCurrentDescriptor(RawPcDescriptors::kOther, deopt_id, token_pos); |
| 1189 RecordSafepoint(locs); | 1189 RecordSafepoint(locs); |
| 1190 if (deopt_id != Isolate::kNoDeoptId) { | 1190 if (deopt_id != Thread::kNoDeoptId) { |
| 1191 // Marks either the continuation point in unoptimized code or the | 1191 // Marks either the continuation point in unoptimized code or the |
| 1192 // deoptimization point in optimized code, after call. | 1192 // deoptimization point in optimized code, after call. |
| 1193 const intptr_t deopt_id_after = Isolate::ToDeoptAfter(deopt_id); | 1193 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); |
| 1194 if (is_optimizing()) { | 1194 if (is_optimizing()) { |
| 1195 AddDeoptIndexAtCall(deopt_id_after, token_pos); | 1195 AddDeoptIndexAtCall(deopt_id_after, token_pos); |
| 1196 } else { | 1196 } else { |
| 1197 // Add deoptimization continuation point after the call and before the | 1197 // Add deoptimization continuation point after the call and before the |
| 1198 // arguments are removed. | 1198 // arguments are removed. |
| 1199 AddCurrentDescriptor(RawPcDescriptors::kDeopt, | 1199 AddCurrentDescriptor(RawPcDescriptors::kDeopt, |
| 1200 deopt_id_after, | 1200 deopt_id_after, |
| 1201 token_pos); | 1201 token_pos); |
| 1202 } | 1202 } |
| 1203 } | 1203 } |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1285 | 1285 |
| 1286 if (FLAG_use_megamorphic_stub) { | 1286 if (FLAG_use_megamorphic_stub) { |
| 1287 __ BranchLink(*StubCode::MegamorphicLookup_entry()); | 1287 __ BranchLink(*StubCode::MegamorphicLookup_entry()); |
| 1288 } else { | 1288 } else { |
| 1289 StubCode::EmitMegamorphicLookup(assembler(), receiverR, cacheR, targetR); | 1289 StubCode::EmitMegamorphicLookup(assembler(), receiverR, cacheR, targetR); |
| 1290 } | 1290 } |
| 1291 __ LoadObject(S5, ic_data); | 1291 __ LoadObject(S5, ic_data); |
| 1292 __ LoadObject(S4, arguments_descriptor); | 1292 __ LoadObject(S4, arguments_descriptor); |
| 1293 __ jalr(targetR); | 1293 __ jalr(targetR); |
| 1294 AddCurrentDescriptor(RawPcDescriptors::kOther, | 1294 AddCurrentDescriptor(RawPcDescriptors::kOther, |
| 1295 Isolate::kNoDeoptId, token_pos); | 1295 Thread::kNoDeoptId, token_pos); |
| 1296 RecordSafepoint(locs); | 1296 RecordSafepoint(locs); |
| 1297 const intptr_t deopt_id_after = Isolate::ToDeoptAfter(deopt_id); | 1297 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); |
| 1298 if (is_optimizing()) { | 1298 if (is_optimizing()) { |
| 1299 AddDeoptIndexAtCall(deopt_id_after, token_pos); | 1299 AddDeoptIndexAtCall(deopt_id_after, token_pos); |
| 1300 } else { | 1300 } else { |
| 1301 // Add deoptimization continuation point after the call and before the | 1301 // Add deoptimization continuation point after the call and before the |
| 1302 // arguments are removed. | 1302 // arguments are removed. |
| 1303 AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos); | 1303 AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos); |
| 1304 } | 1304 } |
| 1305 __ Drop(argument_count); | 1305 __ Drop(argument_count); |
| 1306 } | 1306 } |
| 1307 | 1307 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1361 __ sw(TMP, Address(SP, 0 * kWordSize)); | 1361 __ sw(TMP, Address(SP, 0 * kWordSize)); |
| 1362 if (is_optimizing()) { | 1362 if (is_optimizing()) { |
| 1363 __ BranchLinkPatchable( | 1363 __ BranchLinkPatchable( |
| 1364 *StubCode::OptimizedIdenticalWithNumberCheck_entry()); | 1364 *StubCode::OptimizedIdenticalWithNumberCheck_entry()); |
| 1365 } else { | 1365 } else { |
| 1366 __ BranchLinkPatchable( | 1366 __ BranchLinkPatchable( |
| 1367 *StubCode::UnoptimizedIdenticalWithNumberCheck_entry()); | 1367 *StubCode::UnoptimizedIdenticalWithNumberCheck_entry()); |
| 1368 } | 1368 } |
| 1369 if (token_pos != Scanner::kNoSourcePos) { | 1369 if (token_pos != Scanner::kNoSourcePos) { |
| 1370 AddCurrentDescriptor(RawPcDescriptors::kRuntimeCall, | 1370 AddCurrentDescriptor(RawPcDescriptors::kRuntimeCall, |
| 1371 Isolate::kNoDeoptId, | 1371 Thread::kNoDeoptId, |
| 1372 token_pos); | 1372 token_pos); |
| 1373 } | 1373 } |
| 1374 __ Comment("EqualityRegConstCompare return"); | 1374 __ Comment("EqualityRegConstCompare return"); |
| 1375 // Stub returns result in CMPRES1 (if it is 0, then reg and obj are equal). | 1375 // Stub returns result in CMPRES1 (if it is 0, then reg and obj are equal). |
| 1376 __ lw(reg, Address(SP, 1 * kWordSize)); // Restore 'reg'. | 1376 __ lw(reg, Address(SP, 1 * kWordSize)); // Restore 'reg'. |
| 1377 __ addiu(SP, SP, Immediate(2 * kWordSize)); // Discard constant. | 1377 __ addiu(SP, SP, Immediate(2 * kWordSize)); // Discard constant. |
| 1378 return Condition(CMPRES1, ZR, EQ); | 1378 return Condition(CMPRES1, ZR, EQ); |
| 1379 } else { | 1379 } else { |
| 1380 int16_t imm = 0; | 1380 int16_t imm = 0; |
| 1381 const Register obj_reg = __ LoadConditionOperand(CMPRES1, obj, &imm); | 1381 const Register obj_reg = __ LoadConditionOperand(CMPRES1, obj, &imm); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1395 __ sw(right, Address(SP, 0 * kWordSize)); | 1395 __ sw(right, Address(SP, 0 * kWordSize)); |
| 1396 if (is_optimizing()) { | 1396 if (is_optimizing()) { |
| 1397 __ BranchLinkPatchable( | 1397 __ BranchLinkPatchable( |
| 1398 *StubCode::OptimizedIdenticalWithNumberCheck_entry()); | 1398 *StubCode::OptimizedIdenticalWithNumberCheck_entry()); |
| 1399 } else { | 1399 } else { |
| 1400 __ BranchLinkPatchable( | 1400 __ BranchLinkPatchable( |
| 1401 *StubCode::UnoptimizedIdenticalWithNumberCheck_entry()); | 1401 *StubCode::UnoptimizedIdenticalWithNumberCheck_entry()); |
| 1402 } | 1402 } |
| 1403 if (token_pos != Scanner::kNoSourcePos) { | 1403 if (token_pos != Scanner::kNoSourcePos) { |
| 1404 AddCurrentDescriptor(RawPcDescriptors::kRuntimeCall, | 1404 AddCurrentDescriptor(RawPcDescriptors::kRuntimeCall, |
| 1405 Isolate::kNoDeoptId, | 1405 Thread::kNoDeoptId, |
| 1406 token_pos); | 1406 token_pos); |
| 1407 } | 1407 } |
| 1408 __ Comment("EqualityRegRegCompare return"); | 1408 __ Comment("EqualityRegRegCompare return"); |
| 1409 // Stub returns result in CMPRES1 (if it is 0, then left and right are | 1409 // Stub returns result in CMPRES1 (if it is 0, then left and right are |
| 1410 // equal). | 1410 // equal). |
| 1411 __ lw(right, Address(SP, 0 * kWordSize)); | 1411 __ lw(right, Address(SP, 0 * kWordSize)); |
| 1412 __ lw(left, Address(SP, 1 * kWordSize)); | 1412 __ lw(left, Address(SP, 1 * kWordSize)); |
| 1413 __ addiu(SP, SP, Immediate(2 * kWordSize)); | 1413 __ addiu(SP, SP, Immediate(2 * kWordSize)); |
| 1414 return Condition(CMPRES1, ZR, EQ); | 1414 return Condition(CMPRES1, ZR, EQ); |
| 1415 } else { | 1415 } else { |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1843 __ AddImmediate(SP, kDoubleSize); | 1843 __ AddImmediate(SP, kDoubleSize); |
| 1844 } | 1844 } |
| 1845 | 1845 |
| 1846 | 1846 |
| 1847 #undef __ | 1847 #undef __ |
| 1848 | 1848 |
| 1849 | 1849 |
| 1850 } // namespace dart | 1850 } // namespace dart |
| 1851 | 1851 |
| 1852 #endif // defined TARGET_ARCH_MIPS | 1852 #endif // defined TARGET_ARCH_MIPS |
| OLD | NEW |