| 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" | 5 #include "vm/globals.h" |
| 6 #if defined(TARGET_ARCH_ARM) | 6 #if defined(TARGET_ARCH_ARM) |
| 7 | 7 |
| 8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
| 9 #include "vm/code_generator.h" | 9 #include "vm/code_generator.h" |
| 10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
| (...skipping 1515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1526 __ mov(IP, ShifterOperand(R1)); // Stack pointer. | 1526 __ mov(IP, ShifterOperand(R1)); // Stack pointer. |
| 1527 __ mov(LR, ShifterOperand(R0)); // Program counter. | 1527 __ mov(LR, ShifterOperand(R0)); // Program counter. |
| 1528 __ mov(R0, ShifterOperand(R3)); // Exception object. | 1528 __ mov(R0, ShifterOperand(R3)); // Exception object. |
| 1529 __ ldr(R1, Address(SP, 0)); // StackTrace object. | 1529 __ ldr(R1, Address(SP, 0)); // StackTrace object. |
| 1530 __ mov(FP, ShifterOperand(R2)); // Frame_pointer. | 1530 __ mov(FP, ShifterOperand(R2)); // Frame_pointer. |
| 1531 __ mov(SP, ShifterOperand(IP)); // Stack pointer. | 1531 __ mov(SP, ShifterOperand(IP)); // Stack pointer. |
| 1532 __ bx(LR); // Jump to the exception handler code. | 1532 __ bx(LR); // Jump to the exception handler code. |
| 1533 } | 1533 } |
| 1534 | 1534 |
| 1535 | 1535 |
| 1536 // Implements equality operator when one of the arguments is null |
| 1537 // (identity check) and updates ICData if necessary. |
| 1538 // LR: return address. |
| 1539 // R1: left argument. |
| 1540 // R0: right argument. |
| 1541 // R5: ICData. |
| 1542 // R0: result. |
| 1543 // TODO(srdjan): Move to VM stubs once Boolean objects become VM objects. |
| 1536 void StubCode::GenerateEqualityWithNullArgStub(Assembler* assembler) { | 1544 void StubCode::GenerateEqualityWithNullArgStub(Assembler* assembler) { |
| 1537 __ Unimplemented("EqualityWithNullArg Stub"); | 1545 __ EnterStubFrame(); |
| 1546 static const intptr_t kNumArgsTested = 2; |
| 1547 #if defined(DEBUG) |
| 1548 { Label ok; |
| 1549 __ ldr(IP, FieldAddress(R5, ICData::num_args_tested_offset())); |
| 1550 __ cmp(IP, ShifterOperand(kNumArgsTested)); |
| 1551 __ b(&ok, EQ); |
| 1552 __ Stop("Incorrect ICData for equality"); |
| 1553 __ Bind(&ok); |
| 1554 } |
| 1555 #endif // DEBUG |
| 1556 // Check IC data, update if needed. |
| 1557 // R5: IC data object (preserved). |
| 1558 __ ldr(R6, FieldAddress(R5, ICData::ic_data_offset())); |
| 1559 // R6: ic_data_array with check entries: classes and target functions. |
| 1560 __ AddImmediate(R6, Array::data_offset() - kHeapObjectTag); |
| 1561 // R6: points directly to the first ic data array element. |
| 1562 |
| 1563 Label get_class_id_as_smi, no_match, loop, found; |
| 1564 __ Bind(&loop); |
| 1565 // Check left. |
| 1566 __ mov(R2, ShifterOperand(R1)); |
| 1567 __ bl(&get_class_id_as_smi); |
| 1568 __ ldr(R3, Address(R6, 0 * kWordSize)); |
| 1569 __ cmp(R2, ShifterOperand(R3)); // Class id match? |
| 1570 __ b(&no_match, NE); |
| 1571 // Check right. |
| 1572 __ mov(R2, ShifterOperand(R0)); |
| 1573 __ bl(&get_class_id_as_smi); |
| 1574 __ ldr(R3, Address(R6, 1 * kWordSize)); |
| 1575 __ cmp(R2, ShifterOperand(R3)); // Class id match? |
| 1576 __ b(&found, EQ); |
| 1577 __ Bind(&no_match); |
| 1578 // Next check group. |
| 1579 __ AddImmediate(R6, kWordSize * ICData::TestEntryLengthFor(kNumArgsTested)); |
| 1580 __ CompareImmediate(R3, Smi::RawValue(kIllegalCid)); // Done? |
| 1581 __ b(&loop, NE); |
| 1582 Label update_ic_data; |
| 1583 __ b(&update_ic_data); |
| 1584 |
| 1585 __ Bind(&found); |
| 1586 const intptr_t count_offset = |
| 1587 ICData::CountIndexFor(kNumArgsTested) * kWordSize; |
| 1588 __ ldr(IP, Address(R6, count_offset)); |
| 1589 __ adds(IP, IP, ShifterOperand(Smi::RawValue(1))); |
| 1590 __ LoadImmediate(IP, Smi::RawValue(Smi::kMaxValue), VS); // If overflow. |
| 1591 __ str(IP, Address(R6, count_offset)); |
| 1592 |
| 1593 Label compute_result; |
| 1594 __ Bind(&compute_result); |
| 1595 __ cmp(R0, ShifterOperand(R1)); |
| 1596 __ LoadObject(R0, Bool::False(), NE); |
| 1597 __ LoadObject(R0, Bool::True(), EQ); |
| 1598 __ LeaveStubFrame(); |
| 1599 __ Ret(); |
| 1600 |
| 1601 __ Bind(&get_class_id_as_smi); |
| 1602 // Test if Smi -> load Smi class for comparison. |
| 1603 __ tst(R2, ShifterOperand(kSmiTagMask)); |
| 1604 __ mov(R2, ShifterOperand(Smi::RawValue(kSmiCid)), EQ); |
| 1605 __ bx(LR, EQ); |
| 1606 __ LoadClassId(R2, R2); |
| 1607 __ SmiTag(R2); |
| 1608 __ bx(LR); |
| 1609 |
| 1610 __ Bind(&update_ic_data); |
| 1611 // R5: ICData |
| 1612 __ PushList((1 << R0) | (1 << R1)); |
| 1613 __ PushObject(Symbols::EqualOperator()); // Target's name. |
| 1614 __ Push(R5); // ICData |
| 1615 __ CallRuntime(kUpdateICDataTwoArgsRuntimeEntry); // Clobbers R4, R5. |
| 1616 __ Drop(2); |
| 1617 __ PopList((1 << R0) | (1 << R1)); |
| 1618 __ b(&compute_result); |
| 1538 } | 1619 } |
| 1539 | 1620 |
| 1540 | 1621 |
| 1541 // Calls to the runtime to optimize the given function. | 1622 // Calls to the runtime to optimize the given function. |
| 1542 // R6: function to be reoptimized. | 1623 // R6: function to be reoptimized. |
| 1543 // R4: argument descriptor (preserved). | 1624 // R4: argument descriptor (preserved). |
| 1544 void StubCode::GenerateOptimizeFunctionStub(Assembler* assembler) { | 1625 void StubCode::GenerateOptimizeFunctionStub(Assembler* assembler) { |
| 1545 __ EnterStubFrame(); | 1626 __ EnterStubFrame(); |
| 1546 __ Push(R4); | 1627 __ Push(R4); |
| 1547 __ LoadImmediate(IP, reinterpret_cast<intptr_t>(Object::null())); | 1628 __ LoadImmediate(IP, reinterpret_cast<intptr_t>(Object::null())); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1640 __ Bind(&reference_compare); | 1721 __ Bind(&reference_compare); |
| 1641 __ cmp(left, ShifterOperand(right)); | 1722 __ cmp(left, ShifterOperand(right)); |
| 1642 __ Bind(&done); | 1723 __ Bind(&done); |
| 1643 __ PopList((1 << R0) | (1 << R1) | (1 << R2)); | 1724 __ PopList((1 << R0) | (1 << R1) | (1 << R2)); |
| 1644 __ Ret(); | 1725 __ Ret(); |
| 1645 } | 1726 } |
| 1646 | 1727 |
| 1647 } // namespace dart | 1728 } // namespace dart |
| 1648 | 1729 |
| 1649 #endif // defined TARGET_ARCH_ARM | 1730 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |