| 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_IA32. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. |
| 6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
| 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 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1103 __ jmp(&stub_code->DeoptimizeLazyLabel()); | 1103 __ jmp(&stub_code->DeoptimizeLazyLabel()); |
| 1104 } | 1104 } |
| 1105 } | 1105 } |
| 1106 | 1106 |
| 1107 | 1107 |
| 1108 void FlowGraphCompiler::GenerateCall(intptr_t token_pos, | 1108 void FlowGraphCompiler::GenerateCall(intptr_t token_pos, |
| 1109 const ExternalLabel* label, | 1109 const ExternalLabel* label, |
| 1110 RawPcDescriptors::Kind kind, | 1110 RawPcDescriptors::Kind kind, |
| 1111 LocationSummary* locs) { | 1111 LocationSummary* locs) { |
| 1112 __ call(label); | 1112 __ call(label); |
| 1113 AddCurrentDescriptor(kind, Isolate::kNoDeoptId, token_pos); | 1113 RecordCallInfo(token_pos, kind, Isolate::kNoDeoptId, locs, 0); |
| 1114 RecordSafepoint(locs); | |
| 1115 } | 1114 } |
| 1116 | 1115 |
| 1117 | 1116 |
| 1118 void FlowGraphCompiler::GenerateDartCall(intptr_t deopt_id, | 1117 void FlowGraphCompiler::GenerateDartCall(intptr_t deopt_id, |
| 1119 intptr_t token_pos, | 1118 intptr_t token_pos, |
| 1120 const ExternalLabel* label, | 1119 const ExternalLabel* label, |
| 1121 RawPcDescriptors::Kind kind, | 1120 RawPcDescriptors::Kind kind, |
| 1122 LocationSummary* locs) { | 1121 LocationSummary* locs) { |
| 1123 __ call(label); | 1122 __ call(label); |
| 1124 AddCurrentDescriptor(kind, deopt_id, token_pos); | 1123 RecordCallInfo(token_pos, kind, deopt_id, locs, locs->input_count()); |
| 1125 RecordSafepoint(locs); | |
| 1126 // Marks either the continuation point in unoptimized code or the | |
| 1127 // deoptimization point in optimized code, after call. | |
| 1128 const intptr_t deopt_id_after = Isolate::ToDeoptAfter(deopt_id); | |
| 1129 if (is_optimizing()) { | |
| 1130 AddDeoptIndexAtCall(deopt_id_after, token_pos); | |
| 1131 } else { | |
| 1132 // Add deoptimization continuation point after the call and before the | |
| 1133 // arguments are removed. | |
| 1134 AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos); | |
| 1135 } | |
| 1136 } | 1124 } |
| 1137 | 1125 |
| 1138 | 1126 |
| 1139 void FlowGraphCompiler::GenerateRuntimeCall(intptr_t token_pos, | 1127 void FlowGraphCompiler::GenerateRuntimeCall(intptr_t token_pos, |
| 1140 intptr_t deopt_id, | 1128 intptr_t deopt_id, |
| 1141 const RuntimeEntry& entry, | 1129 const RuntimeEntry& entry, |
| 1142 intptr_t argument_count, | 1130 intptr_t argument_count, |
| 1143 LocationSummary* locs) { | 1131 LocationSummary* locs) { |
| 1144 __ CallRuntime(entry, argument_count); | 1132 __ CallRuntime(entry, argument_count); |
| 1145 AddCurrentDescriptor(RawPcDescriptors::kOther, deopt_id, token_pos); | 1133 RecordCallInfo(token_pos, RawPcDescriptors::kOther, deopt_id, locs, 0); |
| 1146 RecordSafepoint(locs); | |
| 1147 if (deopt_id != Isolate::kNoDeoptId) { | |
| 1148 // Marks either the continuation point in unoptimized code or the | |
| 1149 // deoptimization point in optimized code, after call. | |
| 1150 const intptr_t deopt_id_after = Isolate::ToDeoptAfter(deopt_id); | |
| 1151 if (is_optimizing()) { | |
| 1152 AddDeoptIndexAtCall(deopt_id_after, token_pos); | |
| 1153 } else { | |
| 1154 // Add deoptimization continuation point after the call and before the | |
| 1155 // arguments are removed. | |
| 1156 AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos); | |
| 1157 } | |
| 1158 } | |
| 1159 } | 1134 } |
| 1160 | 1135 |
| 1161 | 1136 |
| 1162 void FlowGraphCompiler::EmitUnoptimizedStaticCall( | 1137 void FlowGraphCompiler::EmitUnoptimizedStaticCall( |
| 1163 intptr_t argument_count, | 1138 intptr_t argument_count, |
| 1164 intptr_t deopt_id, | 1139 intptr_t deopt_id, |
| 1165 intptr_t token_pos, | 1140 intptr_t token_pos, |
| 1166 LocationSummary* locs, | 1141 LocationSummary* locs, |
| 1167 const ICData& ic_data) { | 1142 const ICData& ic_data) { |
| 1168 StubCode* stub_code = isolate()->stub_code(); | 1143 StubCode* stub_code = isolate()->stub_code(); |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1290 // Call the target found in the cache. For a class id match, this is a | 1265 // Call the target found in the cache. For a class id match, this is a |
| 1291 // proper target for the given name and arguments descriptor. If the | 1266 // proper target for the given name and arguments descriptor. If the |
| 1292 // illegal class id was found, the target is a cache miss handler that can | 1267 // illegal class id was found, the target is a cache miss handler that can |
| 1293 // be invoked as a normal Dart function. | 1268 // be invoked as a normal Dart function. |
| 1294 __ movl(EAX, FieldAddress(EDI, ECX, TIMES_4, base + kWordSize)); | 1269 __ movl(EAX, FieldAddress(EDI, ECX, TIMES_4, base + kWordSize)); |
| 1295 __ movl(EBX, FieldAddress(EAX, Function::instructions_offset())); | 1270 __ movl(EBX, FieldAddress(EAX, Function::instructions_offset())); |
| 1296 __ LoadObject(ECX, ic_data); | 1271 __ LoadObject(ECX, ic_data); |
| 1297 __ LoadObject(EDX, arguments_descriptor); | 1272 __ LoadObject(EDX, arguments_descriptor); |
| 1298 __ addl(EBX, Immediate(Instructions::HeaderSize() - kHeapObjectTag)); | 1273 __ addl(EBX, Immediate(Instructions::HeaderSize() - kHeapObjectTag)); |
| 1299 __ call(EBX); | 1274 __ call(EBX); |
| 1300 AddCurrentDescriptor(RawPcDescriptors::kOther, | 1275 RecordCallInfo( |
| 1301 Isolate::kNoDeoptId, token_pos); | 1276 token_pos, RawPcDescriptors::kOther, deopt_id, locs, locs->input_count()); |
| 1302 RecordSafepoint(locs); | |
| 1303 AddDeoptIndexAtCall(Isolate::ToDeoptAfter(deopt_id), token_pos); | |
| 1304 __ Drop(argument_count); | 1277 __ Drop(argument_count); |
| 1305 } | 1278 } |
| 1306 | 1279 |
| 1307 | 1280 |
| 1308 void FlowGraphCompiler::EmitOptimizedStaticCall( | 1281 void FlowGraphCompiler::EmitOptimizedStaticCall( |
| 1309 const Function& function, | 1282 const Function& function, |
| 1310 const Array& arguments_descriptor, | 1283 const Array& arguments_descriptor, |
| 1311 intptr_t argument_count, | 1284 intptr_t argument_count, |
| 1312 intptr_t deopt_id, | 1285 intptr_t deopt_id, |
| 1313 intptr_t token_pos, | 1286 intptr_t token_pos, |
| (...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1768 __ movups(reg, Address(ESP, 0)); | 1741 __ movups(reg, Address(ESP, 0)); |
| 1769 __ addl(ESP, Immediate(kFpuRegisterSize)); | 1742 __ addl(ESP, Immediate(kFpuRegisterSize)); |
| 1770 } | 1743 } |
| 1771 | 1744 |
| 1772 | 1745 |
| 1773 #undef __ | 1746 #undef __ |
| 1774 | 1747 |
| 1775 } // namespace dart | 1748 } // namespace dart |
| 1776 | 1749 |
| 1777 #endif // defined TARGET_ARCH_IA32 | 1750 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |