Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(361)

Side by Side Diff: src/arm/lithium-codegen-arm.cc

Issue 5967008: ARM implementations of LoadElements, LoadKeyedFastElement, StoreNamedField, S... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/arm/lithium-arm.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1565 matching lines...) Expand 10 before | Expand all | Expand 10 after
1576 // in initial map. 1576 // in initial map.
1577 __ bind(&non_instance); 1577 __ bind(&non_instance);
1578 __ ldr(result, FieldMemOperand(result, Map::kConstructorOffset)); 1578 __ ldr(result, FieldMemOperand(result, Map::kConstructorOffset));
1579 1579
1580 // All done. 1580 // All done.
1581 __ bind(&done); 1581 __ bind(&done);
1582 } 1582 }
1583 1583
1584 1584
1585 void LCodeGen::DoLoadElements(LLoadElements* instr) { 1585 void LCodeGen::DoLoadElements(LLoadElements* instr) {
1586 Abort("DoLoadElements unimplemented."); 1586 ASSERT(instr->result()->Equals(instr->input()));
1587 Register reg = ToRegister(instr->input());
1588
1589 __ ldr(reg, FieldMemOperand(reg, JSObject::kElementsOffset));
1590 if (FLAG_debug_code) {
1591 Label done;
Søren Thygesen Gjesse 2011/01/06 10:38:11 r9 -> scratch0()
Alexandre 2011/01/06 14:54:44 Done.
1592 Register scratch = r9;
1593 __ ldr(scratch, FieldMemOperand(reg, HeapObject::kMapOffset));
1594 __ LoadRoot(ip, Heap::kFixedArrayMapRootIndex);
1595 __ cmp(scratch, ip);
1596 __ b(eq, &done);
1597 __ LoadRoot(ip, Heap::kFixedCOWArrayMapRootIndex);
1598 __ cmp(scratch, ip);
1599 __ Check(eq, "Check for fast elements failed.");
1600 __ bind(&done);
1601 }
1587 } 1602 }
1588 1603
1589 1604
1590 void LCodeGen::DoAccessArgumentsAt(LAccessArgumentsAt* instr) { 1605 void LCodeGen::DoAccessArgumentsAt(LAccessArgumentsAt* instr) {
1591 Abort("DoAccessArgumentsAt unimplemented."); 1606 Abort("DoAccessArgumentsAt unimplemented.");
1592 } 1607 }
1593 1608
1594 1609
1595 void LCodeGen::DoLoadKeyedFastElement(LLoadKeyedFastElement* instr) { 1610 void LCodeGen::DoLoadKeyedFastElement(LLoadKeyedFastElement* instr) {
Søren Thygesen Gjesse 2011/01/06 10:38:11 r9 -> scratch0(), move Register scratch = scratch
Alexandre 2011/01/06 14:54:44 Done.
1596 Abort("DoLoadKeyedFastElement unimplemented."); 1611 Register elements = ToRegister(instr->elements());
1612 Register key = EmitLoadRegister(instr->key(), r9);
1613 Register result;
1614 Register scratch = r9;
1615
1616 if (instr->load_result() != NULL) {
1617 result = ToRegister(instr->load_result());
1618 } else {
1619 result = ToRegister(instr->result());
1620 ASSERT(result.is(elements));
1621 }
1622
1623 // Load the result.
1624 __ add(scratch, elements, Operand(key, LSL, kPointerSizeLog2));
1625 __ ldr(result, FieldMemOperand(scratch, FixedArray::kHeaderSize));
1626
1627 Representation r = instr->hydrogen()->representation();
1628 if (r.IsInteger32()) {
1629 // Untag and check for smi.
1630 __ SmiUntag(result);
1631 DeoptimizeIf(cs, instr->environment());
1632 } else if (r.IsDouble()) {
1633 EmitNumberUntagD(result,
1634 ToDoubleRegister(instr->result()),
1635 instr->environment());
1636 } else {
1637 // Check for the hole value.
1638 ASSERT(r.IsTagged());
1639 __ LoadRoot(scratch, Heap::kTheHoleValueRootIndex);
1640 __ cmp(result, scratch);
1641 DeoptimizeIf(eq, instr->environment());
1642 }
1597 } 1643 }
1598 1644
1599 1645
1600 void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) { 1646 void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) {
1601 ASSERT(ToRegister(instr->object()).is(r1)); 1647 ASSERT(ToRegister(instr->object()).is(r1));
1602 ASSERT(ToRegister(instr->key()).is(r0)); 1648 ASSERT(ToRegister(instr->key()).is(r0));
1603 1649
1604 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize)); 1650 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize));
1605 CallCode(ic, RelocInfo::CODE_TARGET, instr); 1651 CallCode(ic, RelocInfo::CODE_TARGET, instr);
1606 } 1652 }
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
1772 CallCode(builtin, RelocInfo::CONSTRUCT_CALL, instr); 1818 CallCode(builtin, RelocInfo::CONSTRUCT_CALL, instr);
1773 } 1819 }
1774 1820
1775 1821
1776 void LCodeGen::DoCallRuntime(LCallRuntime* instr) { 1822 void LCodeGen::DoCallRuntime(LCallRuntime* instr) {
1777 CallRuntime(instr->function(), instr->arity(), instr); 1823 CallRuntime(instr->function(), instr->arity(), instr);
1778 } 1824 }
1779 1825
1780 1826
1781 void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) { 1827 void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) {
1782 Abort("DoStoreNamedField unimplemented."); 1828 Register object = ToRegister(instr->object());
1829 Register value = ToRegister(instr->value());
1830 Register scratch = r9;
Søren Thygesen Gjesse 2011/01/06 10:38:11 r9 -> scratch0()
Alexandre 2011/01/06 14:54:44 Done.
1831 int offset = instr->offset();
1832
1833 ASSERT(!object.is(value) && !scratch.is(object) && !scratch.is(value));
Søren Thygesen Gjesse 2011/01/06 10:38:11 Remove the scratch check part from the assert.
Alexandre 2011/01/06 14:54:44 Done.
1834
1835 if (!instr->transition().is_null()) {
1836 __ mov(scratch, Operand(instr->transition()));
1837 __ str(scratch, FieldMemOperand(object, HeapObject::kMapOffset));
1838 }
1839
1840 // Do the store.
1841 if (instr->is_in_object()) {
1842 __ str(value, FieldMemOperand(object, offset));
1843 if (instr->needs_write_barrier()) {
Søren Thygesen Gjesse 2011/01/06 10:38:11 I don't think we need a temp register on ARM, as w
Alexandre 2011/01/06 14:54:44 Removed. On 2011/01/06 10:38:11, Søren Gjesse wrot
1844 Register temp = ToRegister(instr->temp());
1845 // Update the write barrier for the object for in-object properties.
1846 __ RecordWrite(object, Operand(offset), value, temp);
1847 }
1848 } else {
1849 Register temp = ToRegister(instr->temp());
1850 __ ldr(temp, FieldMemOperand(object, JSObject::kPropertiesOffset));
1851 __ str(value, FieldMemOperand(temp, offset));
1852 if (instr->needs_write_barrier()) {
1853 // Update the write barrier for the properties array.
1854 // object is used as a scratch register.
1855 __ RecordWrite(temp, Operand(offset), value, object);
1856 }
1857 }
1783 } 1858 }
1784 1859
1785 1860
1786 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { 1861 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) {
1787 ASSERT(ToRegister(instr->object()).is(r1)); 1862 ASSERT(ToRegister(instr->object()).is(r1));
1788 ASSERT(ToRegister(instr->value()).is(r0)); 1863 ASSERT(ToRegister(instr->value()).is(r0));
1789 1864
1790 // Name is always in r2. 1865 // Name is always in r2.
1791 __ mov(r2, Operand(instr->name())); 1866 __ mov(r2, Operand(instr->name()));
1792 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize)); 1867 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize));
1793 CallCode(ic, RelocInfo::CODE_TARGET, instr); 1868 CallCode(ic, RelocInfo::CODE_TARGET, instr);
1794 } 1869 }
1795 1870
1796 1871
1797 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { 1872 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) {
1798 __ cmp(ToRegister(instr->index()), ToOperand(instr->length())); 1873 __ cmp(ToRegister(instr->index()), ToOperand(instr->length()));
1799 DeoptimizeIf(hs, instr->environment()); 1874 DeoptimizeIf(hs, instr->environment());
1800 } 1875 }
1801 1876
1802 1877
1803 void LCodeGen::DoStoreKeyedFastElement(LStoreKeyedFastElement* instr) { 1878 void LCodeGen::DoStoreKeyedFastElement(LStoreKeyedFastElement* instr) {
1804 Abort("DoStoreKeyedFastElement unimplemented."); 1879 Register value = ToRegister(instr->value());
1880 Register elements = ToRegister(instr->object());
1881 Register key = instr->key()->IsRegister() ? ToRegister(instr->key()) : no_reg;
Søren Thygesen Gjesse 2011/01/06 10:38:11 r9 -> scratch0()
Alexandre 2011/01/06 14:54:44 Done.
1882 Register scratch = r9;
1883
1884 // Do the store.
1885 if (instr->key()->IsConstantOperand()) {
1886 ASSERT(!instr->hydrogen()->NeedsWriteBarrier());
1887 LConstantOperand* const_operand = LConstantOperand::cast(instr->key());
1888 int offset =
1889 ToInteger32(const_operand) * kPointerSize + FixedArray::kHeaderSize;
1890 __ str(value, FieldMemOperand(elements, offset));
1891 } else {
1892 __ add(scratch, elements, Operand(key, LSL, kPointerSizeLog2));
1893 __ str(value, FieldMemOperand(scratch, FixedArray::kHeaderSize));
1894 }
1895
1896 // Update the write barrier unless we're certain that we're storing a smi.
Søren Thygesen Gjesse 2011/01/06 10:38:11 Please change comment to something like // Update
Alexandre 2011/01/06 14:54:44 Removed the comment. The function's name speaks fo
1897 if (instr->hydrogen()->NeedsWriteBarrier()) {
1898 // Compute address of modified element and store it into key register.
1899 __ add(key, scratch, Operand(FixedArray::kHeaderSize));
1900 __ RecordWrite(elements, key, value);
1901 }
1805 } 1902 }
1806 1903
1807 1904
1808 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { 1905 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) {
1809 ASSERT(ToRegister(instr->object()).is(r2)); 1906 ASSERT(ToRegister(instr->object()).is(r2));
1810 ASSERT(ToRegister(instr->key()).is(r1)); 1907 ASSERT(ToRegister(instr->key()).is(r1));
1811 ASSERT(ToRegister(instr->value()).is(r0)); 1908 ASSERT(ToRegister(instr->value()).is(r0));
1812 1909
1813 Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Initialize)); 1910 Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Initialize));
1814 CallCode(ic, RelocInfo::CODE_TARGET, instr); 1911 CallCode(ic, RelocInfo::CODE_TARGET, instr);
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
2370 2467
2371 2468
2372 void LCodeGen::DoOsrEntry(LOsrEntry* instr) { 2469 void LCodeGen::DoOsrEntry(LOsrEntry* instr) {
2373 Abort("DoOsrEntry unimplemented."); 2470 Abort("DoOsrEntry unimplemented.");
2374 } 2471 }
2375 2472
2376 2473
2377 #undef __ 2474 #undef __
2378 2475
2379 } } // namespace v8::internal 2476 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/lithium-arm.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698