| 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 1312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1323 LOperand* context = UseFixed(instr->context(), cp); | 1323 LOperand* context = UseFixed(instr->context(), cp); |
| 1324 LOperand* constructor = UseFixed(instr->constructor(), a1); | 1324 LOperand* constructor = UseFixed(instr->constructor(), a1); |
| 1325 LCallNewArray* result = new(zone()) LCallNewArray(context, constructor); | 1325 LCallNewArray* result = new(zone()) LCallNewArray(context, constructor); |
| 1326 return MarkAsCall(DefineFixed(result, v0), instr); | 1326 return MarkAsCall(DefineFixed(result, v0), instr); |
| 1327 } | 1327 } |
| 1328 | 1328 |
| 1329 | 1329 |
| 1330 LInstruction* LChunkBuilder::DoCallFunction(HCallFunction* instr) { | 1330 LInstruction* LChunkBuilder::DoCallFunction(HCallFunction* instr) { |
| 1331 LOperand* context = UseFixed(instr->context(), cp); | 1331 LOperand* context = UseFixed(instr->context(), cp); |
| 1332 LOperand* function = UseFixed(instr->function(), a1); | 1332 LOperand* function = UseFixed(instr->function(), a1); |
| 1333 return MarkAsCall( | 1333 LCallFunction* call = new(zone()) LCallFunction(context, function); |
| 1334 DefineFixed(new(zone()) LCallFunction(context, function), v0), instr); | 1334 LInstruction* result = DefineFixed(call, v0); |
| 1335 if (instr->IsTailCall()) return result; |
| 1336 return MarkAsCall(result, instr); |
| 1335 } | 1337 } |
| 1336 | 1338 |
| 1337 | 1339 |
| 1338 LInstruction* LChunkBuilder::DoCallRuntime(HCallRuntime* instr) { | 1340 LInstruction* LChunkBuilder::DoCallRuntime(HCallRuntime* instr) { |
| 1339 LOperand* context = UseFixed(instr->context(), cp); | 1341 LOperand* context = UseFixed(instr->context(), cp); |
| 1340 return MarkAsCall(DefineFixed(new(zone()) LCallRuntime(context), v0), instr); | 1342 return MarkAsCall(DefineFixed(new(zone()) LCallRuntime(context), v0), instr); |
| 1341 } | 1343 } |
| 1342 | 1344 |
| 1343 | 1345 |
| 1344 LInstruction* LChunkBuilder::DoRor(HRor* instr) { | 1346 LInstruction* LChunkBuilder::DoRor(HRor* instr) { |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1451 ASSERT(instr->right()->representation().Equals(instr->representation())); | 1453 ASSERT(instr->right()->representation().Equals(instr->representation())); |
| 1452 if (instr->HasPowerOf2Divisor()) { | 1454 if (instr->HasPowerOf2Divisor()) { |
| 1453 ASSERT(!right->CanBeZero()); | 1455 ASSERT(!right->CanBeZero()); |
| 1454 LModI* mod = new(zone()) LModI(UseRegisterAtStart(left), | 1456 LModI* mod = new(zone()) LModI(UseRegisterAtStart(left), |
| 1455 UseOrConstant(right)); | 1457 UseOrConstant(right)); |
| 1456 LInstruction* result = DefineAsRegister(mod); | 1458 LInstruction* result = DefineAsRegister(mod); |
| 1457 return (left->CanBeNegative() && | 1459 return (left->CanBeNegative() && |
| 1458 instr->CheckFlag(HValue::kBailoutOnMinusZero)) | 1460 instr->CheckFlag(HValue::kBailoutOnMinusZero)) |
| 1459 ? AssignEnvironment(result) | 1461 ? AssignEnvironment(result) |
| 1460 : result; | 1462 : result; |
| 1461 } else if (instr->fixed_right_arg().has_value) { | |
| 1462 LModI* mod = new(zone()) LModI(UseRegisterAtStart(left), | |
| 1463 UseRegisterAtStart(right)); | |
| 1464 return AssignEnvironment(DefineAsRegister(mod)); | |
| 1465 } else { | 1463 } else { |
| 1466 LModI* mod = new(zone()) LModI(UseRegister(left), | 1464 LModI* mod = new(zone()) LModI(UseRegister(left), |
| 1467 UseRegister(right), | 1465 UseRegister(right), |
| 1468 TempRegister(), | 1466 TempRegister(), |
| 1469 FixedTemp(f20), | 1467 FixedTemp(f20), |
| 1470 FixedTemp(f22)); | 1468 FixedTemp(f22)); |
| 1471 LInstruction* result = DefineAsRegister(mod); | 1469 LInstruction* result = DefineAsRegister(mod); |
| 1472 return (right->CanBeZero() || | 1470 return (right->CanBeZero() || |
| 1473 (left->RangeCanInclude(kMinInt) && | 1471 (left->RangeCanInclude(kMinInt) && |
| 1474 right->RangeCanInclude(-1)) || | 1472 right->RangeCanInclude(-1)) || |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1635 LOperand* right = exponent_type.IsDouble() ? | 1633 LOperand* right = exponent_type.IsDouble() ? |
| 1636 UseFixedDouble(instr->right(), f4) : | 1634 UseFixedDouble(instr->right(), f4) : |
| 1637 UseFixed(instr->right(), a2); | 1635 UseFixed(instr->right(), a2); |
| 1638 LPower* result = new(zone()) LPower(left, right); | 1636 LPower* result = new(zone()) LPower(left, right); |
| 1639 return MarkAsCall(DefineFixedDouble(result, f0), | 1637 return MarkAsCall(DefineFixedDouble(result, f0), |
| 1640 instr, | 1638 instr, |
| 1641 CAN_DEOPTIMIZE_EAGERLY); | 1639 CAN_DEOPTIMIZE_EAGERLY); |
| 1642 } | 1640 } |
| 1643 | 1641 |
| 1644 | 1642 |
| 1645 LInstruction* LChunkBuilder::DoRandom(HRandom* instr) { | |
| 1646 ASSERT(instr->representation().IsDouble()); | |
| 1647 ASSERT(instr->global_object()->representation().IsTagged()); | |
| 1648 LOperand* global_object = UseTempRegister(instr->global_object()); | |
| 1649 LOperand* scratch = TempRegister(); | |
| 1650 LOperand* scratch2 = TempRegister(); | |
| 1651 LOperand* scratch3 = TempRegister(); | |
| 1652 LRandom* result = new(zone()) LRandom( | |
| 1653 global_object, scratch, scratch2, scratch3); | |
| 1654 return DefineFixedDouble(result, f0); | |
| 1655 } | |
| 1656 | |
| 1657 | |
| 1658 LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) { | 1643 LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) { |
| 1659 ASSERT(instr->left()->representation().IsTagged()); | 1644 ASSERT(instr->left()->representation().IsTagged()); |
| 1660 ASSERT(instr->right()->representation().IsTagged()); | 1645 ASSERT(instr->right()->representation().IsTagged()); |
| 1661 LOperand* context = UseFixed(instr->context(), cp); | 1646 LOperand* context = UseFixed(instr->context(), cp); |
| 1662 LOperand* left = UseFixed(instr->left(), a1); | 1647 LOperand* left = UseFixed(instr->left(), a1); |
| 1663 LOperand* right = UseFixed(instr->right(), a0); | 1648 LOperand* right = UseFixed(instr->right(), a0); |
| 1664 LCmpT* result = new(zone()) LCmpT(context, left, right); | 1649 LCmpT* result = new(zone()) LCmpT(context, left, right); |
| 1665 return MarkAsCall(DefineFixed(result, v0), instr); | 1650 return MarkAsCall(DefineFixed(result, v0), instr); |
| 1666 } | 1651 } |
| 1667 | 1652 |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1817 | 1802 |
| 1818 | 1803 |
| 1819 LInstruction* LChunkBuilder::DoSeqStringGetChar(HSeqStringGetChar* instr) { | 1804 LInstruction* LChunkBuilder::DoSeqStringGetChar(HSeqStringGetChar* instr) { |
| 1820 LOperand* string = UseRegisterAtStart(instr->string()); | 1805 LOperand* string = UseRegisterAtStart(instr->string()); |
| 1821 LOperand* index = UseRegisterOrConstantAtStart(instr->index()); | 1806 LOperand* index = UseRegisterOrConstantAtStart(instr->index()); |
| 1822 return DefineAsRegister(new(zone()) LSeqStringGetChar(string, index)); | 1807 return DefineAsRegister(new(zone()) LSeqStringGetChar(string, index)); |
| 1823 } | 1808 } |
| 1824 | 1809 |
| 1825 | 1810 |
| 1826 LInstruction* LChunkBuilder::DoSeqStringSetChar(HSeqStringSetChar* instr) { | 1811 LInstruction* LChunkBuilder::DoSeqStringSetChar(HSeqStringSetChar* instr) { |
| 1827 LOperand* string = UseRegister(instr->string()); | 1812 LOperand* string = UseRegisterAtStart(instr->string()); |
| 1828 LOperand* index = UseRegisterOrConstant(instr->index()); | 1813 LOperand* index = FLAG_debug_code |
| 1829 LOperand* value = UseRegister(instr->value()); | 1814 ? UseRegisterAtStart(instr->index()) |
| 1830 return new(zone()) LSeqStringSetChar(string, index, value); | 1815 : UseRegisterOrConstantAtStart(instr->index()); |
| 1816 LOperand* value = UseRegisterAtStart(instr->value()); |
| 1817 LOperand* context = FLAG_debug_code ? UseFixed(instr->context(), cp) : NULL; |
| 1818 return new(zone()) LSeqStringSetChar(context, string, index, value); |
| 1831 } | 1819 } |
| 1832 | 1820 |
| 1833 | 1821 |
| 1834 LInstruction* LChunkBuilder::DoBoundsCheck(HBoundsCheck* instr) { | 1822 LInstruction* LChunkBuilder::DoBoundsCheck(HBoundsCheck* instr) { |
| 1835 LOperand* value = UseRegisterOrConstantAtStart(instr->index()); | 1823 LOperand* value = UseRegisterOrConstantAtStart(instr->index()); |
| 1836 LOperand* length = UseRegister(instr->length()); | 1824 LOperand* length = UseRegister(instr->length()); |
| 1837 return AssignEnvironment(new(zone()) LBoundsCheck(value, length)); | 1825 return AssignEnvironment(new(zone()) LBoundsCheck(value, length)); |
| 1838 } | 1826 } |
| 1839 | 1827 |
| 1840 | 1828 |
| (...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2414 LInstruction* LChunkBuilder::DoParameter(HParameter* instr) { | 2402 LInstruction* LChunkBuilder::DoParameter(HParameter* instr) { |
| 2415 LParameter* result = new(zone()) LParameter; | 2403 LParameter* result = new(zone()) LParameter; |
| 2416 if (instr->kind() == HParameter::STACK_PARAMETER) { | 2404 if (instr->kind() == HParameter::STACK_PARAMETER) { |
| 2417 int spill_index = chunk()->GetParameterStackSlot(instr->index()); | 2405 int spill_index = chunk()->GetParameterStackSlot(instr->index()); |
| 2418 return DefineAsSpilled(result, spill_index); | 2406 return DefineAsSpilled(result, spill_index); |
| 2419 } else { | 2407 } else { |
| 2420 ASSERT(info()->IsStub()); | 2408 ASSERT(info()->IsStub()); |
| 2421 CodeStubInterfaceDescriptor* descriptor = | 2409 CodeStubInterfaceDescriptor* descriptor = |
| 2422 info()->code_stub()->GetInterfaceDescriptor(info()->isolate()); | 2410 info()->code_stub()->GetInterfaceDescriptor(info()->isolate()); |
| 2423 int index = static_cast<int>(instr->index()); | 2411 int index = static_cast<int>(instr->index()); |
| 2424 Register reg = DESCRIPTOR_GET_PARAMETER_REGISTER(descriptor, index); | 2412 Register reg = descriptor->GetParameterRegister(index); |
| 2425 return DefineFixed(result, reg); | 2413 return DefineFixed(result, reg); |
| 2426 } | 2414 } |
| 2427 } | 2415 } |
| 2428 | 2416 |
| 2429 | 2417 |
| 2430 LInstruction* LChunkBuilder::DoUnknownOSRValue(HUnknownOSRValue* instr) { | 2418 LInstruction* LChunkBuilder::DoUnknownOSRValue(HUnknownOSRValue* instr) { |
| 2431 // Use an index that corresponds to the location in the unoptimized frame, | 2419 // Use an index that corresponds to the location in the unoptimized frame, |
| 2432 // which the optimized frame will subsume. | 2420 // which the optimized frame will subsume. |
| 2433 int env_index = instr->index(); | 2421 int env_index = instr->index(); |
| 2434 int spill_index = 0; | 2422 int spill_index = 0; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 2464 instr->ReplayEnvironment(current_block_->last_environment()); | 2452 instr->ReplayEnvironment(current_block_->last_environment()); |
| 2465 | 2453 |
| 2466 // There are no real uses of a captured object. | 2454 // There are no real uses of a captured object. |
| 2467 return NULL; | 2455 return NULL; |
| 2468 } | 2456 } |
| 2469 | 2457 |
| 2470 | 2458 |
| 2471 LInstruction* LChunkBuilder::DoAccessArgumentsAt(HAccessArgumentsAt* instr) { | 2459 LInstruction* LChunkBuilder::DoAccessArgumentsAt(HAccessArgumentsAt* instr) { |
| 2472 info()->MarkAsRequiresFrame(); | 2460 info()->MarkAsRequiresFrame(); |
| 2473 LOperand* args = UseRegister(instr->arguments()); | 2461 LOperand* args = UseRegister(instr->arguments()); |
| 2474 LOperand* length; | 2462 LOperand* length = UseRegisterOrConstantAtStart(instr->length()); |
| 2475 LOperand* index; | 2463 LOperand* index = UseRegisterOrConstantAtStart(instr->index()); |
| 2476 if (instr->length()->IsConstant() && instr->index()->IsConstant()) { | |
| 2477 length = UseRegisterOrConstant(instr->length()); | |
| 2478 index = UseOrConstant(instr->index()); | |
| 2479 } else { | |
| 2480 length = UseTempRegister(instr->length()); | |
| 2481 index = UseRegisterAtStart(instr->index()); | |
| 2482 } | |
| 2483 return DefineAsRegister(new(zone()) LAccessArgumentsAt(args, length, index)); | 2464 return DefineAsRegister(new(zone()) LAccessArgumentsAt(args, length, index)); |
| 2484 } | 2465 } |
| 2485 | 2466 |
| 2486 | 2467 |
| 2487 LInstruction* LChunkBuilder::DoToFastProperties(HToFastProperties* instr) { | 2468 LInstruction* LChunkBuilder::DoToFastProperties(HToFastProperties* instr) { |
| 2488 LOperand* object = UseFixed(instr->value(), a0); | 2469 LOperand* object = UseFixed(instr->value(), a0); |
| 2489 LToFastProperties* result = new(zone()) LToFastProperties(object); | 2470 LToFastProperties* result = new(zone()) LToFastProperties(object); |
| 2490 return MarkAsCall(DefineFixed(result, v0), instr); | 2471 return MarkAsCall(DefineFixed(result, v0), instr); |
| 2491 } | 2472 } |
| 2492 | 2473 |
| 2493 | 2474 |
| 2494 LInstruction* LChunkBuilder::DoTypeof(HTypeof* instr) { | 2475 LInstruction* LChunkBuilder::DoTypeof(HTypeof* instr) { |
| 2495 LOperand* context = UseFixed(instr->context(), cp); | 2476 LOperand* context = UseFixed(instr->context(), cp); |
| 2496 LTypeof* result = new(zone()) LTypeof(context, UseFixed(instr->value(), a0)); | 2477 LTypeof* result = new(zone()) LTypeof(context, UseFixed(instr->value(), a0)); |
| 2497 return MarkAsCall(DefineFixed(result, v0), instr); | 2478 return MarkAsCall(DefineFixed(result, v0), instr); |
| 2498 } | 2479 } |
| 2499 | 2480 |
| 2500 | 2481 |
| 2501 LInstruction* LChunkBuilder::DoTypeofIsAndBranch(HTypeofIsAndBranch* instr) { | 2482 LInstruction* LChunkBuilder::DoTypeofIsAndBranch(HTypeofIsAndBranch* instr) { |
| 2483 LInstruction* goto_instr = CheckElideControlInstruction(instr); |
| 2484 if (goto_instr != NULL) return goto_instr; |
| 2485 |
| 2502 return new(zone()) LTypeofIsAndBranch(UseTempRegister(instr->value())); | 2486 return new(zone()) LTypeofIsAndBranch(UseTempRegister(instr->value())); |
| 2503 } | 2487 } |
| 2504 | 2488 |
| 2505 | 2489 |
| 2506 LInstruction* LChunkBuilder::DoIsConstructCallAndBranch( | 2490 LInstruction* LChunkBuilder::DoIsConstructCallAndBranch( |
| 2507 HIsConstructCallAndBranch* instr) { | 2491 HIsConstructCallAndBranch* instr) { |
| 2508 return new(zone()) LIsConstructCallAndBranch(TempRegister()); | 2492 return new(zone()) LIsConstructCallAndBranch(TempRegister()); |
| 2509 } | 2493 } |
| 2510 | 2494 |
| 2511 | 2495 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2604 | 2588 |
| 2605 | 2589 |
| 2606 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2590 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
| 2607 LOperand* object = UseRegister(instr->object()); | 2591 LOperand* object = UseRegister(instr->object()); |
| 2608 LOperand* index = UseRegister(instr->index()); | 2592 LOperand* index = UseRegister(instr->index()); |
| 2609 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); | 2593 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); |
| 2610 } | 2594 } |
| 2611 | 2595 |
| 2612 | 2596 |
| 2613 } } // namespace v8::internal | 2597 } } // namespace v8::internal |
| OLD | NEW |