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

Side by Side Diff: src/mips64/lithium-mips64.cc

Issue 371923006: Add mips64 port. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebase Created 6 years, 5 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/mips64/lithium-mips64.h ('k') | src/mips64/macro-assembler-mips64.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/hydrogen-osr.h" 7 #include "src/hydrogen-osr.h"
8 #include "src/lithium-allocator-inl.h" 8 #include "src/lithium-allocator-inl.h"
9 #include "src/mips/lithium-codegen-mips.h" 9 #include "src/mips64/lithium-codegen-mips64.h"
10 #include "src/mips/lithium-mips.h" 10 #include "src/mips64/lithium-mips64.h"
11 11
12 namespace v8 { 12 namespace v8 {
13 namespace internal { 13 namespace internal {
14 14
15 #define DEFINE_COMPILE(type) \ 15 #define DEFINE_COMPILE(type) \
16 void L##type::CompileToNative(LCodeGen* generator) { \ 16 void L##type::CompileToNative(LCodeGen* generator) { \
17 generator->Do##type(this); \ 17 generator->Do##type(this); \
18 } 18 }
19 LITHIUM_CONCRETE_INSTRUCTION_LIST(DEFINE_COMPILE) 19 LITHIUM_CONCRETE_INSTRUCTION_LIST(DEFINE_COMPILE)
20 #undef DEFINE_COMPILE 20 #undef DEFINE_COMPILE
(...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after
990 return MarkAsCall(DefineFixed(result, v0), instr); 990 return MarkAsCall(DefineFixed(result, v0), instr);
991 } 991 }
992 992
993 993
994 LInstruction* LChunkBuilder::DoInstanceOfKnownGlobal( 994 LInstruction* LChunkBuilder::DoInstanceOfKnownGlobal(
995 HInstanceOfKnownGlobal* instr) { 995 HInstanceOfKnownGlobal* instr) {
996 LInstanceOfKnownGlobal* result = 996 LInstanceOfKnownGlobal* result =
997 new(zone()) LInstanceOfKnownGlobal( 997 new(zone()) LInstanceOfKnownGlobal(
998 UseFixed(instr->context(), cp), 998 UseFixed(instr->context(), cp),
999 UseFixed(instr->left(), a0), 999 UseFixed(instr->left(), a0),
1000 FixedTemp(t0)); 1000 FixedTemp(a4));
1001 return MarkAsCall(DefineFixed(result, v0), instr); 1001 return MarkAsCall(DefineFixed(result, v0), instr);
1002 } 1002 }
1003 1003
1004 1004
1005 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) { 1005 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) {
1006 LOperand* receiver = UseRegisterAtStart(instr->receiver()); 1006 LOperand* receiver = UseRegisterAtStart(instr->receiver());
1007 LOperand* function = UseRegisterAtStart(instr->function()); 1007 LOperand* function = UseRegisterAtStart(instr->function());
1008 LWrapReceiver* result = new(zone()) LWrapReceiver(receiver, function); 1008 LWrapReceiver* result = new(zone()) LWrapReceiver(receiver, function);
1009 return AssignEnvironment(DefineAsRegister(result)); 1009 return AssignEnvironment(DefineAsRegister(result));
1010 } 1010 }
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
1270 ASSERT(instr->representation().IsSmiOrInteger32()); 1270 ASSERT(instr->representation().IsSmiOrInteger32());
1271 ASSERT(instr->left()->representation().Equals(instr->representation())); 1271 ASSERT(instr->left()->representation().Equals(instr->representation()));
1272 ASSERT(instr->right()->representation().Equals(instr->representation())); 1272 ASSERT(instr->right()->representation().Equals(instr->representation()));
1273 LOperand* dividend = UseRegister(instr->left()); 1273 LOperand* dividend = UseRegister(instr->left());
1274 int32_t divisor = instr->right()->GetInteger32Constant(); 1274 int32_t divisor = instr->right()->GetInteger32Constant();
1275 LInstruction* result = DefineAsRegister(new(zone()) LDivByPowerOf2I( 1275 LInstruction* result = DefineAsRegister(new(zone()) LDivByPowerOf2I(
1276 dividend, divisor)); 1276 dividend, divisor));
1277 if ((instr->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0) || 1277 if ((instr->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0) ||
1278 (instr->CheckFlag(HValue::kCanOverflow) && divisor == -1) || 1278 (instr->CheckFlag(HValue::kCanOverflow) && divisor == -1) ||
1279 (!instr->CheckFlag(HInstruction::kAllUsesTruncatingToInt32) && 1279 (!instr->CheckFlag(HInstruction::kAllUsesTruncatingToInt32) &&
1280 divisor != 1 && divisor != -1)) { 1280 divisor != 1 && divisor != -1)) {
1281 result = AssignEnvironment(result); 1281 result = AssignEnvironment(result);
1282 } 1282 }
1283 return result; 1283 return result;
1284 } 1284 }
1285 1285
1286 1286
1287 LInstruction* LChunkBuilder::DoDivByConstI(HDiv* instr) { 1287 LInstruction* LChunkBuilder::DoDivByConstI(HDiv* instr) {
1288 ASSERT(instr->representation().IsInteger32()); 1288 ASSERT(instr->representation().IsInteger32());
1289 ASSERT(instr->left()->representation().Equals(instr->representation())); 1289 ASSERT(instr->left()->representation().Equals(instr->representation()));
1290 ASSERT(instr->right()->representation().Equals(instr->representation())); 1290 ASSERT(instr->right()->representation().Equals(instr->representation()));
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
1485 } 1485 }
1486 right_op = UseRegister(right); 1486 right_op = UseRegister(right);
1487 } 1487 }
1488 LMulI* mul = new(zone()) LMulI(left_op, right_op); 1488 LMulI* mul = new(zone()) LMulI(left_op, right_op);
1489 if (can_overflow || bailout_on_minus_zero) { 1489 if (can_overflow || bailout_on_minus_zero) {
1490 AssignEnvironment(mul); 1490 AssignEnvironment(mul);
1491 } 1491 }
1492 return DefineAsRegister(mul); 1492 return DefineAsRegister(mul);
1493 1493
1494 } else if (instr->representation().IsDouble()) { 1494 } else if (instr->representation().IsDouble()) {
1495 if (kArchVariant == kMips32r2) { 1495 if (kArchVariant == kMips64r2) {
1496 if (instr->HasOneUse() && instr->uses().value()->IsAdd()) { 1496 if (instr->HasOneUse() && instr->uses().value()->IsAdd()) {
1497 HAdd* add = HAdd::cast(instr->uses().value()); 1497 HAdd* add = HAdd::cast(instr->uses().value());
1498 if (instr == add->left()) { 1498 if (instr == add->left()) {
1499 // This mul is the lhs of an add. The add and mul will be folded 1499 // This mul is the lhs of an add. The add and mul will be folded
1500 // into a multiply-add. 1500 // into a multiply-add.
1501 return NULL; 1501 return NULL;
1502 } 1502 }
1503 if (instr == add->right() && !add->left()->IsMul()) { 1503 if (instr == add->right() && !add->left()->IsMul()) {
1504 // This mul is the rhs of an add, where the lhs is not another mul. 1504 // This mul is the rhs of an add, where the lhs is not another mul.
1505 // The add and mul will be folded into a multiply-add. 1505 // The add and mul will be folded into a multiply-add.
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
1558 } else if (instr->representation().IsExternal()) { 1558 } else if (instr->representation().IsExternal()) {
1559 ASSERT(instr->left()->representation().IsExternal()); 1559 ASSERT(instr->left()->representation().IsExternal());
1560 ASSERT(instr->right()->representation().IsInteger32()); 1560 ASSERT(instr->right()->representation().IsInteger32());
1561 ASSERT(!instr->CheckFlag(HValue::kCanOverflow)); 1561 ASSERT(!instr->CheckFlag(HValue::kCanOverflow));
1562 LOperand* left = UseRegisterAtStart(instr->left()); 1562 LOperand* left = UseRegisterAtStart(instr->left());
1563 LOperand* right = UseOrConstantAtStart(instr->right()); 1563 LOperand* right = UseOrConstantAtStart(instr->right());
1564 LAddI* add = new(zone()) LAddI(left, right); 1564 LAddI* add = new(zone()) LAddI(left, right);
1565 LInstruction* result = DefineAsRegister(add); 1565 LInstruction* result = DefineAsRegister(add);
1566 return result; 1566 return result;
1567 } else if (instr->representation().IsDouble()) { 1567 } else if (instr->representation().IsDouble()) {
1568 if (kArchVariant == kMips32r2) { 1568 if (kArchVariant == kMips64r2) {
1569 if (instr->left()->IsMul()) 1569 if (instr->left()->IsMul())
1570 return DoMultiplyAdd(HMul::cast(instr->left()), instr->right()); 1570 return DoMultiplyAdd(HMul::cast(instr->left()), instr->right());
1571 1571
1572 if (instr->right()->IsMul()) { 1572 if (instr->right()->IsMul()) {
1573 ASSERT(!instr->left()->IsMul()); 1573 ASSERT(!instr->left()->IsMul());
1574 return DoMultiplyAdd(HMul::cast(instr->right()), instr->left()); 1574 return DoMultiplyAdd(HMul::cast(instr->right()), instr->left());
1575 } 1575 }
1576 } 1576 }
1577 return DoArithmeticD(Token::ADD, instr); 1577 return DoArithmeticD(Token::ADD, instr);
1578 } else { 1578 } else {
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
1782 LInstruction* LChunkBuilder::DoBoundsCheck(HBoundsCheck* instr) { 1782 LInstruction* LChunkBuilder::DoBoundsCheck(HBoundsCheck* instr) {
1783 if (!FLAG_debug_code && instr->skip_check()) return NULL; 1783 if (!FLAG_debug_code && instr->skip_check()) return NULL;
1784 LOperand* index = UseRegisterOrConstantAtStart(instr->index()); 1784 LOperand* index = UseRegisterOrConstantAtStart(instr->index());
1785 LOperand* length = !index->IsConstantOperand() 1785 LOperand* length = !index->IsConstantOperand()
1786 ? UseRegisterOrConstantAtStart(instr->length()) 1786 ? UseRegisterOrConstantAtStart(instr->length())
1787 : UseRegisterAtStart(instr->length()); 1787 : UseRegisterAtStart(instr->length());
1788 LInstruction* result = new(zone()) LBoundsCheck(index, length); 1788 LInstruction* result = new(zone()) LBoundsCheck(index, length);
1789 if (!FLAG_debug_code || !instr->skip_check()) { 1789 if (!FLAG_debug_code || !instr->skip_check()) {
1790 result = AssignEnvironment(result); 1790 result = AssignEnvironment(result);
1791 } 1791 }
1792 return result; 1792 return result;
1793 } 1793 }
1794 1794
1795 1795
1796 LInstruction* LChunkBuilder::DoBoundsCheckBaseIndexInformation( 1796 LInstruction* LChunkBuilder::DoBoundsCheckBaseIndexInformation(
1797 HBoundsCheckBaseIndexInformation* instr) { 1797 HBoundsCheckBaseIndexInformation* instr) {
1798 UNREACHABLE(); 1798 UNREACHABLE();
1799 return NULL; 1799 return NULL;
1800 } 1800 }
1801 1801
1802 1802
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1857 if (!val->representation().IsSmi()) result = AssignEnvironment(result); 1857 if (!val->representation().IsSmi()) result = AssignEnvironment(result);
1858 return result; 1858 return result;
1859 } 1859 }
1860 } 1860 }
1861 } else if (from.IsDouble()) { 1861 } else if (from.IsDouble()) {
1862 if (to.IsTagged()) { 1862 if (to.IsTagged()) {
1863 info()->MarkAsDeferredCalling(); 1863 info()->MarkAsDeferredCalling();
1864 LOperand* value = UseRegister(val); 1864 LOperand* value = UseRegister(val);
1865 LOperand* temp1 = TempRegister(); 1865 LOperand* temp1 = TempRegister();
1866 LOperand* temp2 = TempRegister(); 1866 LOperand* temp2 = TempRegister();
1867
1867 LUnallocated* result_temp = TempRegister(); 1868 LUnallocated* result_temp = TempRegister();
1868 LNumberTagD* result = new(zone()) LNumberTagD(value, temp1, temp2); 1869 LNumberTagD* result = new(zone()) LNumberTagD(value, temp1, temp2);
1869 return AssignPointerMap(Define(result, result_temp)); 1870 return AssignPointerMap(Define(result, result_temp));
1870 } else if (to.IsSmi()) { 1871 } else if (to.IsSmi()) {
1871 LOperand* value = UseRegister(val); 1872 LOperand* value = UseRegister(val);
1872 return AssignEnvironment( 1873 return AssignEnvironment(
1873 DefineAsRegister(new(zone()) LDoubleToSmi(value))); 1874 DefineAsRegister(new(zone()) LDoubleToSmi(value)));
1874 } else { 1875 } else {
1875 ASSERT(to.IsInteger32()); 1876 ASSERT(to.IsInteger32());
1876 LOperand* value = UseRegister(val); 1877 LOperand* value = UseRegister(val);
1877 LInstruction* result = DefineAsRegister(new(zone()) LDoubleToI(value)); 1878 LInstruction* result = DefineAsRegister(new(zone()) LDoubleToI(value));
1878 if (!instr->CanTruncateToInt32()) result = AssignEnvironment(result); 1879 if (!instr->CanTruncateToInt32()) result = AssignEnvironment(result);
1879 return result; 1880 return result;
1880 } 1881 }
1881 } else if (from.IsInteger32()) { 1882 } else if (from.IsInteger32()) {
1882 info()->MarkAsDeferredCalling(); 1883 info()->MarkAsDeferredCalling();
1883 if (to.IsTagged()) { 1884 if (to.IsTagged()) {
1884 if (!instr->CheckFlag(HValue::kCanOverflow)) { 1885 if (val->CheckFlag(HInstruction::kUint32)) {
1885 LOperand* value = UseRegisterAtStart(val);
1886 return DefineAsRegister(new(zone()) LSmiTag(value));
1887 } else if (val->CheckFlag(HInstruction::kUint32)) {
1888 LOperand* value = UseRegisterAtStart(val); 1886 LOperand* value = UseRegisterAtStart(val);
1889 LOperand* temp1 = TempRegister(); 1887 LOperand* temp1 = TempRegister();
1890 LOperand* temp2 = TempRegister(); 1888 LOperand* temp2 = TempRegister();
1891 LNumberTagU* result = new(zone()) LNumberTagU(value, temp1, temp2); 1889 LNumberTagU* result = new(zone()) LNumberTagU(value, temp1, temp2);
1892 return AssignPointerMap(DefineAsRegister(result)); 1890 return AssignPointerMap(DefineAsRegister(result));
1893 } else { 1891 } else {
1892 STATIC_ASSERT((kMinInt == Smi::kMinValue) &&
1893 (kMaxInt == Smi::kMaxValue));
1894 LOperand* value = UseRegisterAtStart(val); 1894 LOperand* value = UseRegisterAtStart(val);
1895 LOperand* temp1 = TempRegister(); 1895 return DefineAsRegister(new(zone()) LSmiTag(value));
1896 LOperand* temp2 = TempRegister();
1897 LNumberTagI* result = new(zone()) LNumberTagI(value, temp1, temp2);
1898 return AssignPointerMap(DefineAsRegister(result));
1899 } 1896 }
1900 } else if (to.IsSmi()) { 1897 } else if (to.IsSmi()) {
1901 LOperand* value = UseRegister(val); 1898 LOperand* value = UseRegister(val);
1902 LInstruction* result = DefineAsRegister(new(zone()) LSmiTag(value)); 1899 LInstruction* result = DefineAsRegister(new(zone()) LSmiTag(value));
1903 if (instr->CheckFlag(HValue::kCanOverflow)) { 1900 if (instr->CheckFlag(HValue::kCanOverflow)) {
1904 result = AssignEnvironment(result); 1901 result = AssignEnvironment(result);
1905 } 1902 }
1906 return result; 1903 return result;
1907 } else { 1904 } else {
1908 ASSERT(to.IsDouble()); 1905 ASSERT(to.IsDouble());
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
2109 ASSERT(instr->key()->representation().IsSmiOrInteger32()); 2106 ASSERT(instr->key()->representation().IsSmiOrInteger32());
2110 ElementsKind elements_kind = instr->elements_kind(); 2107 ElementsKind elements_kind = instr->elements_kind();
2111 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); 2108 LOperand* key = UseRegisterOrConstantAtStart(instr->key());
2112 LInstruction* result = NULL; 2109 LInstruction* result = NULL;
2113 2110
2114 if (!instr->is_typed_elements()) { 2111 if (!instr->is_typed_elements()) {
2115 LOperand* obj = NULL; 2112 LOperand* obj = NULL;
2116 if (instr->representation().IsDouble()) { 2113 if (instr->representation().IsDouble()) {
2117 obj = UseRegister(instr->elements()); 2114 obj = UseRegister(instr->elements());
2118 } else { 2115 } else {
2119 ASSERT(instr->representation().IsSmiOrTagged()); 2116 ASSERT(instr->representation().IsSmiOrTagged() ||
2117 instr->representation().IsInteger32());
2120 obj = UseRegisterAtStart(instr->elements()); 2118 obj = UseRegisterAtStart(instr->elements());
2121 } 2119 }
2122 result = DefineAsRegister(new(zone()) LLoadKeyed(obj, key)); 2120 result = DefineAsRegister(new(zone()) LLoadKeyed(obj, key));
2123 } else { 2121 } else {
2124 ASSERT( 2122 ASSERT(
2125 (instr->representation().IsInteger32() && 2123 (instr->representation().IsInteger32() &&
2126 !IsDoubleOrFloatElementsKind(elements_kind)) || 2124 !IsDoubleOrFloatElementsKind(elements_kind)) ||
2127 (instr->representation().IsDouble() && 2125 (instr->representation().IsDouble() &&
2128 IsDoubleOrFloatElementsKind(elements_kind))); 2126 IsDoubleOrFloatElementsKind(elements_kind)));
2129 LOperand* backing_store = UseRegister(instr->elements()); 2127 LOperand* backing_store = UseRegister(instr->elements());
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
2161 bool needs_write_barrier = instr->NeedsWriteBarrier(); 2159 bool needs_write_barrier = instr->NeedsWriteBarrier();
2162 LOperand* object = NULL; 2160 LOperand* object = NULL;
2163 LOperand* val = NULL; 2161 LOperand* val = NULL;
2164 LOperand* key = NULL; 2162 LOperand* key = NULL;
2165 2163
2166 if (instr->value()->representation().IsDouble()) { 2164 if (instr->value()->representation().IsDouble()) {
2167 object = UseRegisterAtStart(instr->elements()); 2165 object = UseRegisterAtStart(instr->elements());
2168 key = UseRegisterOrConstantAtStart(instr->key()); 2166 key = UseRegisterOrConstantAtStart(instr->key());
2169 val = UseRegister(instr->value()); 2167 val = UseRegister(instr->value());
2170 } else { 2168 } else {
2171 ASSERT(instr->value()->representation().IsSmiOrTagged()); 2169 ASSERT(instr->value()->representation().IsSmiOrTagged() ||
2170 instr->value()->representation().IsInteger32());
2172 if (needs_write_barrier) { 2171 if (needs_write_barrier) {
2173 object = UseTempRegister(instr->elements()); 2172 object = UseTempRegister(instr->elements());
2174 val = UseTempRegister(instr->value()); 2173 val = UseTempRegister(instr->value());
2175 key = UseTempRegister(instr->key()); 2174 key = UseTempRegister(instr->key());
2176 } else { 2175 } else {
2177 object = UseRegisterAtStart(instr->elements()); 2176 object = UseRegisterAtStart(instr->elements());
2178 val = UseRegisterAtStart(instr->value()); 2177 val = UseRegisterAtStart(instr->value());
2179 key = UseRegisterOrConstantAtStart(instr->key()); 2178 key = UseRegisterOrConstantAtStart(instr->key());
2180 } 2179 }
2181 } 2180 }
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
2519 2518
2520 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { 2519 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2521 LOperand* object = UseRegister(instr->object()); 2520 LOperand* object = UseRegister(instr->object());
2522 LOperand* index = UseTempRegister(instr->index()); 2521 LOperand* index = UseTempRegister(instr->index());
2523 LLoadFieldByIndex* load = new(zone()) LLoadFieldByIndex(object, index); 2522 LLoadFieldByIndex* load = new(zone()) LLoadFieldByIndex(object, index);
2524 LInstruction* result = DefineSameAsFirst(load); 2523 LInstruction* result = DefineSameAsFirst(load);
2525 return AssignPointerMap(result); 2524 return AssignPointerMap(result);
2526 } 2525 }
2527 2526
2528 2527
2529
2530 LInstruction* LChunkBuilder::DoStoreFrameContext(HStoreFrameContext* instr) { 2528 LInstruction* LChunkBuilder::DoStoreFrameContext(HStoreFrameContext* instr) {
2531 LOperand* context = UseRegisterAtStart(instr->context()); 2529 LOperand* context = UseRegisterAtStart(instr->context());
2532 return new(zone()) LStoreFrameContext(context); 2530 return new(zone()) LStoreFrameContext(context);
2533 } 2531 }
2534 2532
2535 2533
2536 LInstruction* LChunkBuilder::DoAllocateBlockContext( 2534 LInstruction* LChunkBuilder::DoAllocateBlockContext(
2537 HAllocateBlockContext* instr) { 2535 HAllocateBlockContext* instr) {
2538 LOperand* context = UseFixed(instr->context(), cp); 2536 LOperand* context = UseFixed(instr->context(), cp);
2539 LOperand* function = UseRegisterAtStart(instr->function()); 2537 LOperand* function = UseRegisterAtStart(instr->function());
2540 LAllocateBlockContext* result = 2538 LAllocateBlockContext* result =
2541 new(zone()) LAllocateBlockContext(context, function); 2539 new(zone()) LAllocateBlockContext(context, function);
2542 return MarkAsCall(DefineFixed(result, cp), instr); 2540 return MarkAsCall(DefineFixed(result, cp), instr);
2543 } 2541 }
2544 2542
2543
2545 } } // namespace v8::internal 2544 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/mips64/lithium-mips64.h ('k') | src/mips64/macro-assembler-mips64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698