Chromium Code Reviews| 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 842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 853 block->set_argument_count(argument_count_); | 853 block->set_argument_count(argument_count_); |
| 854 next_block_ = NULL; | 854 next_block_ = NULL; |
| 855 current_block_ = NULL; | 855 current_block_ = NULL; |
| 856 } | 856 } |
| 857 | 857 |
| 858 | 858 |
| 859 void LChunkBuilder::VisitInstruction(HInstruction* current) { | 859 void LChunkBuilder::VisitInstruction(HInstruction* current) { |
| 860 HInstruction* old_current = current_instruction_; | 860 HInstruction* old_current = current_instruction_; |
| 861 current_instruction_ = current; | 861 current_instruction_ = current; |
| 862 if (current->has_position()) position_ = current->position(); | 862 if (current->has_position()) position_ = current->position(); |
| 863 LInstruction* instr = current->CompileToLithium(this); | 863 |
| 864 LInstruction* instr = NULL; | |
| 865 if (current->CanReplaceWithDummyUses()) { | |
| 866 HValue* first_operand = current->OperandCount() == 0 | |
| 867 ? graph()->GetConstant1() : | |
| 868 current->OperandAt(0); | |
| 869 instr = DefineAsRegister(new(zone()) LDummyUse(UseAny(first_operand))); | |
| 870 for (int i = 1; i < current->OperandCount(); ++i) { | |
| 871 LInstruction* dummy = | |
| 872 new(zone()) LDummyUse(UseAny(current->OperandAt(1))); | |
|
Jakob Kummerow
2013/10/01 11:59:20
OperandAt(i)!
danno
2013/10/23 11:46:51
Done.
| |
| 873 dummy->set_hydrogen_value(current); | |
| 874 chunk_->AddInstruction(dummy, current_block_); | |
| 875 } | |
| 876 } else { | |
| 877 instr = current->CompileToLithium(this); | |
| 878 } | |
| 864 | 879 |
| 865 if (instr != NULL) { | 880 if (instr != NULL) { |
| 866 #if DEBUG | 881 #if DEBUG |
| 867 // Make sure that the lithium instruction has either no fixed register | 882 // Make sure that the lithium instruction has either no fixed register |
| 868 // constraints in temps or the result OR no uses that are only used at | 883 // constraints in temps or the result OR no uses that are only used at |
| 869 // start. If this invariant doesn't hold, the register allocator can decide | 884 // start. If this invariant doesn't hold, the register allocator can decide |
| 870 // to insert a split of a range immediately before the instruction due to an | 885 // to insert a split of a range immediately before the instruction due to an |
| 871 // already allocated register needing to be used for the instruction's fixed | 886 // already allocated register needing to be used for the instruction's fixed |
| 872 // register constraint. In this case, The register allocator won't see an | 887 // register constraint. In this case, The register allocator won't see an |
| 873 // interference between the split child and the use-at-start (it would if | 888 // interference between the split child and the use-at-start (it would if |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 984 | 999 |
| 985 if (hydrogen_env->frame_type() == JS_FUNCTION) { | 1000 if (hydrogen_env->frame_type() == JS_FUNCTION) { |
| 986 *argument_index_accumulator = argument_index; | 1001 *argument_index_accumulator = argument_index; |
| 987 } | 1002 } |
| 988 | 1003 |
| 989 return result; | 1004 return result; |
| 990 } | 1005 } |
| 991 | 1006 |
| 992 | 1007 |
| 993 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) { | 1008 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) { |
| 994 return new(zone()) LGoto(instr->FirstSuccessor()->block_id()); | 1009 return new(zone()) LGoto(instr->FirstSuccessor()); |
| 995 } | 1010 } |
| 996 | 1011 |
| 997 | 1012 |
| 998 LInstruction* LChunkBuilder::DoDebugBreak(HDebugBreak* instr) { | 1013 LInstruction* LChunkBuilder::DoDebugBreak(HDebugBreak* instr) { |
| 999 return new(zone()) LDebugBreak(); | 1014 return new(zone()) LDebugBreak(); |
| 1000 } | 1015 } |
| 1001 | 1016 |
| 1002 | 1017 |
| 1003 LInstruction* LChunkBuilder::DoBranch(HBranch* instr) { | 1018 LInstruction* LChunkBuilder::DoBranch(HBranch* instr) { |
| 1019 LInstruction* goto_instr = CheckElideControlInstruction(instr); | |
| 1020 if (goto_instr != NULL) return goto_instr; | |
| 1021 | |
| 1004 HValue* value = instr->value(); | 1022 HValue* value = instr->value(); |
| 1005 if (value->EmitAtUses()) { | |
| 1006 ASSERT(value->IsConstant()); | |
| 1007 ASSERT(!value->representation().IsDouble()); | |
| 1008 HBasicBlock* successor = HConstant::cast(value)->BooleanValue() | |
| 1009 ? instr->FirstSuccessor() | |
| 1010 : instr->SecondSuccessor(); | |
| 1011 return new(zone()) LGoto(successor->block_id()); | |
| 1012 } | |
| 1013 | |
| 1014 LBranch* result = new(zone()) LBranch(UseRegister(value)); | 1023 LBranch* result = new(zone()) LBranch(UseRegister(value)); |
| 1015 // Tagged values that are not known smis or booleans require a | 1024 // Tagged values that are not known smis or booleans require a |
| 1016 // deoptimization environment. If the instruction is generic no | 1025 // deoptimization environment. If the instruction is generic no |
| 1017 // environment is needed since all cases are handled. | 1026 // environment is needed since all cases are handled. |
| 1018 ToBooleanStub::Types expected = instr->expected_input_types(); | 1027 ToBooleanStub::Types expected = instr->expected_input_types(); |
| 1019 Representation rep = value->representation(); | 1028 Representation rep = value->representation(); |
| 1020 HType type = value->type(); | 1029 HType type = value->type(); |
| 1021 if (rep.IsTagged() && !type.IsSmi() && !type.IsBoolean() && | 1030 if (rep.IsTagged() && !type.IsSmi() && !type.IsBoolean() && |
| 1022 !expected.IsGeneric()) { | 1031 !expected.IsGeneric()) { |
| 1023 return AssignEnvironment(result); | 1032 return AssignEnvironment(result); |
| (...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1633 left = UseRegisterAtStart(instr->left()); | 1642 left = UseRegisterAtStart(instr->left()); |
| 1634 right = UseRegisterAtStart(instr->right()); | 1643 right = UseRegisterAtStart(instr->right()); |
| 1635 } | 1644 } |
| 1636 return new(zone()) LCompareNumericAndBranch(left, right); | 1645 return new(zone()) LCompareNumericAndBranch(left, right); |
| 1637 } | 1646 } |
| 1638 } | 1647 } |
| 1639 | 1648 |
| 1640 | 1649 |
| 1641 LInstruction* LChunkBuilder::DoCompareObjectEqAndBranch( | 1650 LInstruction* LChunkBuilder::DoCompareObjectEqAndBranch( |
| 1642 HCompareObjectEqAndBranch* instr) { | 1651 HCompareObjectEqAndBranch* instr) { |
| 1652 LInstruction* goto_instr = CheckElideControlInstruction(instr); | |
| 1653 if (goto_instr != NULL) return goto_instr; | |
| 1643 LOperand* left = UseRegisterAtStart(instr->left()); | 1654 LOperand* left = UseRegisterAtStart(instr->left()); |
| 1644 LOperand* right = UseRegisterOrConstantAtStart(instr->right()); | 1655 LOperand* right = UseRegisterOrConstantAtStart(instr->right()); |
| 1645 return new(zone()) LCmpObjectEqAndBranch(left, right); | 1656 return new(zone()) LCmpObjectEqAndBranch(left, right); |
| 1646 } | 1657 } |
| 1647 | 1658 |
| 1648 | 1659 |
| 1649 LInstruction* LChunkBuilder::DoCompareHoleAndBranch( | 1660 LInstruction* LChunkBuilder::DoCompareHoleAndBranch( |
| 1650 HCompareHoleAndBranch* instr) { | 1661 HCompareHoleAndBranch* instr) { |
| 1651 LOperand* value = UseRegisterAtStart(instr->value()); | 1662 LOperand* value = UseRegisterAtStart(instr->value()); |
| 1652 return new(zone()) LCmpHoleAndBranch(value); | 1663 return new(zone()) LCmpHoleAndBranch(value); |
| (...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2532 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2543 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
| 2533 LOperand* object = UseRegister(instr->object()); | 2544 LOperand* object = UseRegister(instr->object()); |
| 2534 LOperand* index = UseTempRegister(instr->index()); | 2545 LOperand* index = UseTempRegister(instr->index()); |
| 2535 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); | 2546 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); |
| 2536 } | 2547 } |
| 2537 | 2548 |
| 2538 | 2549 |
| 2539 } } // namespace v8::internal | 2550 } } // namespace v8::internal |
| 2540 | 2551 |
| 2541 #endif // V8_TARGET_ARCH_X64 | 2552 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |