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

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

Issue 6069010: First part of lithium ARM port. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Adress comments and a small bug fix 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') | src/hydrogen-instructions.h » ('j') | 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 712 matching lines...) Expand 10 before | Expand all | Expand 10 after
723 } 723 }
724 } 724 }
725 725
726 726
727 void LCodeGen::DoParameter(LParameter* instr) { 727 void LCodeGen::DoParameter(LParameter* instr) {
728 // Nothing to do. 728 // Nothing to do.
729 } 729 }
730 730
731 731
732 void LCodeGen::DoCallStub(LCallStub* instr) { 732 void LCodeGen::DoCallStub(LCallStub* instr) {
733 Abort("DoCallStub unimplemented."); 733 ASSERT(ToRegister(instr->result()).is(r0));
734 switch (instr->hydrogen()->major_key()) {
735 case CodeStub::RegExpConstructResult: {
736 RegExpConstructResultStub stub;
737 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
738 break;
739 }
740 case CodeStub::RegExpExec: {
741 RegExpExecStub stub;
742 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
743 break;
744 }
745 case CodeStub::SubString: {
746 SubStringStub stub;
747 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
748 break;
749 }
750 case CodeStub::StringCharAt: {
751 Abort("StringCharAtStub unimplemented.");
752 break;
753 }
754 case CodeStub::MathPow: {
755 Abort("MathPowStub unimplemented.");
756 break;
757 }
758 case CodeStub::NumberToString: {
759 NumberToStringStub stub;
760 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
761 break;
762 }
763 case CodeStub::StringAdd: {
764 StringAddStub stub(NO_STRING_ADD_FLAGS);
765 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
766 break;
767 }
768 case CodeStub::StringCompare: {
769 StringCompareStub stub;
770 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
771 break;
772 }
773 case CodeStub::TranscendentalCache: {
774 Abort("TranscendentalCache unimplemented.");
775 break;
776 }
777 default:
778 UNREACHABLE();
779 }
734 } 780 }
735 781
736 782
737 void LCodeGen::DoUnknownOSRValue(LUnknownOSRValue* instr) { 783 void LCodeGen::DoUnknownOSRValue(LUnknownOSRValue* instr) {
738 // Nothing to do. 784 // Nothing to do.
739 } 785 }
740 786
741 787
742 void LCodeGen::DoModI(LModI* instr) { 788 void LCodeGen::DoModI(LModI* instr) {
743 Abort("DoModI unimplemented."); 789 Abort("DoModI unimplemented.");
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
895 void LCodeGen::DoConstantT(LConstantT* instr) { 941 void LCodeGen::DoConstantT(LConstantT* instr) {
896 ASSERT(instr->result()->IsRegister()); 942 ASSERT(instr->result()->IsRegister());
897 __ mov(ToRegister(instr->result()), Operand(instr->value())); 943 __ mov(ToRegister(instr->result()), Operand(instr->value()));
898 } 944 }
899 945
900 946
901 void LCodeGen::DoJSArrayLength(LJSArrayLength* instr) { 947 void LCodeGen::DoJSArrayLength(LJSArrayLength* instr) {
902 Register result = ToRegister(instr->result()); 948 Register result = ToRegister(instr->result());
903 Register array = ToRegister(instr->input()); 949 Register array = ToRegister(instr->input());
904 __ ldr(result, FieldMemOperand(array, JSArray::kLengthOffset)); 950 __ ldr(result, FieldMemOperand(array, JSArray::kLengthOffset));
905 Abort("DoJSArrayLength untested.");
906 } 951 }
907 952
908 953
909 void LCodeGen::DoFixedArrayLength(LFixedArrayLength* instr) { 954 void LCodeGen::DoFixedArrayLength(LFixedArrayLength* instr) {
910 Register result = ToRegister(instr->result()); 955 Register result = ToRegister(instr->result());
911 Register array = ToRegister(instr->input()); 956 Register array = ToRegister(instr->input());
912 __ ldr(result, FieldMemOperand(array, FixedArray::kLengthOffset)); 957 __ ldr(result, FieldMemOperand(array, FixedArray::kLengthOffset));
913 Abort("DoFixedArrayLength untested."); 958 Abort("DoFixedArrayLength untested.");
914 } 959 }
915 960
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
1164 Abort("DoCmpJSObjectEq untested."); 1209 Abort("DoCmpJSObjectEq untested.");
1165 } 1210 }
1166 1211
1167 1212
1168 void LCodeGen::DoCmpJSObjectEqAndBranch(LCmpJSObjectEqAndBranch* instr) { 1213 void LCodeGen::DoCmpJSObjectEqAndBranch(LCmpJSObjectEqAndBranch* instr) {
1169 Abort("DoCmpJSObjectEqAndBranch unimplemented."); 1214 Abort("DoCmpJSObjectEqAndBranch unimplemented.");
1170 } 1215 }
1171 1216
1172 1217
1173 void LCodeGen::DoIsNull(LIsNull* instr) { 1218 void LCodeGen::DoIsNull(LIsNull* instr) {
1174 Abort("DoIsNull unimplemented."); 1219 Register reg = ToRegister(instr->input());
1220 Register result = ToRegister(instr->result());
1221
1222 __ LoadRoot(ip, Heap::kNullValueRootIndex);
1223 __ cmp(reg, ip);
1224 if (instr->is_strict()) {
1225 __ LoadRoot(result, Heap::kTrueValueRootIndex, eq);
1226 __ LoadRoot(result, Heap::kFalseValueRootIndex, ne);
1227 } else {
1228 Label true_value, false_value, done;
1229 __ b(eq, &true_value);
1230 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex);
1231 __ cmp(ip, reg);
1232 __ b(eq, &true_value);
1233 __ tst(reg, Operand(kSmiTagMask));
1234 __ b(eq, &false_value);
1235 // Check for undetectable objects by looking in the bit field in
1236 // the map. The object has already been smi checked.
1237 Register scratch = result;
1238 __ ldr(scratch, FieldMemOperand(reg, HeapObject::kMapOffset));
1239 __ ldrb(scratch, FieldMemOperand(scratch, Map::kBitFieldOffset));
1240 __ tst(scratch, Operand(1 << Map::kIsUndetectable));
1241 __ b(ne, &true_value);
1242 __ bind(&false_value);
1243 __ LoadRoot(result, Heap::kFalseValueRootIndex);
1244 __ jmp(&done);
1245 __ bind(&true_value);
1246 __ LoadRoot(result, Heap::kTrueValueRootIndex);
1247 __ bind(&done);
1248 }
1175 } 1249 }
1176 1250
1177 1251
1178 void LCodeGen::DoIsNullAndBranch(LIsNullAndBranch* instr) { 1252 void LCodeGen::DoIsNullAndBranch(LIsNullAndBranch* instr) {
1179 Register reg = ToRegister(instr->input()); 1253 Register reg = ToRegister(instr->input());
1180 1254
1181 // TODO(fsc): If the expression is known to be a smi, then it's 1255 // TODO(fsc): If the expression is known to be a smi, then it's
1182 // definitely not null. Jump to the false block. 1256 // definitely not null. Jump to the false block.
1183 1257
1184 int true_block = chunk_->LookupDestination(instr->true_block_id()); 1258 int true_block = chunk_->LookupDestination(instr->true_block_id());
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
1320 Abort("DoClassOfTest unimplemented."); 1394 Abort("DoClassOfTest unimplemented.");
1321 } 1395 }
1322 1396
1323 1397
1324 void LCodeGen::DoClassOfTestAndBranch(LClassOfTestAndBranch* instr) { 1398 void LCodeGen::DoClassOfTestAndBranch(LClassOfTestAndBranch* instr) {
1325 Abort("DoClassOfTestAndBranch unimplemented."); 1399 Abort("DoClassOfTestAndBranch unimplemented.");
1326 } 1400 }
1327 1401
1328 1402
1329 void LCodeGen::DoCmpMapAndBranch(LCmpMapAndBranch* instr) { 1403 void LCodeGen::DoCmpMapAndBranch(LCmpMapAndBranch* instr) {
1330 Abort("DoCmpMapAndBranch unimplemented."); 1404 Register reg = ToRegister(instr->input());
1405 Register temp = ToRegister(instr->temp());
1406 int true_block = instr->true_block_id();
1407 int false_block = instr->false_block_id();
1408
1409 __ ldr(temp, FieldMemOperand(reg, HeapObject::kMapOffset));
1410 __ cmp(temp, Operand(instr->map()));
1411 EmitBranch(true_block, false_block, eq);
1331 } 1412 }
1332 1413
1333 1414
1334 void LCodeGen::DoInstanceOf(LInstanceOf* instr) { 1415 void LCodeGen::DoInstanceOf(LInstanceOf* instr) {
1335 ASSERT(ToRegister(instr->left()).is(r0)); // Object is in r0. 1416 ASSERT(ToRegister(instr->left()).is(r0)); // Object is in r0.
1336 ASSERT(ToRegister(instr->right()).is(r1)); // Function is in r1. 1417 ASSERT(ToRegister(instr->right()).is(r1)); // Function is in r1.
1337 1418
1338 InstanceofStub stub(InstanceofStub::kArgsInRegisters); 1419 InstanceofStub stub(InstanceofStub::kArgsInRegisters);
1339 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); 1420 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
1340 1421
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
1422 1503
1423 1504
1424 void LCodeGen::DoStoreGlobal(LStoreGlobal* instr) { 1505 void LCodeGen::DoStoreGlobal(LStoreGlobal* instr) {
1425 Register value = ToRegister(instr->input()); 1506 Register value = ToRegister(instr->input());
1426 __ mov(ip, Operand(Handle<Object>(instr->hydrogen()->cell()))); 1507 __ mov(ip, Operand(Handle<Object>(instr->hydrogen()->cell())));
1427 __ str(value, FieldMemOperand(ip, JSGlobalPropertyCell::kValueOffset)); 1508 __ str(value, FieldMemOperand(ip, JSGlobalPropertyCell::kValueOffset));
1428 } 1509 }
1429 1510
1430 1511
1431 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { 1512 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) {
1432 Abort("DoLoadNamedField unimplemented."); 1513 Register object = ToRegister(instr->input());
1514 Register result = ToRegister(instr->result());
1515 if (instr->hydrogen()->is_in_object()) {
1516 __ ldr(result, FieldMemOperand(object, instr->hydrogen()->offset()));
1517 } else {
1518 __ ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset));
1519 __ ldr(result, FieldMemOperand(result, instr->hydrogen()->offset()));
1520 }
1433 } 1521 }
1434 1522
1435 1523
1436 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { 1524 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) {
1437 ASSERT(ToRegister(instr->object()).is(r0)); 1525 ASSERT(ToRegister(instr->object()).is(r0));
1438 ASSERT(ToRegister(instr->result()).is(r0)); 1526 ASSERT(ToRegister(instr->result()).is(r0));
1439 1527
1440 // Name is always in r2. 1528 // Name is always in r2.
1441 __ mov(r2, Operand(instr->name())); 1529 __ mov(r2, Operand(instr->name()));
1442 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize)); 1530 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize));
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
1578 1666
1579 // Setup deoptimization. 1667 // Setup deoptimization.
1580 RegisterLazyDeoptimization(instr); 1668 RegisterLazyDeoptimization(instr);
1581 1669
1582 // Restore context. 1670 // Restore context.
1583 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 1671 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
1584 } 1672 }
1585 1673
1586 1674
1587 void LCodeGen::DoCallConstantFunction(LCallConstantFunction* instr) { 1675 void LCodeGen::DoCallConstantFunction(LCallConstantFunction* instr) {
1588 Abort("DoCallConstantFunction unimplemented."); 1676 ASSERT(ToRegister(instr->result()).is(r0));
1677 __ mov(r1, Operand(instr->function()));
1678 CallKnownFunction(instr->function(), instr->arity(), instr);
1589 } 1679 }
1590 1680
1591 1681
1592 void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LUnaryMathOperation* instr) { 1682 void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LUnaryMathOperation* instr) {
1593 Abort("DoDeferredMathAbsTaggedHeapNumber unimplemented."); 1683 Abort("DoDeferredMathAbsTaggedHeapNumber unimplemented.");
1594 } 1684 }
1595 1685
1596 1686
1597 void LCodeGen::DoMathAbs(LUnaryMathOperation* instr) { 1687 void LCodeGen::DoMathAbs(LUnaryMathOperation* instr) {
1598 Abort("DoMathAbs unimplemented."); 1688 Abort("DoMathAbs unimplemented.");
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1638 int arity = instr->arity(); 1728 int arity = instr->arity();
1639 Handle<Code> ic = StubCache::ComputeCallInitialize(arity, NOT_IN_LOOP); 1729 Handle<Code> ic = StubCache::ComputeCallInitialize(arity, NOT_IN_LOOP);
1640 __ mov(r2, Operand(instr->name())); 1730 __ mov(r2, Operand(instr->name()));
1641 CallCode(ic, RelocInfo::CODE_TARGET, instr); 1731 CallCode(ic, RelocInfo::CODE_TARGET, instr);
1642 // Restore context register. 1732 // Restore context register.
1643 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 1733 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
1644 } 1734 }
1645 1735
1646 1736
1647 void LCodeGen::DoCallFunction(LCallFunction* instr) { 1737 void LCodeGen::DoCallFunction(LCallFunction* instr) {
1648 Abort("DoCallFunction unimplemented."); 1738 ASSERT(ToRegister(instr->result()).is(r0));
1739
1740 int arity = instr->arity();
1741 CallFunctionStub stub(arity, NOT_IN_LOOP, RECEIVER_MIGHT_BE_VALUE);
1742 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
1743 __ Drop(1);
1744 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
1649 } 1745 }
1650 1746
1651 1747
1652 void LCodeGen::DoCallGlobal(LCallGlobal* instr) { 1748 void LCodeGen::DoCallGlobal(LCallGlobal* instr) {
1653 Abort("DoCallGlobal unimplemented."); 1749 Abort("DoCallGlobal unimplemented.");
1654 } 1750 }
1655 1751
1656 1752
1657 void LCodeGen::DoCallKnownGlobal(LCallKnownGlobal* instr) { 1753 void LCodeGen::DoCallKnownGlobal(LCallKnownGlobal* instr) {
1658 ASSERT(ToRegister(instr->result()).is(r0)); 1754 ASSERT(ToRegister(instr->result()).is(r0));
(...skipping 27 matching lines...) Expand all
1686 ASSERT(ToRegister(instr->value()).is(r0)); 1782 ASSERT(ToRegister(instr->value()).is(r0));
1687 1783
1688 // Name is always in r2. 1784 // Name is always in r2.
1689 __ mov(r2, Operand(instr->name())); 1785 __ mov(r2, Operand(instr->name()));
1690 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize)); 1786 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize));
1691 CallCode(ic, RelocInfo::CODE_TARGET, instr); 1787 CallCode(ic, RelocInfo::CODE_TARGET, instr);
1692 } 1788 }
1693 1789
1694 1790
1695 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { 1791 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) {
1696 Abort("DoBoundsCheck unimplemented."); 1792 __ cmp(ToRegister(instr->index()), ToOperand(instr->length()));
1793 DeoptimizeIf(hs, instr->environment());
1697 } 1794 }
1698 1795
1699 1796
1700 void LCodeGen::DoStoreKeyedFastElement(LStoreKeyedFastElement* instr) { 1797 void LCodeGen::DoStoreKeyedFastElement(LStoreKeyedFastElement* instr) {
1701 Abort("DoStoreKeyedFastElement unimplemented."); 1798 Abort("DoStoreKeyedFastElement unimplemented.");
1702 } 1799 }
1703 1800
1704 1801
1705 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { 1802 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) {
1706 ASSERT(ToRegister(instr->object()).is(r2)); 1803 ASSERT(ToRegister(instr->object()).is(r2));
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
2030 ASSERT(input->IsRegister()); 2127 ASSERT(input->IsRegister());
2031 Register reg = ToRegister(input); 2128 Register reg = ToRegister(input);
2032 __ ldr(r9, FieldMemOperand(reg, HeapObject::kMapOffset)); 2129 __ ldr(r9, FieldMemOperand(reg, HeapObject::kMapOffset));
2033 __ cmp(r9, Operand(instr->hydrogen()->map())); 2130 __ cmp(r9, Operand(instr->hydrogen()->map()));
2034 DeoptimizeIf(ne, instr->environment()); 2131 DeoptimizeIf(ne, instr->environment());
2035 } 2132 }
2036 2133
2037 2134
2038 void LCodeGen::LoadPrototype(Register result, 2135 void LCodeGen::LoadPrototype(Register result,
2039 Handle<JSObject> prototype) { 2136 Handle<JSObject> prototype) {
2040 Abort("LoadPrototype unimplemented."); 2137 if (Heap::InNewSpace(*prototype)) {
2138 Handle<JSGlobalPropertyCell> cell =
2139 Factory::NewJSGlobalPropertyCell(prototype);
2140 __ mov(result, Operand(cell));
2141 } else {
2142 __ mov(result, Operand(prototype));
2143 }
2041 } 2144 }
2042 2145
2043 2146
2044 void LCodeGen::DoCheckPrototypeMaps(LCheckPrototypeMaps* instr) { 2147 void LCodeGen::DoCheckPrototypeMaps(LCheckPrototypeMaps* instr) {
2045 Abort("DoCheckPrototypeMaps unimplemented."); 2148 Register temp1 = ToRegister(instr->temp1());
2149 Register temp2 = ToRegister(instr->temp2());
2150
2151 Handle<JSObject> holder = instr->holder();
2152 Handle<Map> receiver_map = instr->receiver_map();
2153 Handle<JSObject> current_prototype(JSObject::cast(receiver_map->prototype()));
2154
2155 // Load prototype object.
2156 LoadPrototype(temp1, current_prototype);
2157
2158 // Check prototype maps up to the holder.
2159 while (!current_prototype.is_identical_to(holder)) {
2160 __ ldr(temp2, FieldMemOperand(temp1, HeapObject::kMapOffset));
2161 __ cmp(temp2, Operand(Handle<Map>(current_prototype->map())));
2162 DeoptimizeIf(ne, instr->environment());
2163 current_prototype =
2164 Handle<JSObject>(JSObject::cast(current_prototype->GetPrototype()));
2165 // Load next prototype object.
2166 LoadPrototype(temp1, current_prototype);
2167 }
2168
2169 // Check the holder map.
2170 __ ldr(temp2, FieldMemOperand(temp1, HeapObject::kMapOffset));
2171 __ cmp(temp2, Operand(Handle<Map>(current_prototype->map())));
2172 DeoptimizeIf(ne, instr->environment());
2046 } 2173 }
2047 2174
2048 2175
2049 void LCodeGen::DoArrayLiteral(LArrayLiteral* instr) { 2176 void LCodeGen::DoArrayLiteral(LArrayLiteral* instr) {
2050 Abort("DoArrayLiteral unimplemented."); 2177 Abort("DoArrayLiteral unimplemented.");
2051 } 2178 }
2052 2179
2053 2180
2054 void LCodeGen::DoObjectLiteral(LObjectLiteral* instr) { 2181 void LCodeGen::DoObjectLiteral(LObjectLiteral* instr) {
2055 Abort("DoObjectLiteral unimplemented."); 2182 Abort("DoObjectLiteral unimplemented.");
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
2204 2331
2205 2332
2206 void LCodeGen::DoOsrEntry(LOsrEntry* instr) { 2333 void LCodeGen::DoOsrEntry(LOsrEntry* instr) {
2207 Abort("DoOsrEntry unimplemented."); 2334 Abort("DoOsrEntry unimplemented.");
2208 } 2335 }
2209 2336
2210 2337
2211 #undef __ 2338 #undef __
2212 2339
2213 } } // namespace v8::internal 2340 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/lithium-arm.cc ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698