| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 1305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1316 LOperand* context = UseFixed(instr->context(), rsi); | 1316 LOperand* context = UseFixed(instr->context(), rsi); |
| 1317 LOperand* constructor = UseFixed(instr->constructor(), rdi); | 1317 LOperand* constructor = UseFixed(instr->constructor(), rdi); |
| 1318 LCallNewArray* result = new(zone()) LCallNewArray(context, constructor); | 1318 LCallNewArray* result = new(zone()) LCallNewArray(context, constructor); |
| 1319 return MarkAsCall(DefineFixed(result, rax), instr); | 1319 return MarkAsCall(DefineFixed(result, rax), instr); |
| 1320 } | 1320 } |
| 1321 | 1321 |
| 1322 | 1322 |
| 1323 LInstruction* LChunkBuilder::DoCallFunction(HCallFunction* instr) { | 1323 LInstruction* LChunkBuilder::DoCallFunction(HCallFunction* instr) { |
| 1324 LOperand* context = UseFixed(instr->context(), rsi); | 1324 LOperand* context = UseFixed(instr->context(), rsi); |
| 1325 LOperand* function = UseFixed(instr->function(), rdi); | 1325 LOperand* function = UseFixed(instr->function(), rdi); |
| 1326 LCallFunction* result = new(zone()) LCallFunction(context, function); | 1326 LCallFunction* call = new(zone()) LCallFunction(context, function); |
| 1327 return MarkAsCall(DefineFixed(result, rax), instr); | 1327 LInstruction* result = DefineFixed(call, rax); |
| 1328 if (instr->IsTailCall()) return result; |
| 1329 return MarkAsCall(result, instr); |
| 1328 } | 1330 } |
| 1329 | 1331 |
| 1330 | 1332 |
| 1331 LInstruction* LChunkBuilder::DoCallRuntime(HCallRuntime* instr) { | 1333 LInstruction* LChunkBuilder::DoCallRuntime(HCallRuntime* instr) { |
| 1332 LOperand* context = UseFixed(instr->context(), rsi); | 1334 LOperand* context = UseFixed(instr->context(), rsi); |
| 1333 LCallRuntime* result = new(zone()) LCallRuntime(context); | 1335 LCallRuntime* result = new(zone()) LCallRuntime(context); |
| 1334 return MarkAsCall(DefineFixed(result, rax), instr); | 1336 return MarkAsCall(DefineFixed(result, rax), instr); |
| 1335 } | 1337 } |
| 1336 | 1338 |
| 1337 | 1339 |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1460 if (instr->HasPowerOf2Divisor()) { | 1462 if (instr->HasPowerOf2Divisor()) { |
| 1461 ASSERT(!right->CanBeZero()); | 1463 ASSERT(!right->CanBeZero()); |
| 1462 LModI* mod = new(zone()) LModI(UseRegisterAtStart(left), | 1464 LModI* mod = new(zone()) LModI(UseRegisterAtStart(left), |
| 1463 UseOrConstant(right), | 1465 UseOrConstant(right), |
| 1464 NULL); | 1466 NULL); |
| 1465 LInstruction* result = DefineSameAsFirst(mod); | 1467 LInstruction* result = DefineSameAsFirst(mod); |
| 1466 return (left->CanBeNegative() && | 1468 return (left->CanBeNegative() && |
| 1467 instr->CheckFlag(HValue::kBailoutOnMinusZero)) | 1469 instr->CheckFlag(HValue::kBailoutOnMinusZero)) |
| 1468 ? AssignEnvironment(result) | 1470 ? AssignEnvironment(result) |
| 1469 : result; | 1471 : result; |
| 1470 } else if (instr->fixed_right_arg().has_value) { | |
| 1471 LModI* mod = new(zone()) LModI(UseRegister(left), | |
| 1472 UseRegisterAtStart(right), | |
| 1473 NULL); | |
| 1474 return AssignEnvironment(DefineSameAsFirst(mod)); | |
| 1475 } else { | 1472 } else { |
| 1476 // The temporary operand is necessary to ensure that right is not | 1473 // The temporary operand is necessary to ensure that right is not |
| 1477 // allocated into edx. | 1474 // allocated into edx. |
| 1478 LModI* mod = new(zone()) LModI(UseFixed(left, rax), | 1475 LModI* mod = new(zone()) LModI(UseFixed(left, rax), |
| 1479 UseRegister(right), | 1476 UseRegister(right), |
| 1480 FixedTemp(rdx)); | 1477 FixedTemp(rdx)); |
| 1481 LInstruction* result = DefineFixed(mod, rdx); | 1478 LInstruction* result = DefineFixed(mod, rdx); |
| 1482 return (right->CanBeZero() || | 1479 return (right->CanBeZero() || |
| 1483 (left->RangeCanInclude(kMinInt) && | 1480 (left->RangeCanInclude(kMinInt) && |
| 1484 right->RangeCanInclude(-1) && | 1481 right->RangeCanInclude(-1) && |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1597 ASSERT(instr->left()->representation().IsDouble()); | 1594 ASSERT(instr->left()->representation().IsDouble()); |
| 1598 LOperand* left = UseFixedDouble(instr->left(), xmm2); | 1595 LOperand* left = UseFixedDouble(instr->left(), xmm2); |
| 1599 LOperand* right = exponent_type.IsDouble() ? | 1596 LOperand* right = exponent_type.IsDouble() ? |
| 1600 UseFixedDouble(instr->right(), xmm1) : UseFixed(instr->right(), rdx); | 1597 UseFixedDouble(instr->right(), xmm1) : UseFixed(instr->right(), rdx); |
| 1601 LPower* result = new(zone()) LPower(left, right); | 1598 LPower* result = new(zone()) LPower(left, right); |
| 1602 return MarkAsCall(DefineFixedDouble(result, xmm3), instr, | 1599 return MarkAsCall(DefineFixedDouble(result, xmm3), instr, |
| 1603 CAN_DEOPTIMIZE_EAGERLY); | 1600 CAN_DEOPTIMIZE_EAGERLY); |
| 1604 } | 1601 } |
| 1605 | 1602 |
| 1606 | 1603 |
| 1607 LInstruction* LChunkBuilder::DoRandom(HRandom* instr) { | |
| 1608 ASSERT(instr->representation().IsDouble()); | |
| 1609 ASSERT(instr->global_object()->representation().IsTagged()); | |
| 1610 LOperand* global_object = UseTempRegister(instr->global_object()); | |
| 1611 LOperand* scratch = TempRegister(); | |
| 1612 LOperand* scratch2 = TempRegister(); | |
| 1613 LOperand* scratch3 = TempRegister(); | |
| 1614 LRandom* result = new(zone()) LRandom( | |
| 1615 global_object, scratch, scratch2, scratch3); | |
| 1616 return DefineFixedDouble(result, xmm1); | |
| 1617 } | |
| 1618 | |
| 1619 | |
| 1620 LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) { | 1604 LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) { |
| 1621 ASSERT(instr->left()->representation().IsTagged()); | 1605 ASSERT(instr->left()->representation().IsTagged()); |
| 1622 ASSERT(instr->right()->representation().IsTagged()); | 1606 ASSERT(instr->right()->representation().IsTagged()); |
| 1623 LOperand* context = UseFixed(instr->context(), rsi); | 1607 LOperand* context = UseFixed(instr->context(), rsi); |
| 1624 LOperand* left = UseFixed(instr->left(), rdx); | 1608 LOperand* left = UseFixed(instr->left(), rdx); |
| 1625 LOperand* right = UseFixed(instr->right(), rax); | 1609 LOperand* right = UseFixed(instr->right(), rax); |
| 1626 LCmpT* result = new(zone()) LCmpT(context, left, right); | 1610 LCmpT* result = new(zone()) LCmpT(context, left, right); |
| 1627 return MarkAsCall(DefineFixed(result, rax), instr); | 1611 return MarkAsCall(DefineFixed(result, rax), instr); |
| 1628 } | 1612 } |
| 1629 | 1613 |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1787 | 1771 |
| 1788 LInstruction* LChunkBuilder::DoSeqStringGetChar(HSeqStringGetChar* instr) { | 1772 LInstruction* LChunkBuilder::DoSeqStringGetChar(HSeqStringGetChar* instr) { |
| 1789 LOperand* string = UseRegisterAtStart(instr->string()); | 1773 LOperand* string = UseRegisterAtStart(instr->string()); |
| 1790 LOperand* index = UseRegisterOrConstantAtStart(instr->index()); | 1774 LOperand* index = UseRegisterOrConstantAtStart(instr->index()); |
| 1791 return DefineAsRegister(new(zone()) LSeqStringGetChar(string, index)); | 1775 return DefineAsRegister(new(zone()) LSeqStringGetChar(string, index)); |
| 1792 } | 1776 } |
| 1793 | 1777 |
| 1794 | 1778 |
| 1795 LInstruction* LChunkBuilder::DoSeqStringSetChar(HSeqStringSetChar* instr) { | 1779 LInstruction* LChunkBuilder::DoSeqStringSetChar(HSeqStringSetChar* instr) { |
| 1796 LOperand* string = UseRegisterAtStart(instr->string()); | 1780 LOperand* string = UseRegisterAtStart(instr->string()); |
| 1797 LOperand* index = UseRegisterOrConstantAtStart(instr->index()); | 1781 LOperand* index = FLAG_debug_code |
| 1798 LOperand* value = UseRegisterOrConstantAtStart(instr->value()); | 1782 ? UseRegisterAtStart(instr->index()) |
| 1799 return new(zone()) LSeqStringSetChar(string, index, value); | 1783 : UseRegisterOrConstantAtStart(instr->index()); |
| 1784 LOperand* value = FLAG_debug_code |
| 1785 ? UseRegisterAtStart(instr->value()) |
| 1786 : UseRegisterOrConstantAtStart(instr->value()); |
| 1787 LOperand* context = FLAG_debug_code ? UseFixed(instr->context(), rsi) : NULL; |
| 1788 LInstruction* result = new(zone()) LSeqStringSetChar(context, string, |
| 1789 index, value); |
| 1790 if (FLAG_debug_code) { |
| 1791 result = MarkAsCall(result, instr); |
| 1792 } |
| 1793 return result; |
| 1800 } | 1794 } |
| 1801 | 1795 |
| 1802 | 1796 |
| 1803 LInstruction* LChunkBuilder::DoBoundsCheck(HBoundsCheck* instr) { | 1797 LInstruction* LChunkBuilder::DoBoundsCheck(HBoundsCheck* instr) { |
| 1804 LOperand* value = UseRegisterOrConstantAtStart(instr->index()); | 1798 LOperand* value = UseRegisterOrConstantAtStart(instr->index()); |
| 1805 LOperand* length = Use(instr->length()); | 1799 LOperand* length = Use(instr->length()); |
| 1806 return AssignEnvironment(new(zone()) LBoundsCheck(value, length)); | 1800 return AssignEnvironment(new(zone()) LBoundsCheck(value, length)); |
| 1807 } | 1801 } |
| 1808 | 1802 |
| 1809 | 1803 |
| (...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2495 | 2489 |
| 2496 LInstruction* LChunkBuilder::DoTypeof(HTypeof* instr) { | 2490 LInstruction* LChunkBuilder::DoTypeof(HTypeof* instr) { |
| 2497 LOperand* context = UseFixed(instr->context(), rsi); | 2491 LOperand* context = UseFixed(instr->context(), rsi); |
| 2498 LOperand* value = UseAtStart(instr->value()); | 2492 LOperand* value = UseAtStart(instr->value()); |
| 2499 LTypeof* result = new(zone()) LTypeof(context, value); | 2493 LTypeof* result = new(zone()) LTypeof(context, value); |
| 2500 return MarkAsCall(DefineFixed(result, rax), instr); | 2494 return MarkAsCall(DefineFixed(result, rax), instr); |
| 2501 } | 2495 } |
| 2502 | 2496 |
| 2503 | 2497 |
| 2504 LInstruction* LChunkBuilder::DoTypeofIsAndBranch(HTypeofIsAndBranch* instr) { | 2498 LInstruction* LChunkBuilder::DoTypeofIsAndBranch(HTypeofIsAndBranch* instr) { |
| 2499 LInstruction* goto_instr = CheckElideControlInstruction(instr); |
| 2500 if (goto_instr != NULL) return goto_instr; |
| 2501 |
| 2505 return new(zone()) LTypeofIsAndBranch(UseTempRegister(instr->value())); | 2502 return new(zone()) LTypeofIsAndBranch(UseTempRegister(instr->value())); |
| 2506 } | 2503 } |
| 2507 | 2504 |
| 2508 | 2505 |
| 2509 LInstruction* LChunkBuilder::DoIsConstructCallAndBranch( | 2506 LInstruction* LChunkBuilder::DoIsConstructCallAndBranch( |
| 2510 HIsConstructCallAndBranch* instr) { | 2507 HIsConstructCallAndBranch* instr) { |
| 2511 return new(zone()) LIsConstructCallAndBranch(TempRegister()); | 2508 return new(zone()) LIsConstructCallAndBranch(TempRegister()); |
| 2512 } | 2509 } |
| 2513 | 2510 |
| 2514 | 2511 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2611 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2608 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
| 2612 LOperand* object = UseRegister(instr->object()); | 2609 LOperand* object = UseRegister(instr->object()); |
| 2613 LOperand* index = UseTempRegister(instr->index()); | 2610 LOperand* index = UseTempRegister(instr->index()); |
| 2614 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); | 2611 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); |
| 2615 } | 2612 } |
| 2616 | 2613 |
| 2617 | 2614 |
| 2618 } } // namespace v8::internal | 2615 } } // namespace v8::internal |
| 2619 | 2616 |
| 2620 #endif // V8_TARGET_ARCH_X64 | 2617 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |