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