| 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 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1233 } | 1233 } |
| 1234 | 1234 |
| 1235 | 1235 |
| 1236 void FlowGraphCompiler::EmitOptimizedInstanceCall( | 1236 void FlowGraphCompiler::EmitOptimizedInstanceCall( |
| 1237 ExternalLabel* target_label, | 1237 ExternalLabel* target_label, |
| 1238 const ICData& ic_data, | 1238 const ICData& ic_data, |
| 1239 intptr_t argument_count, | 1239 intptr_t argument_count, |
| 1240 intptr_t deopt_id, | 1240 intptr_t deopt_id, |
| 1241 intptr_t token_pos, | 1241 intptr_t token_pos, |
| 1242 LocationSummary* locs) { | 1242 LocationSummary* locs) { |
| 1243 ASSERT(Array::Handle(ic_data.arguments_descriptor()).Length() > 0); |
| 1243 // Each ICData propagated from unoptimized to optimized code contains the | 1244 // Each ICData propagated from unoptimized to optimized code contains the |
| 1244 // function that corresponds to the Dart function of that IC call. Due | 1245 // function that corresponds to the Dart function of that IC call. Due |
| 1245 // to inlining in optimized code, that function may not correspond to the | 1246 // to inlining in optimized code, that function may not correspond to the |
| 1246 // top-level function (parsed_function().function()) which could be | 1247 // top-level function (parsed_function().function()) which could be |
| 1247 // reoptimized and which counter needs to be incremented. | 1248 // reoptimized and which counter needs to be incremented. |
| 1248 // Pass the function explicitly, it is used in IC stub. | 1249 // Pass the function explicitly, it is used in IC stub. |
| 1249 __ LoadObject(EDI, parsed_function().function()); | 1250 __ LoadObject(EDI, parsed_function().function()); |
| 1250 __ LoadObject(ECX, ic_data); | 1251 __ LoadObject(ECX, ic_data); |
| 1251 GenerateDartCall(deopt_id, | 1252 GenerateDartCall(deopt_id, |
| 1252 token_pos, | 1253 token_pos, |
| 1253 target_label, | 1254 target_label, |
| 1254 PcDescriptors::kIcCall, | 1255 PcDescriptors::kIcCall, |
| 1255 locs); | 1256 locs); |
| 1256 __ Drop(argument_count); | 1257 __ Drop(argument_count); |
| 1257 } | 1258 } |
| 1258 | 1259 |
| 1259 | 1260 |
| 1260 void FlowGraphCompiler::EmitInstanceCall(ExternalLabel* target_label, | 1261 void FlowGraphCompiler::EmitInstanceCall(ExternalLabel* target_label, |
| 1261 const ICData& ic_data, | 1262 const ICData& ic_data, |
| 1262 intptr_t argument_count, | 1263 intptr_t argument_count, |
| 1263 intptr_t deopt_id, | 1264 intptr_t deopt_id, |
| 1264 intptr_t token_pos, | 1265 intptr_t token_pos, |
| 1265 LocationSummary* locs) { | 1266 LocationSummary* locs) { |
| 1267 ASSERT(Array::Handle(ic_data.arguments_descriptor()).Length() > 0); |
| 1266 __ LoadObject(ECX, ic_data); | 1268 __ LoadObject(ECX, ic_data); |
| 1267 GenerateDartCall(deopt_id, | 1269 GenerateDartCall(deopt_id, |
| 1268 token_pos, | 1270 token_pos, |
| 1269 target_label, | 1271 target_label, |
| 1270 PcDescriptors::kIcCall, | 1272 PcDescriptors::kIcCall, |
| 1271 locs); | 1273 locs); |
| 1272 __ Drop(argument_count); | 1274 __ Drop(argument_count); |
| 1273 } | 1275 } |
| 1274 | 1276 |
| 1275 | 1277 |
| 1276 void FlowGraphCompiler::EmitMegamorphicInstanceCall( | 1278 void FlowGraphCompiler::EmitMegamorphicInstanceCall( |
| 1277 const ICData& ic_data, | 1279 const ICData& ic_data, |
| 1278 intptr_t argument_count, | 1280 intptr_t argument_count, |
| 1279 intptr_t deopt_id, | 1281 intptr_t deopt_id, |
| 1280 intptr_t token_pos, | 1282 intptr_t token_pos, |
| 1281 LocationSummary* locs) { | 1283 LocationSummary* locs) { |
| 1282 MegamorphicCacheTable* table = Isolate::Current()->megamorphic_cache_table(); | 1284 MegamorphicCacheTable* table = Isolate::Current()->megamorphic_cache_table(); |
| 1283 const String& name = String::Handle(ic_data.target_name()); | 1285 const String& name = String::Handle(ic_data.target_name()); |
| 1284 const Array& arguments_descriptor = | 1286 const Array& arguments_descriptor = |
| 1285 Array::ZoneHandle(ic_data.arguments_descriptor()); | 1287 Array::ZoneHandle(ic_data.arguments_descriptor()); |
| 1286 ASSERT(!arguments_descriptor.IsNull()); | 1288 ASSERT(!arguments_descriptor.IsNull() && (arguments_descriptor.Length() > 0)); |
| 1287 const MegamorphicCache& cache = | 1289 const MegamorphicCache& cache = |
| 1288 MegamorphicCache::ZoneHandle(table->Lookup(name, arguments_descriptor)); | 1290 MegamorphicCache::ZoneHandle(table->Lookup(name, arguments_descriptor)); |
| 1289 Label not_smi, load_cache; | 1291 Label not_smi, load_cache; |
| 1290 __ movl(EAX, Address(ESP, (argument_count - 1) * kWordSize)); | 1292 __ movl(EAX, Address(ESP, (argument_count - 1) * kWordSize)); |
| 1291 __ testl(EAX, Immediate(kSmiTagMask)); | 1293 __ testl(EAX, Immediate(kSmiTagMask)); |
| 1292 __ j(NOT_ZERO, ¬_smi, Assembler::kNearJump); | 1294 __ j(NOT_ZERO, ¬_smi, Assembler::kNearJump); |
| 1293 __ movl(EAX, Immediate(Smi::RawValue(kSmiCid))); | 1295 __ movl(EAX, Immediate(Smi::RawValue(kSmiCid))); |
| 1294 __ jmp(&load_cache); | 1296 __ jmp(&load_cache); |
| 1295 | 1297 |
| 1296 __ Bind(¬_smi); | 1298 __ Bind(¬_smi); |
| (...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1803 __ movups(reg, Address(ESP, 0)); | 1805 __ movups(reg, Address(ESP, 0)); |
| 1804 __ addl(ESP, Immediate(kFpuRegisterSize)); | 1806 __ addl(ESP, Immediate(kFpuRegisterSize)); |
| 1805 } | 1807 } |
| 1806 | 1808 |
| 1807 | 1809 |
| 1808 #undef __ | 1810 #undef __ |
| 1809 | 1811 |
| 1810 } // namespace dart | 1812 } // namespace dart |
| 1811 | 1813 |
| 1812 #endif // defined TARGET_ARCH_IA32 | 1814 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |