| 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 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 658 if (needs_environment && !instr->HasEnvironment()) { | 658 if (needs_environment && !instr->HasEnvironment()) { |
| 659 instr = AssignEnvironment(instr); | 659 instr = AssignEnvironment(instr); |
| 660 } | 660 } |
| 661 | 661 |
| 662 return instr; | 662 return instr; |
| 663 } | 663 } |
| 664 | 664 |
| 665 | 665 |
| 666 LInstruction* LChunkBuilder::AssignPointerMap(LInstruction* instr) { | 666 LInstruction* LChunkBuilder::AssignPointerMap(LInstruction* instr) { |
| 667 ASSERT(!instr->HasPointerMap()); | 667 ASSERT(!instr->HasPointerMap()); |
| 668 instr->set_pointer_map(new(zone()) LPointerMap(position_, zone())); | 668 instr->set_pointer_map(new(zone()) LPointerMap(zone())); |
| 669 return instr; | 669 return instr; |
| 670 } | 670 } |
| 671 | 671 |
| 672 | 672 |
| 673 LUnallocated* LChunkBuilder::TempRegister() { | 673 LUnallocated* LChunkBuilder::TempRegister() { |
| 674 LUnallocated* operand = | 674 LUnallocated* operand = |
| 675 new(zone()) LUnallocated(LUnallocated::MUST_HAVE_REGISTER); | 675 new(zone()) LUnallocated(LUnallocated::MUST_HAVE_REGISTER); |
| 676 int vreg = allocator_->GetVirtualRegister(); | 676 int vreg = allocator_->GetVirtualRegister(); |
| 677 if (!allocator_->AllocationOk()) { | 677 if (!allocator_->AllocationOk()) { |
| 678 Abort(kOutOfVirtualRegistersWhileTryingToAllocateTempRegister); | 678 Abort(kOutOfVirtualRegistersWhileTryingToAllocateTempRegister); |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 852 } | 852 } |
| 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(); | |
| 863 | 862 |
| 864 LInstruction* instr = NULL; | 863 LInstruction* instr = NULL; |
| 865 if (current->CanReplaceWithDummyUses()) { | 864 if (current->CanReplaceWithDummyUses()) { |
| 866 HValue* first_operand = current->OperandCount() == 0 | 865 HValue* first_operand = current->OperandCount() == 0 |
| 867 ? graph()->GetConstant1() | 866 ? graph()->GetConstant1() |
| 868 : current->OperandAt(0); | 867 : current->OperandAt(0); |
| 869 instr = DefineAsRegister(new(zone()) LDummyUse(UseAny(first_operand))); | 868 instr = DefineAsRegister(new(zone()) LDummyUse(UseAny(first_operand))); |
| 870 for (int i = 1; i < current->OperandCount(); ++i) { | 869 for (int i = 1; i < current->OperandCount(); ++i) { |
| 871 LInstruction* dummy = | 870 LInstruction* dummy = |
| 872 new(zone()) LDummyUse(UseAny(current->OperandAt(i))); | 871 new(zone()) LDummyUse(UseAny(current->OperandAt(i))); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 907 if (LUnallocated::cast(instr->Output())->HasFixedPolicy()) ++fixed; | 906 if (LUnallocated::cast(instr->Output())->HasFixedPolicy()) ++fixed; |
| 908 } | 907 } |
| 909 for (TempIterator it(instr); !it.Done(); it.Advance()) { | 908 for (TempIterator it(instr); !it.Done(); it.Advance()) { |
| 910 LUnallocated* operand = LUnallocated::cast(it.Current()); | 909 LUnallocated* operand = LUnallocated::cast(it.Current()); |
| 911 if (operand->HasFixedPolicy()) ++fixed; | 910 if (operand->HasFixedPolicy()) ++fixed; |
| 912 } | 911 } |
| 913 ASSERT(fixed == 0 || used_at_start == 0); | 912 ASSERT(fixed == 0 || used_at_start == 0); |
| 914 } | 913 } |
| 915 #endif | 914 #endif |
| 916 | 915 |
| 917 instr->set_position(position_); | |
| 918 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { | 916 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { |
| 919 instr = AssignPointerMap(instr); | 917 instr = AssignPointerMap(instr); |
| 920 } | 918 } |
| 921 if (FLAG_stress_environments && !instr->HasEnvironment()) { | 919 if (FLAG_stress_environments && !instr->HasEnvironment()) { |
| 922 instr = AssignEnvironment(instr); | 920 instr = AssignEnvironment(instr); |
| 923 } | 921 } |
| 924 chunk_->AddInstruction(instr, current_block_); | 922 chunk_->AddInstruction(instr, current_block_); |
| 925 } | 923 } |
| 926 current_instruction_ = old_current; | 924 current_instruction_ = old_current; |
| 927 } | 925 } |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1209 | 1207 |
| 1210 | 1208 |
| 1211 LInstruction* LChunkBuilder::DoMathAbs(HUnaryMathOperation* instr) { | 1209 LInstruction* LChunkBuilder::DoMathAbs(HUnaryMathOperation* instr) { |
| 1212 LOperand* input = UseRegisterAtStart(instr->value()); | 1210 LOperand* input = UseRegisterAtStart(instr->value()); |
| 1213 LMathAbs* result = new(zone()) LMathAbs(input); | 1211 LMathAbs* result = new(zone()) LMathAbs(input); |
| 1214 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); | 1212 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); |
| 1215 } | 1213 } |
| 1216 | 1214 |
| 1217 | 1215 |
| 1218 LInstruction* LChunkBuilder::DoMathLog(HUnaryMathOperation* instr) { | 1216 LInstruction* LChunkBuilder::DoMathLog(HUnaryMathOperation* instr) { |
| 1219 LOperand* input = UseFixedDouble(instr->value(), xmm1); | 1217 ASSERT(instr->representation().IsDouble()); |
| 1218 ASSERT(instr->value()->representation().IsDouble()); |
| 1219 LOperand* input = UseRegisterAtStart(instr->value()); |
| 1220 LMathLog* result = new(zone()) LMathLog(input); | 1220 LMathLog* result = new(zone()) LMathLog(input); |
| 1221 return MarkAsCall(DefineFixedDouble(result, xmm1), instr); | 1221 return DefineSameAsFirst(result); |
| 1222 } | 1222 } |
| 1223 | 1223 |
| 1224 | 1224 |
| 1225 LInstruction* LChunkBuilder::DoMathSin(HUnaryMathOperation* instr) { | 1225 LInstruction* LChunkBuilder::DoMathSin(HUnaryMathOperation* instr) { |
| 1226 LOperand* input = UseFixedDouble(instr->value(), xmm1); | 1226 LOperand* input = UseFixedDouble(instr->value(), xmm1); |
| 1227 LMathSin* result = new(zone()) LMathSin(input); | 1227 LMathSin* result = new(zone()) LMathSin(input); |
| 1228 return MarkAsCall(DefineFixedDouble(result, xmm1), instr); | 1228 return MarkAsCall(DefineFixedDouble(result, xmm1), instr); |
| 1229 } | 1229 } |
| 1230 | 1230 |
| 1231 | 1231 |
| (...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1815 LOperand* value = UseRegister(instr->value()); | 1815 LOperand* value = UseRegister(instr->value()); |
| 1816 return DefineSameAsFirst(new(zone()) LDummyUse(value)); | 1816 return DefineSameAsFirst(new(zone()) LDummyUse(value)); |
| 1817 } | 1817 } |
| 1818 from = Representation::Tagged(); | 1818 from = Representation::Tagged(); |
| 1819 } | 1819 } |
| 1820 // Only mark conversions that might need to allocate as calling rather than | 1820 // Only mark conversions that might need to allocate as calling rather than |
| 1821 // all changes. This makes simple, non-allocating conversion not have to force | 1821 // all changes. This makes simple, non-allocating conversion not have to force |
| 1822 // building a stack frame. | 1822 // building a stack frame. |
| 1823 if (from.IsTagged()) { | 1823 if (from.IsTagged()) { |
| 1824 if (to.IsDouble()) { | 1824 if (to.IsDouble()) { |
| 1825 info()->MarkAsDeferredCalling(); | |
| 1826 LOperand* value = UseRegister(instr->value()); | 1825 LOperand* value = UseRegister(instr->value()); |
| 1827 LNumberUntagD* res = new(zone()) LNumberUntagD(value); | 1826 LNumberUntagD* res = new(zone()) LNumberUntagD(value); |
| 1828 return AssignEnvironment(DefineAsRegister(res)); | 1827 return AssignEnvironment(DefineAsRegister(res)); |
| 1829 } else if (to.IsSmi()) { | 1828 } else if (to.IsSmi()) { |
| 1830 HValue* val = instr->value(); | 1829 HValue* val = instr->value(); |
| 1831 LOperand* value = UseRegister(val); | 1830 LOperand* value = UseRegister(val); |
| 1832 if (val->type().IsSmi()) { | 1831 if (val->type().IsSmi()) { |
| 1833 return DefineSameAsFirst(new(zone()) LDummyUse(value)); | 1832 return DefineSameAsFirst(new(zone()) LDummyUse(value)); |
| 1834 } | 1833 } |
| 1835 return AssignEnvironment(DefineSameAsFirst(new(zone()) LCheckSmi(value))); | 1834 return AssignEnvironment(DefineSameAsFirst(new(zone()) LCheckSmi(value))); |
| (...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2538 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2537 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
| 2539 LOperand* object = UseRegister(instr->object()); | 2538 LOperand* object = UseRegister(instr->object()); |
| 2540 LOperand* index = UseTempRegister(instr->index()); | 2539 LOperand* index = UseTempRegister(instr->index()); |
| 2541 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); | 2540 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); |
| 2542 } | 2541 } |
| 2543 | 2542 |
| 2544 | 2543 |
| 2545 } } // namespace v8::internal | 2544 } } // namespace v8::internal |
| 2546 | 2545 |
| 2547 #endif // V8_TARGET_ARCH_X64 | 2546 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |