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 1267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1278 AddDeoptIndexAtCall(deopt_id_after, token_pos); | 1278 AddDeoptIndexAtCall(deopt_id_after, token_pos); |
1279 } else { | 1279 } else { |
1280 // Add deoptimization continuation point after the call and before the | 1280 // Add deoptimization continuation point after the call and before the |
1281 // arguments are removed. | 1281 // arguments are removed. |
1282 AddCurrentDescriptor(PcDescriptors::kDeopt, deopt_id_after, token_pos); | 1282 AddCurrentDescriptor(PcDescriptors::kDeopt, deopt_id_after, token_pos); |
1283 } | 1283 } |
1284 } | 1284 } |
1285 } | 1285 } |
1286 | 1286 |
1287 | 1287 |
| 1288 void FlowGraphCompiler::EmitUnoptimizedStaticCall( |
| 1289 const Function& target_function, |
| 1290 const Array& arguments_descriptor, |
| 1291 intptr_t argument_count, |
| 1292 intptr_t deopt_id, |
| 1293 intptr_t token_pos, |
| 1294 LocationSummary* locs) { |
| 1295 // TODO(srdjan): Improve performance of function recognition. |
| 1296 MethodRecognizer::Kind recognized_kind = |
| 1297 MethodRecognizer::RecognizeKind(target_function); |
| 1298 int num_args_checked = 0; |
| 1299 if ((recognized_kind == MethodRecognizer::kMathMin) || |
| 1300 (recognized_kind == MethodRecognizer::kMathMax)) { |
| 1301 num_args_checked = 2; |
| 1302 } |
| 1303 const ICData& ic_data = ICData::ZoneHandle( |
| 1304 ICData::New(parsed_function().function(), // Caller function. |
| 1305 String::Handle(target_function.name()), |
| 1306 arguments_descriptor, |
| 1307 deopt_id, |
| 1308 num_args_checked)); // No arguments checked. |
| 1309 ic_data.AddTarget(target_function); |
| 1310 uword label_address = 0; |
| 1311 if (ic_data.num_args_tested() == 0) { |
| 1312 label_address = StubCode::ZeroArgsUnoptimizedStaticCallEntryPoint(); |
| 1313 } else if (ic_data.num_args_tested() == 2) { |
| 1314 label_address = StubCode::TwoArgsUnoptimizedStaticCallEntryPoint(); |
| 1315 } else { |
| 1316 UNIMPLEMENTED(); |
| 1317 } |
| 1318 ExternalLabel target_label("StaticCallICStub", label_address); |
| 1319 __ LoadObject(ECX, ic_data); |
| 1320 GenerateDartCall(deopt_id, |
| 1321 token_pos, |
| 1322 &target_label, |
| 1323 PcDescriptors::kUnoptStaticCall, |
| 1324 locs); |
| 1325 __ Drop(argument_count); |
| 1326 } |
| 1327 |
| 1328 |
1288 void FlowGraphCompiler::EmitOptimizedInstanceCall( | 1329 void FlowGraphCompiler::EmitOptimizedInstanceCall( |
1289 ExternalLabel* target_label, | 1330 ExternalLabel* target_label, |
1290 const ICData& ic_data, | 1331 const ICData& ic_data, |
1291 intptr_t argument_count, | 1332 intptr_t argument_count, |
1292 intptr_t deopt_id, | 1333 intptr_t deopt_id, |
1293 intptr_t token_pos, | 1334 intptr_t token_pos, |
1294 LocationSummary* locs) { | 1335 LocationSummary* locs) { |
1295 // Each ICData propagated from unoptimized to optimized code contains the | 1336 // Each ICData propagated from unoptimized to optimized code contains the |
1296 // function that corresponds to the Dart function of that IC call. Due | 1337 // function that corresponds to the Dart function of that IC call. Due |
1297 // to inlining in optimized code, that function may not correspond to the | 1338 // to inlining in optimized code, that function may not correspond to the |
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1884 __ movups(reg, Address(ESP, 0)); | 1925 __ movups(reg, Address(ESP, 0)); |
1885 __ addl(ESP, Immediate(kFpuRegisterSize)); | 1926 __ addl(ESP, Immediate(kFpuRegisterSize)); |
1886 } | 1927 } |
1887 | 1928 |
1888 | 1929 |
1889 #undef __ | 1930 #undef __ |
1890 | 1931 |
1891 } // namespace dart | 1932 } // namespace dart |
1892 | 1933 |
1893 #endif // defined TARGET_ARCH_IA32 | 1934 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |