| 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_MIPS. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS. |
| 6 #if defined(TARGET_ARCH_MIPS) | 6 #if defined(TARGET_ARCH_MIPS) |
| 7 | 7 |
| 8 #include "vm/flow_graph_compiler.h" | 8 #include "vm/flow_graph_compiler.h" |
| 9 | 9 |
| 10 #include "lib/error.h" | 10 #include "lib/error.h" |
| (...skipping 1391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1402 __ LoadObject(S4, arguments_descriptor); | 1402 __ LoadObject(S4, arguments_descriptor); |
| 1403 __ AddImmediate(T0, Instructions::HeaderSize() - kHeapObjectTag); | 1403 __ AddImmediate(T0, Instructions::HeaderSize() - kHeapObjectTag); |
| 1404 __ jalr(T0); | 1404 __ jalr(T0); |
| 1405 AddCurrentDescriptor(PcDescriptors::kOther, Isolate::kNoDeoptId, token_pos); | 1405 AddCurrentDescriptor(PcDescriptors::kOther, Isolate::kNoDeoptId, token_pos); |
| 1406 RecordSafepoint(locs); | 1406 RecordSafepoint(locs); |
| 1407 AddDeoptIndexAtCall(Isolate::ToDeoptAfter(deopt_id), token_pos); | 1407 AddDeoptIndexAtCall(Isolate::ToDeoptAfter(deopt_id), token_pos); |
| 1408 __ Drop(argument_count); | 1408 __ Drop(argument_count); |
| 1409 } | 1409 } |
| 1410 | 1410 |
| 1411 | 1411 |
| 1412 void FlowGraphCompiler::EmitStaticCall(const Function& function, | 1412 void FlowGraphCompiler::EmitOptimizedStaticCall( |
| 1413 const Array& arguments_descriptor, | 1413 const Function& function, |
| 1414 intptr_t argument_count, | 1414 const Array& arguments_descriptor, |
| 1415 intptr_t deopt_id, | 1415 intptr_t argument_count, |
| 1416 intptr_t token_pos, | 1416 intptr_t deopt_id, |
| 1417 LocationSummary* locs) { | 1417 intptr_t token_pos, |
| 1418 LocationSummary* locs) { |
| 1418 __ TraceSimMsg("StaticCall"); | 1419 __ TraceSimMsg("StaticCall"); |
| 1419 __ LoadObject(S4, arguments_descriptor); | 1420 __ LoadObject(S4, arguments_descriptor); |
| 1420 // Do not use the code from the function, but let the code be patched so that | 1421 // Do not use the code from the function, but let the code be patched so that |
| 1421 // we can record the outgoing edges to other code. | 1422 // we can record the outgoing edges to other code. |
| 1422 GenerateDartCall(deopt_id, | 1423 GenerateDartCall(deopt_id, |
| 1423 token_pos, | 1424 token_pos, |
| 1424 &StubCode::CallStaticFunctionLabel(), | 1425 &StubCode::CallStaticFunctionLabel(), |
| 1425 PcDescriptors::kFuncCall, | 1426 PcDescriptors::kOptStaticCall, |
| 1426 locs); | 1427 locs); |
| 1427 AddStaticCallTarget(function); | 1428 AddStaticCallTarget(function); |
| 1428 __ Drop(argument_count); | 1429 __ Drop(argument_count); |
| 1429 } | 1430 } |
| 1430 | 1431 |
| 1431 | 1432 |
| 1432 void FlowGraphCompiler::EmitUnoptimizedStaticCall( | 1433 void FlowGraphCompiler::EmitUnoptimizedStaticCall( |
| 1433 const Function& target_function, | 1434 const Function& target_function, |
| 1434 const Array& arguments_descriptor, | 1435 const Array& arguments_descriptor, |
| 1435 intptr_t argument_count, | 1436 intptr_t argument_count, |
| 1436 intptr_t deopt_id, | 1437 intptr_t deopt_id, |
| 1437 intptr_t token_pos, | 1438 intptr_t token_pos, |
| 1438 LocationSummary* locs) { | 1439 LocationSummary* locs) { |
| 1439 const ICData& ic_data = ICData::ZoneHandle( | 1440 const ICData& ic_data = ICData::ZoneHandle( |
| 1440 ICData::New(parsed_function().function(), // Caller function. | 1441 ICData::New(parsed_function().function(), // Caller function. |
| 1441 String::Handle(target_function.name()), | 1442 String::Handle(target_function.name()), |
| 1442 arguments_descriptor, | 1443 arguments_descriptor, |
| 1443 deopt_id, | 1444 deopt_id, |
| 1444 0)); // No arguments checked. | 1445 0)); // No arguments checked. |
| 1445 ic_data.AddTarget(target_function); | 1446 ic_data.AddTarget(target_function); |
| 1446 __ LoadObject(S5, ic_data); | 1447 __ LoadObject(S5, ic_data); |
| 1447 GenerateDartCall(deopt_id, | 1448 GenerateDartCall(deopt_id, |
| 1448 token_pos, | 1449 token_pos, |
| 1449 &StubCode::UnoptimizedStaticCallLabel(), | 1450 &StubCode::UnoptimizedStaticCallLabel(), |
| 1450 PcDescriptors::kFuncCall, | 1451 PcDescriptors::kUnoptStaticCall, |
| 1451 locs); | 1452 locs); |
| 1452 __ Drop(argument_count); | 1453 __ Drop(argument_count); |
| 1453 } | 1454 } |
| 1454 | 1455 |
| 1455 | 1456 |
| 1456 void FlowGraphCompiler::EmitEqualityRegConstCompare(Register reg, | 1457 void FlowGraphCompiler::EmitEqualityRegConstCompare(Register reg, |
| 1457 const Object& obj, | 1458 const Object& obj, |
| 1458 bool needs_number_check, | 1459 bool needs_number_check, |
| 1459 intptr_t token_pos) { | 1460 intptr_t token_pos) { |
| 1460 __ TraceSimMsg("EqualityRegConstCompare"); | 1461 __ TraceSimMsg("EqualityRegConstCompare"); |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1601 | 1602 |
| 1602 | 1603 |
| 1603 void FlowGraphCompiler::EmitTestAndCall(const ICData& ic_data, | 1604 void FlowGraphCompiler::EmitTestAndCall(const ICData& ic_data, |
| 1604 Register class_id_reg, | 1605 Register class_id_reg, |
| 1605 intptr_t argument_count, | 1606 intptr_t argument_count, |
| 1606 const Array& argument_names, | 1607 const Array& argument_names, |
| 1607 Label* deopt, | 1608 Label* deopt, |
| 1608 intptr_t deopt_id, | 1609 intptr_t deopt_id, |
| 1609 intptr_t token_index, | 1610 intptr_t token_index, |
| 1610 LocationSummary* locs) { | 1611 LocationSummary* locs) { |
| 1612 ASSERT(is_optimizing()); |
| 1611 ASSERT(!ic_data.IsNull() && (ic_data.NumberOfChecks() > 0)); | 1613 ASSERT(!ic_data.IsNull() && (ic_data.NumberOfChecks() > 0)); |
| 1612 Label match_found; | 1614 Label match_found; |
| 1613 const intptr_t len = ic_data.NumberOfChecks(); | 1615 const intptr_t len = ic_data.NumberOfChecks(); |
| 1614 GrowableArray<CidTarget> sorted(len); | 1616 GrowableArray<CidTarget> sorted(len); |
| 1615 SortICDataByCount(ic_data, &sorted); | 1617 SortICDataByCount(ic_data, &sorted); |
| 1616 ASSERT(class_id_reg != S4); | 1618 ASSERT(class_id_reg != S4); |
| 1617 ASSERT(len > 0); // Why bother otherwise. | 1619 ASSERT(len > 0); // Why bother otherwise. |
| 1618 const Array& arguments_descriptor = | 1620 const Array& arguments_descriptor = |
| 1619 Array::ZoneHandle(ArgumentsDescriptor::New(argument_count, | 1621 Array::ZoneHandle(ArgumentsDescriptor::New(argument_count, |
| 1620 argument_names)); | 1622 argument_names)); |
| 1621 __ TraceSimMsg("EmitTestAndCall"); | 1623 __ TraceSimMsg("EmitTestAndCall"); |
| 1622 __ Comment("EmitTestAndCall"); | 1624 __ Comment("EmitTestAndCall"); |
| 1623 __ LoadObject(S4, arguments_descriptor); | 1625 __ LoadObject(S4, arguments_descriptor); |
| 1624 for (intptr_t i = 0; i < len; i++) { | 1626 for (intptr_t i = 0; i < len; i++) { |
| 1625 const bool is_last_check = (i == (len - 1)); | 1627 const bool is_last_check = (i == (len - 1)); |
| 1626 Label next_test; | 1628 Label next_test; |
| 1627 if (is_last_check) { | 1629 if (is_last_check) { |
| 1628 __ BranchNotEqual(class_id_reg, sorted[i].cid, deopt); | 1630 __ BranchNotEqual(class_id_reg, sorted[i].cid, deopt); |
| 1629 } else { | 1631 } else { |
| 1630 __ BranchNotEqual(class_id_reg, sorted[i].cid, &next_test); | 1632 __ BranchNotEqual(class_id_reg, sorted[i].cid, &next_test); |
| 1631 } | 1633 } |
| 1632 // Do not use the code from the function, but let the code be patched so | 1634 // Do not use the code from the function, but let the code be patched so |
| 1633 // that we can record the outgoing edges to other code. | 1635 // that we can record the outgoing edges to other code. |
| 1634 GenerateDartCall(deopt_id, | 1636 GenerateDartCall(deopt_id, |
| 1635 token_index, | 1637 token_index, |
| 1636 &StubCode::CallStaticFunctionLabel(), | 1638 &StubCode::CallStaticFunctionLabel(), |
| 1637 PcDescriptors::kFuncCall, | 1639 PcDescriptors::kOptStaticCall, |
| 1638 locs); | 1640 locs); |
| 1639 const Function& function = *sorted[i].target; | 1641 const Function& function = *sorted[i].target; |
| 1640 AddStaticCallTarget(function); | 1642 AddStaticCallTarget(function); |
| 1641 __ Drop(argument_count); | 1643 __ Drop(argument_count); |
| 1642 if (!is_last_check) { | 1644 if (!is_last_check) { |
| 1643 __ b(&match_found); | 1645 __ b(&match_found); |
| 1644 } | 1646 } |
| 1645 __ Bind(&next_test); | 1647 __ Bind(&next_test); |
| 1646 } | 1648 } |
| 1647 __ Bind(&match_found); | 1649 __ Bind(&match_found); |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1957 __ AddImmediate(SP, kDoubleSize); | 1959 __ AddImmediate(SP, kDoubleSize); |
| 1958 } | 1960 } |
| 1959 | 1961 |
| 1960 | 1962 |
| 1961 #undef __ | 1963 #undef __ |
| 1962 | 1964 |
| 1963 | 1965 |
| 1964 } // namespace dart | 1966 } // namespace dart |
| 1965 | 1967 |
| 1966 #endif // defined TARGET_ARCH_MIPS | 1968 #endif // defined TARGET_ARCH_MIPS |
| OLD | NEW |