Chromium Code Reviews| 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 1164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1175 const ICData& ic_data) { | 1175 const ICData& ic_data) { |
| 1176 uword label_address = 0; | 1176 uword label_address = 0; |
| 1177 if (ic_data.NumArgsTested() == 0) { | 1177 if (ic_data.NumArgsTested() == 0) { |
| 1178 label_address = StubCode::ZeroArgsUnoptimizedStaticCallEntryPoint(); | 1178 label_address = StubCode::ZeroArgsUnoptimizedStaticCallEntryPoint(); |
| 1179 } else if (ic_data.NumArgsTested() == 2) { | 1179 } else if (ic_data.NumArgsTested() == 2) { |
| 1180 label_address = StubCode::TwoArgsUnoptimizedStaticCallEntryPoint(); | 1180 label_address = StubCode::TwoArgsUnoptimizedStaticCallEntryPoint(); |
| 1181 } else { | 1181 } else { |
| 1182 UNIMPLEMENTED(); | 1182 UNIMPLEMENTED(); |
| 1183 } | 1183 } |
| 1184 ExternalLabel target_label(label_address); | 1184 ExternalLabel target_label(label_address); |
| 1185 __ movl(EDX, Immediate(0)); | |
|
Florian Schneider
2014/06/20 12:48:54
This is bad for unoptimized code size.
Ivan Posva
2014/06/20 14:03:31
We were fully aware of the code size issue when we
| |
| 1185 __ LoadObject(ECX, ic_data); | 1186 __ LoadObject(ECX, ic_data); |
| 1186 GenerateDartCall(deopt_id, | 1187 GenerateDartCall(deopt_id, |
| 1187 token_pos, | 1188 token_pos, |
| 1188 &target_label, | 1189 &target_label, |
| 1189 PcDescriptors::kUnoptStaticCall, | 1190 PcDescriptors::kUnoptStaticCall, |
| 1190 locs); | 1191 locs); |
| 1191 __ Drop(argument_count); | 1192 __ Drop(argument_count); |
| 1193 #if defined(DEBUG) | |
| 1194 __ movl(EDX, Immediate(kInvalidObjectPointer)); | |
| 1195 #endif | |
| 1192 } | 1196 } |
| 1193 | 1197 |
| 1194 | 1198 |
| 1195 void FlowGraphCompiler::EmitEdgeCounter() { | 1199 void FlowGraphCompiler::EmitEdgeCounter() { |
| 1196 // We do not check for overflow when incrementing the edge counter. The | 1200 // We do not check for overflow when incrementing the edge counter. The |
| 1197 // function should normally be optimized long before the counter can | 1201 // function should normally be optimized long before the counter can |
| 1198 // overflow; and though we do not reset the counters when we optimize or | 1202 // overflow; and though we do not reset the counters when we optimize or |
| 1199 // deoptimize, there is a bound on the number of | 1203 // deoptimize, there is a bound on the number of |
| 1200 // optimization/deoptimization cycles we will attempt. | 1204 // optimization/deoptimization cycles we will attempt. |
| 1201 const Array& counter = Array::ZoneHandle(Array::New(1, Heap::kOld)); | 1205 const Array& counter = Array::ZoneHandle(Array::New(1, Heap::kOld)); |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 1232 } | 1236 } |
| 1233 | 1237 |
| 1234 | 1238 |
| 1235 void FlowGraphCompiler::EmitInstanceCall(ExternalLabel* target_label, | 1239 void FlowGraphCompiler::EmitInstanceCall(ExternalLabel* target_label, |
| 1236 const ICData& ic_data, | 1240 const ICData& ic_data, |
| 1237 intptr_t argument_count, | 1241 intptr_t argument_count, |
| 1238 intptr_t deopt_id, | 1242 intptr_t deopt_id, |
| 1239 intptr_t token_pos, | 1243 intptr_t token_pos, |
| 1240 LocationSummary* locs) { | 1244 LocationSummary* locs) { |
| 1241 ASSERT(Array::Handle(ic_data.arguments_descriptor()).Length() > 0); | 1245 ASSERT(Array::Handle(ic_data.arguments_descriptor()).Length() > 0); |
| 1246 __ movl(EDX, Immediate(0)); | |
| 1242 __ LoadObject(ECX, ic_data); | 1247 __ LoadObject(ECX, ic_data); |
| 1243 GenerateDartCall(deopt_id, | 1248 GenerateDartCall(deopt_id, |
| 1244 token_pos, | 1249 token_pos, |
| 1245 target_label, | 1250 target_label, |
| 1246 PcDescriptors::kIcCall, | 1251 PcDescriptors::kIcCall, |
| 1247 locs); | 1252 locs); |
| 1248 __ Drop(argument_count); | 1253 __ Drop(argument_count); |
| 1254 #if defined(DEBUG) | |
| 1255 __ movl(EDX, Immediate(kInvalidObjectPointer)); | |
| 1256 #endif | |
| 1249 } | 1257 } |
| 1250 | 1258 |
| 1251 | 1259 |
| 1252 void FlowGraphCompiler::EmitMegamorphicInstanceCall( | 1260 void FlowGraphCompiler::EmitMegamorphicInstanceCall( |
| 1253 const ICData& ic_data, | 1261 const ICData& ic_data, |
| 1254 intptr_t argument_count, | 1262 intptr_t argument_count, |
| 1255 intptr_t deopt_id, | 1263 intptr_t deopt_id, |
| 1256 intptr_t token_pos, | 1264 intptr_t token_pos, |
| 1257 LocationSummary* locs) { | 1265 LocationSummary* locs) { |
| 1258 MegamorphicCacheTable* table = Isolate::Current()->megamorphic_cache_table(); | 1266 MegamorphicCacheTable* table = Isolate::Current()->megamorphic_cache_table(); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1368 void FlowGraphCompiler::EmitEqualityRegRegCompare(Register left, | 1376 void FlowGraphCompiler::EmitEqualityRegRegCompare(Register left, |
| 1369 Register right, | 1377 Register right, |
| 1370 bool needs_number_check, | 1378 bool needs_number_check, |
| 1371 intptr_t token_pos) { | 1379 intptr_t token_pos) { |
| 1372 if (needs_number_check) { | 1380 if (needs_number_check) { |
| 1373 __ pushl(left); | 1381 __ pushl(left); |
| 1374 __ pushl(right); | 1382 __ pushl(right); |
| 1375 if (is_optimizing()) { | 1383 if (is_optimizing()) { |
| 1376 __ call(&StubCode::OptimizedIdenticalWithNumberCheckLabel()); | 1384 __ call(&StubCode::OptimizedIdenticalWithNumberCheckLabel()); |
| 1377 } else { | 1385 } else { |
| 1386 __ movl(EDX, Immediate(0)); | |
| 1387 __ movl(ECX, Immediate(0)); | |
| 1378 __ call(&StubCode::UnoptimizedIdenticalWithNumberCheckLabel()); | 1388 __ call(&StubCode::UnoptimizedIdenticalWithNumberCheckLabel()); |
| 1379 } | 1389 } |
| 1380 if (token_pos != Scanner::kNoSourcePos) { | 1390 if (token_pos != Scanner::kNoSourcePos) { |
| 1381 AddCurrentDescriptor(PcDescriptors::kRuntimeCall, | 1391 AddCurrentDescriptor(PcDescriptors::kRuntimeCall, |
| 1382 Isolate::kNoDeoptId, | 1392 Isolate::kNoDeoptId, |
| 1383 token_pos); | 1393 token_pos); |
| 1384 } | 1394 } |
| 1395 #if defined(DEBUG) | |
| 1396 if (!is_optimizing()) { | |
| 1397 // Do this *after* adding the pc descriptor! | |
| 1398 __ movl(EDX, Immediate(kInvalidObjectPointer)); | |
| 1399 __ movl(ECX, Immediate(kInvalidObjectPointer)); | |
| 1400 } | |
| 1401 #endif | |
| 1385 // Stub returns result in flags (result of a cmpl, we need ZF computed). | 1402 // Stub returns result in flags (result of a cmpl, we need ZF computed). |
| 1386 __ popl(right); | 1403 __ popl(right); |
| 1387 __ popl(left); | 1404 __ popl(left); |
| 1388 } else { | 1405 } else { |
| 1389 __ cmpl(left, right); | 1406 __ cmpl(left, right); |
| 1390 } | 1407 } |
| 1391 } | 1408 } |
| 1392 | 1409 |
| 1393 | 1410 |
| 1394 // This function must be in sync with FlowGraphCompiler::RecordSafepoint and | 1411 // This function must be in sync with FlowGraphCompiler::RecordSafepoint and |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1739 __ movups(reg, Address(ESP, 0)); | 1756 __ movups(reg, Address(ESP, 0)); |
| 1740 __ addl(ESP, Immediate(kFpuRegisterSize)); | 1757 __ addl(ESP, Immediate(kFpuRegisterSize)); |
| 1741 } | 1758 } |
| 1742 | 1759 |
| 1743 | 1760 |
| 1744 #undef __ | 1761 #undef __ |
| 1745 | 1762 |
| 1746 } // namespace dart | 1763 } // namespace dart |
| 1747 | 1764 |
| 1748 #endif // defined TARGET_ARCH_IA32 | 1765 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |