| 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 1310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1321 LOperand* context = UseFixed(instr->context(), cp); | 1321 LOperand* context = UseFixed(instr->context(), cp); |
| 1322 LOperand* constructor = UseFixed(instr->constructor(), r1); | 1322 LOperand* constructor = UseFixed(instr->constructor(), r1); |
| 1323 LCallNewArray* result = new(zone()) LCallNewArray(context, constructor); | 1323 LCallNewArray* result = new(zone()) LCallNewArray(context, constructor); |
| 1324 return MarkAsCall(DefineFixed(result, r0), instr); | 1324 return MarkAsCall(DefineFixed(result, r0), instr); |
| 1325 } | 1325 } |
| 1326 | 1326 |
| 1327 | 1327 |
| 1328 LInstruction* LChunkBuilder::DoCallFunction(HCallFunction* instr) { | 1328 LInstruction* LChunkBuilder::DoCallFunction(HCallFunction* instr) { |
| 1329 LOperand* context = UseFixed(instr->context(), cp); | 1329 LOperand* context = UseFixed(instr->context(), cp); |
| 1330 LOperand* function = UseFixed(instr->function(), r1); | 1330 LOperand* function = UseFixed(instr->function(), r1); |
| 1331 return MarkAsCall( | 1331 LCallFunction* call = new(zone()) LCallFunction(context, function); |
| 1332 DefineFixed(new(zone()) LCallFunction(context, function), r0), instr); | 1332 LInstruction* result = DefineFixed(call, r0); |
| 1333 if (instr->IsTailCall()) return result; |
| 1334 return MarkAsCall(result, instr); |
| 1333 } | 1335 } |
| 1334 | 1336 |
| 1335 | 1337 |
| 1336 LInstruction* LChunkBuilder::DoCallRuntime(HCallRuntime* instr) { | 1338 LInstruction* LChunkBuilder::DoCallRuntime(HCallRuntime* instr) { |
| 1337 LOperand* context = UseFixed(instr->context(), cp); | 1339 LOperand* context = UseFixed(instr->context(), cp); |
| 1338 return MarkAsCall(DefineFixed(new(zone()) LCallRuntime(context), r0), instr); | 1340 return MarkAsCall(DefineFixed(new(zone()) LCallRuntime(context), r0), instr); |
| 1339 } | 1341 } |
| 1340 | 1342 |
| 1341 | 1343 |
| 1342 LInstruction* LChunkBuilder::DoRor(HRor* instr) { | 1344 LInstruction* LChunkBuilder::DoRor(HRor* instr) { |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1474 ASSERT(instr->right()->representation().Equals(instr->representation())); | 1476 ASSERT(instr->right()->representation().Equals(instr->representation())); |
| 1475 if (instr->HasPowerOf2Divisor()) { | 1477 if (instr->HasPowerOf2Divisor()) { |
| 1476 ASSERT(!right->CanBeZero()); | 1478 ASSERT(!right->CanBeZero()); |
| 1477 LModI* mod = new(zone()) LModI(UseRegisterAtStart(left), | 1479 LModI* mod = new(zone()) LModI(UseRegisterAtStart(left), |
| 1478 UseOrConstant(right)); | 1480 UseOrConstant(right)); |
| 1479 LInstruction* result = DefineAsRegister(mod); | 1481 LInstruction* result = DefineAsRegister(mod); |
| 1480 return (left->CanBeNegative() && | 1482 return (left->CanBeNegative() && |
| 1481 instr->CheckFlag(HValue::kBailoutOnMinusZero)) | 1483 instr->CheckFlag(HValue::kBailoutOnMinusZero)) |
| 1482 ? AssignEnvironment(result) | 1484 ? AssignEnvironment(result) |
| 1483 : result; | 1485 : result; |
| 1484 } else if (instr->fixed_right_arg().has_value) { | |
| 1485 LModI* mod = new(zone()) LModI(UseRegisterAtStart(left), | |
| 1486 UseRegisterAtStart(right)); | |
| 1487 return AssignEnvironment(DefineAsRegister(mod)); | |
| 1488 } else if (CpuFeatures::IsSupported(SUDIV)) { | 1486 } else if (CpuFeatures::IsSupported(SUDIV)) { |
| 1489 LModI* mod = new(zone()) LModI(UseRegister(left), | 1487 LModI* mod = new(zone()) LModI(UseRegister(left), |
| 1490 UseRegister(right)); | 1488 UseRegister(right)); |
| 1491 LInstruction* result = DefineAsRegister(mod); | 1489 LInstruction* result = DefineAsRegister(mod); |
| 1492 return (right->CanBeZero() || | 1490 return (right->CanBeZero() || |
| 1493 (left->RangeCanInclude(kMinInt) && | 1491 (left->RangeCanInclude(kMinInt) && |
| 1494 right->RangeCanInclude(-1) && | 1492 right->RangeCanInclude(-1) && |
| 1495 instr->CheckFlag(HValue::kBailoutOnMinusZero)) || | 1493 instr->CheckFlag(HValue::kBailoutOnMinusZero)) || |
| 1496 (left->CanBeNegative() && | 1494 (left->CanBeNegative() && |
| 1497 instr->CanBeZero() && | 1495 instr->CanBeZero() && |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1715 LOperand* right = exponent_type.IsDouble() ? | 1713 LOperand* right = exponent_type.IsDouble() ? |
| 1716 UseFixedDouble(instr->right(), d2) : | 1714 UseFixedDouble(instr->right(), d2) : |
| 1717 UseFixed(instr->right(), r2); | 1715 UseFixed(instr->right(), r2); |
| 1718 LPower* result = new(zone()) LPower(left, right); | 1716 LPower* result = new(zone()) LPower(left, right); |
| 1719 return MarkAsCall(DefineFixedDouble(result, d3), | 1717 return MarkAsCall(DefineFixedDouble(result, d3), |
| 1720 instr, | 1718 instr, |
| 1721 CAN_DEOPTIMIZE_EAGERLY); | 1719 CAN_DEOPTIMIZE_EAGERLY); |
| 1722 } | 1720 } |
| 1723 | 1721 |
| 1724 | 1722 |
| 1725 LInstruction* LChunkBuilder::DoRandom(HRandom* instr) { | |
| 1726 ASSERT(instr->representation().IsDouble()); | |
| 1727 ASSERT(instr->global_object()->representation().IsTagged()); | |
| 1728 LOperand* global_object = UseTempRegister(instr->global_object()); | |
| 1729 LOperand* scratch = TempRegister(); | |
| 1730 LOperand* scratch2 = TempRegister(); | |
| 1731 LOperand* scratch3 = TempRegister(); | |
| 1732 LRandom* result = new(zone()) LRandom( | |
| 1733 global_object, scratch, scratch2, scratch3); | |
| 1734 return DefineFixedDouble(result, d7); | |
| 1735 } | |
| 1736 | |
| 1737 | |
| 1738 LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) { | 1723 LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) { |
| 1739 ASSERT(instr->left()->representation().IsTagged()); | 1724 ASSERT(instr->left()->representation().IsTagged()); |
| 1740 ASSERT(instr->right()->representation().IsTagged()); | 1725 ASSERT(instr->right()->representation().IsTagged()); |
| 1741 LOperand* context = UseFixed(instr->context(), cp); | 1726 LOperand* context = UseFixed(instr->context(), cp); |
| 1742 LOperand* left = UseFixed(instr->left(), r1); | 1727 LOperand* left = UseFixed(instr->left(), r1); |
| 1743 LOperand* right = UseFixed(instr->right(), r0); | 1728 LOperand* right = UseFixed(instr->right(), r0); |
| 1744 LCmpT* result = new(zone()) LCmpT(context, left, right); | 1729 LCmpT* result = new(zone()) LCmpT(context, left, right); |
| 1745 return MarkAsCall(DefineFixed(result, r0), instr); | 1730 return MarkAsCall(DefineFixed(result, r0), instr); |
| 1746 } | 1731 } |
| 1747 | 1732 |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1897 | 1882 |
| 1898 | 1883 |
| 1899 LInstruction* LChunkBuilder::DoSeqStringGetChar(HSeqStringGetChar* instr) { | 1884 LInstruction* LChunkBuilder::DoSeqStringGetChar(HSeqStringGetChar* instr) { |
| 1900 LOperand* string = UseRegisterAtStart(instr->string()); | 1885 LOperand* string = UseRegisterAtStart(instr->string()); |
| 1901 LOperand* index = UseRegisterOrConstantAtStart(instr->index()); | 1886 LOperand* index = UseRegisterOrConstantAtStart(instr->index()); |
| 1902 return DefineAsRegister(new(zone()) LSeqStringGetChar(string, index)); | 1887 return DefineAsRegister(new(zone()) LSeqStringGetChar(string, index)); |
| 1903 } | 1888 } |
| 1904 | 1889 |
| 1905 | 1890 |
| 1906 LInstruction* LChunkBuilder::DoSeqStringSetChar(HSeqStringSetChar* instr) { | 1891 LInstruction* LChunkBuilder::DoSeqStringSetChar(HSeqStringSetChar* instr) { |
| 1907 LOperand* string = UseRegister(instr->string()); | 1892 LOperand* string = UseRegisterAtStart(instr->string()); |
| 1908 LOperand* index = UseRegisterOrConstant(instr->index()); | 1893 LOperand* index = FLAG_debug_code |
| 1909 LOperand* value = UseRegister(instr->value()); | 1894 ? UseRegisterAtStart(instr->index()) |
| 1910 return new(zone()) LSeqStringSetChar(string, index, value); | 1895 : UseRegisterOrConstantAtStart(instr->index()); |
| 1896 LOperand* value = UseRegisterAtStart(instr->value()); |
| 1897 LOperand* context = FLAG_debug_code ? UseFixed(instr->context(), cp) : NULL; |
| 1898 return new(zone()) LSeqStringSetChar(context, string, index, value); |
| 1911 } | 1899 } |
| 1912 | 1900 |
| 1913 | 1901 |
| 1914 LInstruction* LChunkBuilder::DoBoundsCheck(HBoundsCheck* instr) { | 1902 LInstruction* LChunkBuilder::DoBoundsCheck(HBoundsCheck* instr) { |
| 1915 LOperand* value = UseRegisterOrConstantAtStart(instr->index()); | 1903 LOperand* value = UseRegisterOrConstantAtStart(instr->index()); |
| 1916 LOperand* length = UseRegister(instr->length()); | 1904 LOperand* length = UseRegister(instr->length()); |
| 1917 return AssignEnvironment(new(zone()) LBoundsCheck(value, length)); | 1905 return AssignEnvironment(new(zone()) LBoundsCheck(value, length)); |
| 1918 } | 1906 } |
| 1919 | 1907 |
| 1920 | 1908 |
| (...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2542 instr->ReplayEnvironment(current_block_->last_environment()); | 2530 instr->ReplayEnvironment(current_block_->last_environment()); |
| 2543 | 2531 |
| 2544 // There are no real uses of a captured object. | 2532 // There are no real uses of a captured object. |
| 2545 return NULL; | 2533 return NULL; |
| 2546 } | 2534 } |
| 2547 | 2535 |
| 2548 | 2536 |
| 2549 LInstruction* LChunkBuilder::DoAccessArgumentsAt(HAccessArgumentsAt* instr) { | 2537 LInstruction* LChunkBuilder::DoAccessArgumentsAt(HAccessArgumentsAt* instr) { |
| 2550 info()->MarkAsRequiresFrame(); | 2538 info()->MarkAsRequiresFrame(); |
| 2551 LOperand* args = UseRegister(instr->arguments()); | 2539 LOperand* args = UseRegister(instr->arguments()); |
| 2552 LOperand* length; | 2540 LOperand* length = UseRegisterOrConstantAtStart(instr->length()); |
| 2553 LOperand* index; | 2541 LOperand* index = UseRegisterOrConstantAtStart(instr->index()); |
| 2554 if (instr->length()->IsConstant() && instr->index()->IsConstant()) { | |
| 2555 length = UseRegisterOrConstant(instr->length()); | |
| 2556 index = UseOrConstant(instr->index()); | |
| 2557 } else { | |
| 2558 length = UseTempRegister(instr->length()); | |
| 2559 index = UseRegisterAtStart(instr->index()); | |
| 2560 } | |
| 2561 return DefineAsRegister(new(zone()) LAccessArgumentsAt(args, length, index)); | 2542 return DefineAsRegister(new(zone()) LAccessArgumentsAt(args, length, index)); |
| 2562 } | 2543 } |
| 2563 | 2544 |
| 2564 | 2545 |
| 2565 LInstruction* LChunkBuilder::DoToFastProperties(HToFastProperties* instr) { | 2546 LInstruction* LChunkBuilder::DoToFastProperties(HToFastProperties* instr) { |
| 2566 LOperand* object = UseFixed(instr->value(), r0); | 2547 LOperand* object = UseFixed(instr->value(), r0); |
| 2567 LToFastProperties* result = new(zone()) LToFastProperties(object); | 2548 LToFastProperties* result = new(zone()) LToFastProperties(object); |
| 2568 return MarkAsCall(DefineFixed(result, r0), instr); | 2549 return MarkAsCall(DefineFixed(result, r0), instr); |
| 2569 } | 2550 } |
| 2570 | 2551 |
| 2571 | 2552 |
| 2572 LInstruction* LChunkBuilder::DoTypeof(HTypeof* instr) { | 2553 LInstruction* LChunkBuilder::DoTypeof(HTypeof* instr) { |
| 2573 LOperand* context = UseFixed(instr->context(), cp); | 2554 LOperand* context = UseFixed(instr->context(), cp); |
| 2574 LTypeof* result = new(zone()) LTypeof(context, UseFixed(instr->value(), r0)); | 2555 LTypeof* result = new(zone()) LTypeof(context, UseFixed(instr->value(), r0)); |
| 2575 return MarkAsCall(DefineFixed(result, r0), instr); | 2556 return MarkAsCall(DefineFixed(result, r0), instr); |
| 2576 } | 2557 } |
| 2577 | 2558 |
| 2578 | 2559 |
| 2579 LInstruction* LChunkBuilder::DoTypeofIsAndBranch(HTypeofIsAndBranch* instr) { | 2560 LInstruction* LChunkBuilder::DoTypeofIsAndBranch(HTypeofIsAndBranch* instr) { |
| 2561 LInstruction* goto_instr = CheckElideControlInstruction(instr); |
| 2562 if (goto_instr != NULL) return goto_instr; |
| 2563 |
| 2580 return new(zone()) LTypeofIsAndBranch(UseTempRegister(instr->value())); | 2564 return new(zone()) LTypeofIsAndBranch(UseTempRegister(instr->value())); |
| 2581 } | 2565 } |
| 2582 | 2566 |
| 2583 | 2567 |
| 2584 LInstruction* LChunkBuilder::DoIsConstructCallAndBranch( | 2568 LInstruction* LChunkBuilder::DoIsConstructCallAndBranch( |
| 2585 HIsConstructCallAndBranch* instr) { | 2569 HIsConstructCallAndBranch* instr) { |
| 2586 return new(zone()) LIsConstructCallAndBranch(TempRegister()); | 2570 return new(zone()) LIsConstructCallAndBranch(TempRegister()); |
| 2587 } | 2571 } |
| 2588 | 2572 |
| 2589 | 2573 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2682 | 2666 |
| 2683 | 2667 |
| 2684 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2668 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
| 2685 LOperand* object = UseRegister(instr->object()); | 2669 LOperand* object = UseRegister(instr->object()); |
| 2686 LOperand* index = UseRegister(instr->index()); | 2670 LOperand* index = UseRegister(instr->index()); |
| 2687 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); | 2671 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); |
| 2688 } | 2672 } |
| 2689 | 2673 |
| 2690 | 2674 |
| 2691 } } // namespace v8::internal | 2675 } } // namespace v8::internal |
| OLD | NEW |