| OLD | NEW |
| 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 | 129 |
| 130 // Reserve space for the stack slots needed by the code. | 130 // Reserve space for the stack slots needed by the code. |
| 131 int slots = StackSlotCount(); | 131 int slots = StackSlotCount(); |
| 132 if (slots > 0) { | 132 if (slots > 0) { |
| 133 if (FLAG_debug_code) { | 133 if (FLAG_debug_code) { |
| 134 __ mov(r0, Operand(slots)); | 134 __ mov(r0, Operand(slots)); |
| 135 __ mov(r2, Operand(kSlotsZapValue)); | 135 __ mov(r2, Operand(kSlotsZapValue)); |
| 136 Label loop; | 136 Label loop; |
| 137 __ bind(&loop); | 137 __ bind(&loop); |
| 138 __ push(r2); | 138 __ push(r2); |
| 139 __ sub(r0, r0, Operand(1)); | 139 __ sub(r0, r0, Operand(1), SetCC); |
| 140 __ b(ne, &loop); | 140 __ b(ne, &loop); |
| 141 } else { | 141 } else { |
| 142 __ sub(sp, sp, Operand(slots * kPointerSize)); | 142 __ sub(sp, sp, Operand(slots * kPointerSize)); |
| 143 } | 143 } |
| 144 } | 144 } |
| 145 | 145 |
| 146 // Trace the call. | 146 // Trace the call. |
| 147 if (FLAG_trace) { | 147 if (FLAG_trace) { |
| 148 __ CallRuntime(Runtime::kTraceEnter, 0); | 148 __ CallRuntime(Runtime::kTraceEnter, 0); |
| 149 } | 149 } |
| (...skipping 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1206 // the map. The object has already been smi checked. | 1206 // the map. The object has already been smi checked. |
| 1207 Register scratch = ToRegister(instr->temp()); | 1207 Register scratch = ToRegister(instr->temp()); |
| 1208 __ ldr(scratch, FieldMemOperand(reg, HeapObject::kMapOffset)); | 1208 __ ldr(scratch, FieldMemOperand(reg, HeapObject::kMapOffset)); |
| 1209 __ ldrb(scratch, FieldMemOperand(scratch, Map::kBitFieldOffset)); | 1209 __ ldrb(scratch, FieldMemOperand(scratch, Map::kBitFieldOffset)); |
| 1210 __ tst(scratch, Operand(1 << Map::kIsUndetectable)); | 1210 __ tst(scratch, Operand(1 << Map::kIsUndetectable)); |
| 1211 EmitBranch(true_block, false_block, ne); | 1211 EmitBranch(true_block, false_block, ne); |
| 1212 } | 1212 } |
| 1213 } | 1213 } |
| 1214 | 1214 |
| 1215 | 1215 |
| 1216 Condition LCodeGen::EmitIsObject(Register input, |
| 1217 Register temp1, |
| 1218 Register temp2, |
| 1219 Label* is_not_object, |
| 1220 Label* is_object) { |
| 1221 Abort("EmitIsObject unimplemented."); |
| 1222 return ne; |
| 1223 } |
| 1224 |
| 1225 |
| 1226 void LCodeGen::DoIsObject(LIsObject* instr) { |
| 1227 Abort("DoIsObject unimplemented."); |
| 1228 } |
| 1229 |
| 1230 |
| 1231 void LCodeGen::DoIsObjectAndBranch(LIsObjectAndBranch* instr) { |
| 1232 Abort("DoIsObjectAndBranch unimplemented."); |
| 1233 } |
| 1234 |
| 1235 |
| 1216 void LCodeGen::DoIsSmi(LIsSmi* instr) { | 1236 void LCodeGen::DoIsSmi(LIsSmi* instr) { |
| 1217 ASSERT(instr->hydrogen()->value()->representation().IsTagged()); | 1237 ASSERT(instr->hydrogen()->value()->representation().IsTagged()); |
| 1218 Register result = ToRegister(instr->result()); | 1238 Register result = ToRegister(instr->result()); |
| 1219 Register input_reg = EmitLoadRegister(instr->input(), ip); | 1239 Register input_reg = EmitLoadRegister(instr->input(), ip); |
| 1220 __ tst(input_reg, Operand(kSmiTagMask)); | 1240 __ tst(input_reg, Operand(kSmiTagMask)); |
| 1221 __ LoadRoot(result, Heap::kTrueValueRootIndex); | 1241 __ LoadRoot(result, Heap::kTrueValueRootIndex); |
| 1222 Label done; | 1242 Label done; |
| 1223 __ b(eq, &done); | 1243 __ b(eq, &done); |
| 1224 __ LoadRoot(result, Heap::kFalseValueRootIndex); | 1244 __ LoadRoot(result, Heap::kFalseValueRootIndex); |
| 1225 __ bind(&done); | 1245 __ bind(&done); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1310 Abort("DoClassOfTestAndBranch unimplemented."); | 1330 Abort("DoClassOfTestAndBranch unimplemented."); |
| 1311 } | 1331 } |
| 1312 | 1332 |
| 1313 | 1333 |
| 1314 void LCodeGen::DoCmpMapAndBranch(LCmpMapAndBranch* instr) { | 1334 void LCodeGen::DoCmpMapAndBranch(LCmpMapAndBranch* instr) { |
| 1315 Abort("DoCmpMapAndBranch unimplemented."); | 1335 Abort("DoCmpMapAndBranch unimplemented."); |
| 1316 } | 1336 } |
| 1317 | 1337 |
| 1318 | 1338 |
| 1319 void LCodeGen::DoInstanceOf(LInstanceOf* instr) { | 1339 void LCodeGen::DoInstanceOf(LInstanceOf* instr) { |
| 1320 Abort("DoInstanceOf unimplemented."); | 1340 // We expect object and function in registers r1 and r0. |
| 1341 InstanceofStub stub(InstanceofStub::kArgsInRegisters); |
| 1342 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
| 1343 |
| 1344 Label true_value, done; |
| 1345 __ tst(r0, r0); |
| 1346 __ mov(r0, Operand(FACTORY->false_value()), LeaveCC, eq); |
| 1347 __ mov(r0, Operand(FACTORY->true_value()), LeaveCC, ne); |
| 1321 } | 1348 } |
| 1322 | 1349 |
| 1323 | 1350 |
| 1324 void LCodeGen::DoInstanceOfAndBranch(LInstanceOfAndBranch* instr) { | 1351 void LCodeGen::DoInstanceOfAndBranch(LInstanceOfAndBranch* instr) { |
| 1325 Abort("DoInstanceOfAndBranch unimplemented."); | 1352 Abort("DoInstanceOfAndBranch unimplemented."); |
| 1326 } | 1353 } |
| 1327 | 1354 |
| 1328 | 1355 |
| 1329 | 1356 |
| 1330 static Condition ComputeCompareCondition(Token::Value op) { | 1357 static Condition ComputeCompareCondition(Token::Value op) { |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1522 Abort("DoCallConstantFunction unimplemented."); | 1549 Abort("DoCallConstantFunction unimplemented."); |
| 1523 } | 1550 } |
| 1524 | 1551 |
| 1525 | 1552 |
| 1526 void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LUnaryMathOperation* instr) { | 1553 void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LUnaryMathOperation* instr) { |
| 1527 Abort("DoDeferredMathAbsTaggedHeapNumber unimplemented."); | 1554 Abort("DoDeferredMathAbsTaggedHeapNumber unimplemented."); |
| 1528 } | 1555 } |
| 1529 | 1556 |
| 1530 | 1557 |
| 1531 void LCodeGen::DoMathAbs(LUnaryMathOperation* instr) { | 1558 void LCodeGen::DoMathAbs(LUnaryMathOperation* instr) { |
| 1532 Abort("LUnaryMathOperation unimplemented."); | 1559 Abort("DoMathAbs unimplemented."); |
| 1533 } | 1560 } |
| 1534 | 1561 |
| 1535 | 1562 |
| 1536 void LCodeGen::DoMathFloor(LUnaryMathOperation* instr) { | 1563 void LCodeGen::DoMathFloor(LUnaryMathOperation* instr) { |
| 1537 Abort("DoMathFloor unimplemented."); | 1564 Abort("DoMathFloor unimplemented."); |
| 1538 } | 1565 } |
| 1539 | 1566 |
| 1540 | 1567 |
| 1541 void LCodeGen::DoMathSqrt(LUnaryMathOperation* instr) { | 1568 void LCodeGen::DoMathSqrt(LUnaryMathOperation* instr) { |
| 1542 Abort("DoMathSqrt unimplemented."); | 1569 Abort("DoMathSqrt unimplemented."); |
| 1543 } | 1570 } |
| 1544 | 1571 |
| 1545 | 1572 |
| 1546 void LCodeGen::DoUnaryMathOperation(LUnaryMathOperation* instr) { | 1573 void LCodeGen::DoUnaryMathOperation(LUnaryMathOperation* instr) { |
| 1547 ASSERT(instr->op() == kMathFloor || | |
| 1548 instr->op() == kMathAbs); | |
| 1549 | |
| 1550 switch (instr->op()) { | 1574 switch (instr->op()) { |
| 1551 case kMathAbs: | 1575 case kMathAbs: |
| 1552 DoMathAbs(instr); | 1576 DoMathAbs(instr); |
| 1553 break; | 1577 break; |
| 1554 case kMathFloor: | 1578 case kMathFloor: |
| 1555 DoMathFloor(instr); | 1579 DoMathFloor(instr); |
| 1556 break; | 1580 break; |
| 1557 case kMathSqrt: | 1581 case kMathSqrt: |
| 1558 DoMathSqrt(instr); | 1582 DoMathSqrt(instr); |
| 1559 break; | 1583 break; |
| 1560 default: | 1584 default: |
| 1585 Abort("Unimplemented type of LUnaryMathOperation."); |
| 1561 UNREACHABLE(); | 1586 UNREACHABLE(); |
| 1562 } | 1587 } |
| 1563 } | 1588 } |
| 1564 | 1589 |
| 1565 | 1590 |
| 1566 void LCodeGen::DoCallKeyed(LCallKeyed* instr) { | 1591 void LCodeGen::DoCallKeyed(LCallKeyed* instr) { |
| 1567 Abort("DoCallKeyed unimplemented."); | 1592 Abort("DoCallKeyed unimplemented."); |
| 1568 } | 1593 } |
| 1569 | 1594 |
| 1570 | 1595 |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1732 public: | 1757 public: |
| 1733 DeferredNumberTagD(LCodeGen* codegen, LNumberTagD* instr) | 1758 DeferredNumberTagD(LCodeGen* codegen, LNumberTagD* instr) |
| 1734 : LDeferredCode(codegen), instr_(instr) { } | 1759 : LDeferredCode(codegen), instr_(instr) { } |
| 1735 virtual void Generate() { codegen()->DoDeferredNumberTagD(instr_); } | 1760 virtual void Generate() { codegen()->DoDeferredNumberTagD(instr_); } |
| 1736 private: | 1761 private: |
| 1737 LNumberTagD* instr_; | 1762 LNumberTagD* instr_; |
| 1738 }; | 1763 }; |
| 1739 | 1764 |
| 1740 DoubleRegister input_reg = ToDoubleRegister(instr->input()); | 1765 DoubleRegister input_reg = ToDoubleRegister(instr->input()); |
| 1741 Register reg = ToRegister(instr->result()); | 1766 Register reg = ToRegister(instr->result()); |
| 1742 Register tmp = ToRegister(instr->temp()); | 1767 Register temp1 = ToRegister(instr->temp1()); |
| 1768 Register temp2 = ToRegister(instr->temp2()); |
| 1743 Register scratch = r9; | 1769 Register scratch = r9; |
| 1744 | 1770 |
| 1745 DeferredNumberTagD* deferred = new DeferredNumberTagD(this, instr); | 1771 DeferredNumberTagD* deferred = new DeferredNumberTagD(this, instr); |
| 1746 if (FLAG_inline_new) { | 1772 if (FLAG_inline_new) { |
| 1747 __ LoadRoot(scratch, Heap::kHeapNumberMapRootIndex); | 1773 __ LoadRoot(scratch, Heap::kHeapNumberMapRootIndex); |
| 1748 __ AllocateHeapNumber(reg, tmp, ip, scratch, deferred->entry()); | 1774 __ AllocateHeapNumber(reg, temp1, temp2, scratch, deferred->entry()); |
| 1749 } else { | 1775 } else { |
| 1750 __ jmp(deferred->entry()); | 1776 __ jmp(deferred->entry()); |
| 1751 } | 1777 } |
| 1752 __ bind(deferred->exit()); | 1778 __ bind(deferred->exit()); |
| 1753 __ sub(ip, reg, Operand(kHeapObjectTag)); | 1779 __ sub(ip, reg, Operand(kHeapObjectTag)); |
| 1754 __ vstr(input_reg, ip, HeapNumber::kValueOffset); | 1780 __ vstr(input_reg, ip, HeapNumber::kValueOffset); |
| 1755 } | 1781 } |
| 1756 | 1782 |
| 1757 | 1783 |
| 1758 void LCodeGen::DoDeferredNumberTagD(LNumberTagD* instr) { | 1784 void LCodeGen::DoDeferredNumberTagD(LNumberTagD* instr) { |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2143 | 2169 |
| 2144 | 2170 |
| 2145 void LCodeGen::DoOsrEntry(LOsrEntry* instr) { | 2171 void LCodeGen::DoOsrEntry(LOsrEntry* instr) { |
| 2146 Abort("DoOsrEntry unimplemented."); | 2172 Abort("DoOsrEntry unimplemented."); |
| 2147 } | 2173 } |
| 2148 | 2174 |
| 2149 | 2175 |
| 2150 #undef __ | 2176 #undef __ |
| 2151 | 2177 |
| 2152 } } // namespace v8::internal | 2178 } } // namespace v8::internal |
| OLD | NEW |