| 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 1357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1368 GenerateDartCall(deopt_id, | 1368 GenerateDartCall(deopt_id, |
| 1369 token_pos, | 1369 token_pos, |
| 1370 &stub_code->CallStaticFunctionLabel(), | 1370 &stub_code->CallStaticFunctionLabel(), |
| 1371 RawPcDescriptors::kOptStaticCall, | 1371 RawPcDescriptors::kOptStaticCall, |
| 1372 locs); | 1372 locs); |
| 1373 AddStaticCallTarget(function); | 1373 AddStaticCallTarget(function); |
| 1374 __ Drop(argument_count); | 1374 __ Drop(argument_count); |
| 1375 } | 1375 } |
| 1376 | 1376 |
| 1377 | 1377 |
| 1378 void FlowGraphCompiler::EmitEqualityRegConstCompare(Register reg, | 1378 Condition FlowGraphCompiler::EmitEqualityRegConstCompare( |
| 1379 const Object& obj, | 1379 Register reg, |
| 1380 bool needs_number_check, | 1380 const Object& obj, |
| 1381 intptr_t token_pos) { | 1381 bool needs_number_check, |
| 1382 intptr_t token_pos) { |
| 1382 ASSERT(!needs_number_check || | 1383 ASSERT(!needs_number_check || |
| 1383 (!obj.IsMint() && !obj.IsDouble() && !obj.IsBigint())); | 1384 (!obj.IsMint() && !obj.IsDouble() && !obj.IsBigint())); |
| 1384 | 1385 |
| 1385 if (obj.IsSmi() && (Smi::Cast(obj).Value() == 0)) { | 1386 if (obj.IsSmi() && (Smi::Cast(obj).Value() == 0)) { |
| 1386 ASSERT(!needs_number_check); | 1387 ASSERT(!needs_number_check); |
| 1387 __ testl(reg, reg); | 1388 __ testl(reg, reg); |
| 1388 return; | 1389 return EQUAL; |
| 1389 } | 1390 } |
| 1390 | 1391 |
| 1391 if (needs_number_check) { | 1392 if (needs_number_check) { |
| 1392 StubCode* stub_code = isolate()->stub_code(); | 1393 StubCode* stub_code = isolate()->stub_code(); |
| 1393 __ pushl(reg); | 1394 __ pushl(reg); |
| 1394 __ PushObject(obj); | 1395 __ PushObject(obj); |
| 1395 if (is_optimizing()) { | 1396 if (is_optimizing()) { |
| 1396 __ call(&stub_code->OptimizedIdenticalWithNumberCheckLabel()); | 1397 __ call(&stub_code->OptimizedIdenticalWithNumberCheckLabel()); |
| 1397 } else { | 1398 } else { |
| 1398 __ call(&stub_code->UnoptimizedIdenticalWithNumberCheckLabel()); | 1399 __ call(&stub_code->UnoptimizedIdenticalWithNumberCheckLabel()); |
| 1399 } | 1400 } |
| 1400 if (token_pos != Scanner::kNoSourcePos) { | 1401 if (token_pos != Scanner::kNoSourcePos) { |
| 1401 AddCurrentDescriptor(RawPcDescriptors::kRuntimeCall, | 1402 AddCurrentDescriptor(RawPcDescriptors::kRuntimeCall, |
| 1402 Isolate::kNoDeoptId, | 1403 Isolate::kNoDeoptId, |
| 1403 token_pos); | 1404 token_pos); |
| 1404 } | 1405 } |
| 1406 // Stub returns result in flags (result of a cmpl, we need ZF computed). |
| 1405 __ popl(reg); // Discard constant. | 1407 __ popl(reg); // Discard constant. |
| 1406 __ popl(reg); // Restore 'reg'. | 1408 __ popl(reg); // Restore 'reg'. |
| 1407 return; | 1409 } else { |
| 1410 __ CompareObject(reg, obj); |
| 1408 } | 1411 } |
| 1409 | 1412 return EQUAL; |
| 1410 __ CompareObject(reg, obj); | |
| 1411 } | 1413 } |
| 1412 | 1414 |
| 1413 | 1415 |
| 1414 void FlowGraphCompiler::EmitEqualityRegRegCompare(Register left, | 1416 Condition FlowGraphCompiler::EmitEqualityRegRegCompare(Register left, |
| 1415 Register right, | 1417 Register right, |
| 1416 bool needs_number_check, | 1418 bool needs_number_check, |
| 1417 intptr_t token_pos) { | 1419 intptr_t token_pos) { |
| 1418 if (needs_number_check) { | 1420 if (needs_number_check) { |
| 1419 StubCode* stub_code = isolate()->stub_code(); | 1421 StubCode* stub_code = isolate()->stub_code(); |
| 1420 __ pushl(left); | 1422 __ pushl(left); |
| 1421 __ pushl(right); | 1423 __ pushl(right); |
| 1422 if (is_optimizing()) { | 1424 if (is_optimizing()) { |
| 1423 __ call(&stub_code->OptimizedIdenticalWithNumberCheckLabel()); | 1425 __ call(&stub_code->OptimizedIdenticalWithNumberCheckLabel()); |
| 1424 } else { | 1426 } else { |
| 1425 __ call(&stub_code->UnoptimizedIdenticalWithNumberCheckLabel()); | 1427 __ call(&stub_code->UnoptimizedIdenticalWithNumberCheckLabel()); |
| 1426 } | 1428 } |
| 1427 if (token_pos != Scanner::kNoSourcePos) { | 1429 if (token_pos != Scanner::kNoSourcePos) { |
| 1428 AddCurrentDescriptor(RawPcDescriptors::kRuntimeCall, | 1430 AddCurrentDescriptor(RawPcDescriptors::kRuntimeCall, |
| 1429 Isolate::kNoDeoptId, | 1431 Isolate::kNoDeoptId, |
| 1430 token_pos); | 1432 token_pos); |
| 1431 } | 1433 } |
| 1432 #if defined(DEBUG) | 1434 #if defined(DEBUG) |
| 1433 if (!is_optimizing()) { | 1435 if (!is_optimizing()) { |
| 1434 // Do this *after* adding the pc descriptor! | 1436 // Do this *after* adding the pc descriptor! |
| 1435 __ movl(EDX, Immediate(kInvalidObjectPointer)); | 1437 __ movl(EDX, Immediate(kInvalidObjectPointer)); |
| 1436 __ movl(ECX, Immediate(kInvalidObjectPointer)); | 1438 __ movl(ECX, Immediate(kInvalidObjectPointer)); |
| 1437 } | 1439 } |
| 1438 #endif | 1440 #endif |
| 1439 // Stub returns result in flags (result of a cmpl, we need ZF computed). | 1441 // Stub returns result in flags (result of a cmpl, we need ZF computed). |
| 1440 __ popl(right); | 1442 __ popl(right); |
| 1441 __ popl(left); | 1443 __ popl(left); |
| 1442 } else { | 1444 } else { |
| 1443 __ cmpl(left, right); | 1445 __ cmpl(left, right); |
| 1444 } | 1446 } |
| 1447 return EQUAL; |
| 1445 } | 1448 } |
| 1446 | 1449 |
| 1447 | 1450 |
| 1448 // This function must be in sync with FlowGraphCompiler::RecordSafepoint and | 1451 // This function must be in sync with FlowGraphCompiler::RecordSafepoint and |
| 1449 // FlowGraphCompiler::SlowPathEnvironmentFor. | 1452 // FlowGraphCompiler::SlowPathEnvironmentFor. |
| 1450 void FlowGraphCompiler::SaveLiveRegisters(LocationSummary* locs) { | 1453 void FlowGraphCompiler::SaveLiveRegisters(LocationSummary* locs) { |
| 1451 #if defined(DEBUG) | 1454 #if defined(DEBUG) |
| 1452 locs->CheckWritableInputs(); | 1455 locs->CheckWritableInputs(); |
| 1453 ClobberDeadTempRegisters(locs); | 1456 ClobberDeadTempRegisters(locs); |
| 1454 #endif | 1457 #endif |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1838 __ movups(reg, Address(ESP, 0)); | 1841 __ movups(reg, Address(ESP, 0)); |
| 1839 __ addl(ESP, Immediate(kFpuRegisterSize)); | 1842 __ addl(ESP, Immediate(kFpuRegisterSize)); |
| 1840 } | 1843 } |
| 1841 | 1844 |
| 1842 | 1845 |
| 1843 #undef __ | 1846 #undef __ |
| 1844 | 1847 |
| 1845 } // namespace dart | 1848 } // namespace dart |
| 1846 | 1849 |
| 1847 #endif // defined TARGET_ARCH_IA32 | 1850 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |