| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 if (needs_environment && !instr->HasEnvironment()) { | 541 if (needs_environment && !instr->HasEnvironment()) { |
| 542 instr = AssignEnvironment(instr); | 542 instr = AssignEnvironment(instr); |
| 543 } | 543 } |
| 544 | 544 |
| 545 return instr; | 545 return instr; |
| 546 } | 546 } |
| 547 | 547 |
| 548 | 548 |
| 549 LInstruction* LChunkBuilder::AssignPointerMap(LInstruction* instr) { | 549 LInstruction* LChunkBuilder::AssignPointerMap(LInstruction* instr) { |
| 550 ASSERT(!instr->HasPointerMap()); | 550 ASSERT(!instr->HasPointerMap()); |
| 551 instr->set_pointer_map(new(zone()) LPointerMap(position_, zone())); | 551 instr->set_pointer_map(new(zone()) LPointerMap(zone())); |
| 552 return instr; | 552 return instr; |
| 553 } | 553 } |
| 554 | 554 |
| 555 | 555 |
| 556 LUnallocated* LChunkBuilder::TempRegister() { | 556 LUnallocated* LChunkBuilder::TempRegister() { |
| 557 LUnallocated* operand = | 557 LUnallocated* operand = |
| 558 new(zone()) LUnallocated(LUnallocated::MUST_HAVE_REGISTER); | 558 new(zone()) LUnallocated(LUnallocated::MUST_HAVE_REGISTER); |
| 559 int vreg = allocator_->GetVirtualRegister(); | 559 int vreg = allocator_->GetVirtualRegister(); |
| 560 if (!allocator_->AllocationOk()) { | 560 if (!allocator_->AllocationOk()) { |
| 561 Abort(kOutOfVirtualRegistersWhileTryingToAllocateTempRegister); | 561 Abort(kOutOfVirtualRegistersWhileTryingToAllocateTempRegister); |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 735 if (LUnallocated::cast(instr->Output())->HasFixedPolicy()) ++fixed; | 735 if (LUnallocated::cast(instr->Output())->HasFixedPolicy()) ++fixed; |
| 736 } | 736 } |
| 737 for (TempIterator it(instr); !it.Done(); it.Advance()) { | 737 for (TempIterator it(instr); !it.Done(); it.Advance()) { |
| 738 LUnallocated* operand = LUnallocated::cast(it.Current()); | 738 LUnallocated* operand = LUnallocated::cast(it.Current()); |
| 739 if (operand->HasFixedPolicy()) ++fixed; | 739 if (operand->HasFixedPolicy()) ++fixed; |
| 740 } | 740 } |
| 741 ASSERT(fixed == 0 || used_at_start == 0); | 741 ASSERT(fixed == 0 || used_at_start == 0); |
| 742 } | 742 } |
| 743 #endif | 743 #endif |
| 744 | 744 |
| 745 instr->set_position(position_); | |
| 746 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { | 745 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { |
| 747 instr = AssignPointerMap(instr); | 746 instr = AssignPointerMap(instr); |
| 748 } | 747 } |
| 749 if (FLAG_stress_environments && !instr->HasEnvironment()) { | 748 if (FLAG_stress_environments && !instr->HasEnvironment()) { |
| 750 instr = AssignEnvironment(instr); | 749 instr = AssignEnvironment(instr); |
| 751 } | 750 } |
| 752 chunk_->AddInstruction(instr, current_block_); | 751 chunk_->AddInstruction(instr, current_block_); |
| 753 } | 752 } |
| 754 current_instruction_ = old_current; | 753 current_instruction_ = old_current; |
| 755 } | 754 } |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1154 if (from.IsSmi()) { | 1153 if (from.IsSmi()) { |
| 1155 if (to.IsTagged()) { | 1154 if (to.IsTagged()) { |
| 1156 LOperand* value = UseRegister(instr->value()); | 1155 LOperand* value = UseRegister(instr->value()); |
| 1157 return DefineSameAsFirst(new(zone()) LDummyUse(value)); | 1156 return DefineSameAsFirst(new(zone()) LDummyUse(value)); |
| 1158 } | 1157 } |
| 1159 from = Representation::Tagged(); | 1158 from = Representation::Tagged(); |
| 1160 } | 1159 } |
| 1161 | 1160 |
| 1162 if (from.IsTagged()) { | 1161 if (from.IsTagged()) { |
| 1163 if (to.IsDouble()) { | 1162 if (to.IsDouble()) { |
| 1164 info()->MarkAsDeferredCalling(); | |
| 1165 LOperand* value = UseRegister(instr->value()); | 1163 LOperand* value = UseRegister(instr->value()); |
| 1166 LOperand* temp = TempRegister(); | 1164 LOperand* temp = TempRegister(); |
| 1167 LNumberUntagD* res = new(zone()) LNumberUntagD(value, temp); | 1165 LNumberUntagD* res = new(zone()) LNumberUntagD(value, temp); |
| 1168 return AssignEnvironment(DefineAsRegister(res)); | 1166 return AssignEnvironment(DefineAsRegister(res)); |
| 1169 } else if (to.IsSmi()) { | 1167 } else if (to.IsSmi()) { |
| 1170 LOperand* value = UseRegister(instr->value()); | 1168 LOperand* value = UseRegister(instr->value()); |
| 1171 if (instr->value()->type().IsSmi()) { | 1169 if (instr->value()->type().IsSmi()) { |
| 1172 return DefineSameAsFirst(new(zone()) LDummyUse(value)); | 1170 return DefineSameAsFirst(new(zone()) LDummyUse(value)); |
| 1173 } | 1171 } |
| 1174 return AssignEnvironment(DefineSameAsFirst(new(zone()) LCheckSmi(value))); | 1172 return AssignEnvironment(DefineSameAsFirst(new(zone()) LCheckSmi(value))); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1211 new(zone()) LTruncateDoubleToIntOrSmi(value, temp1, temp2); | 1209 new(zone()) LTruncateDoubleToIntOrSmi(value, temp1, temp2); |
| 1212 return DefineAsRegister(result); | 1210 return DefineAsRegister(result); |
| 1213 } else { | 1211 } else { |
| 1214 LDoubleToIntOrSmi* result = new(zone()) LDoubleToIntOrSmi(value); | 1212 LDoubleToIntOrSmi* result = new(zone()) LDoubleToIntOrSmi(value); |
| 1215 return AssignEnvironment(DefineAsRegister(result)); | 1213 return AssignEnvironment(DefineAsRegister(result)); |
| 1216 } | 1214 } |
| 1217 } | 1215 } |
| 1218 } else if (from.IsInteger32()) { | 1216 } else if (from.IsInteger32()) { |
| 1219 info()->MarkAsDeferredCalling(); | 1217 info()->MarkAsDeferredCalling(); |
| 1220 if (to.IsTagged()) { | 1218 if (to.IsTagged()) { |
| 1221 HValue* val = instr->value(); | 1219 if (instr->value()->CheckFlag(HInstruction::kUint32)) { |
| 1222 | 1220 LOperand* value = UseRegister(instr->value()); |
| 1223 if (val->CheckFlag(HInstruction::kUint32)) { | |
| 1224 LOperand* value = UseRegister(val); | |
| 1225 LNumberTagU* result = new(zone()) LNumberTagU(value, | 1221 LNumberTagU* result = new(zone()) LNumberTagU(value, |
| 1226 TempRegister(), | 1222 TempRegister(), |
| 1227 TempRegister()); | 1223 TempRegister()); |
| 1228 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); | 1224 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); |
| 1229 } else { | 1225 } else { |
| 1230 STATIC_ASSERT((kMinInt == Smi::kMinValue) && | 1226 STATIC_ASSERT((kMinInt == Smi::kMinValue) && |
| 1231 (kMaxInt == Smi::kMaxValue)); | 1227 (kMaxInt == Smi::kMaxValue)); |
| 1232 LOperand* value = UseRegisterAtStart(val); | 1228 LOperand* value = UseRegisterAtStart(instr->value()); |
| 1233 return DefineAsRegister(new(zone()) LSmiTag(value)); | 1229 return DefineAsRegister(new(zone()) LSmiTag(value)); |
| 1234 } | 1230 } |
| 1235 } else if (to.IsSmi()) { | 1231 } else if (to.IsSmi()) { |
| 1236 LOperand* value = UseRegisterAtStart(instr->value()); | 1232 LOperand* value = UseRegisterAtStart(instr->value()); |
| 1237 // This cannot deoptimize because an A64 smi can represent any int32. | 1233 if (instr->value()->CheckFlag(HInstruction::kUint32)) { |
| 1238 return DefineAsRegister(new(zone()) LInteger32ToSmi(value)); | 1234 LUint32ToSmi* result = new(zone()) LUint32ToSmi(value); |
| 1235 return AssignEnvironment(DefineAsRegister(result)); |
| 1236 } else { |
| 1237 // This cannot deoptimize because an A64 smi can represent any int32. |
| 1238 return DefineAsRegister(new(zone()) LInteger32ToSmi(value)); |
| 1239 } |
| 1239 } else { | 1240 } else { |
| 1240 ASSERT(to.IsDouble()); | 1241 ASSERT(to.IsDouble()); |
| 1241 if (instr->value()->CheckFlag(HInstruction::kUint32)) { | 1242 if (instr->value()->CheckFlag(HInstruction::kUint32)) { |
| 1242 return DefineAsRegister( | 1243 return DefineAsRegister( |
| 1243 new(zone()) LUint32ToDouble(UseRegisterAtStart(instr->value()))); | 1244 new(zone()) LUint32ToDouble(UseRegisterAtStart(instr->value()))); |
| 1244 } else { | 1245 } else { |
| 1245 return DefineAsRegister( | 1246 return DefineAsRegister( |
| 1246 new(zone()) LInteger32ToDouble(UseRegisterAtStart(instr->value()))); | 1247 new(zone()) LInteger32ToDouble(UseRegisterAtStart(instr->value()))); |
| 1247 } | 1248 } |
| 1248 } | 1249 } |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1598 | 1599 |
| 1599 | 1600 |
| 1600 LInstruction* LChunkBuilder::DoInstanceOfKnownGlobal( | 1601 LInstruction* LChunkBuilder::DoInstanceOfKnownGlobal( |
| 1601 HInstanceOfKnownGlobal* instr) { | 1602 HInstanceOfKnownGlobal* instr) { |
| 1602 LInstanceOfKnownGlobal* result = new(zone()) LInstanceOfKnownGlobal( | 1603 LInstanceOfKnownGlobal* result = new(zone()) LInstanceOfKnownGlobal( |
| 1603 UseFixed(instr->left(), InstanceofStub::left())); | 1604 UseFixed(instr->left(), InstanceofStub::left())); |
| 1604 return MarkAsCall(DefineFixed(result, x0), instr); | 1605 return MarkAsCall(DefineFixed(result, x0), instr); |
| 1605 } | 1606 } |
| 1606 | 1607 |
| 1607 | 1608 |
| 1608 LInstruction* LChunkBuilder::DoInstanceSize(HInstanceSize* instr) { | |
| 1609 LOperand* object = UseRegisterAtStart(instr->object()); | |
| 1610 return DefineAsRegister(new(zone()) LInstanceSize(object)); | |
| 1611 } | |
| 1612 | |
| 1613 | |
| 1614 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) { | 1609 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) { |
| 1615 // The function is required (by MacroAssembler::InvokeFunction) to be in x1. | 1610 // The function is required (by MacroAssembler::InvokeFunction) to be in x1. |
| 1616 LOperand* function = UseFixed(instr->function(), x1); | 1611 LOperand* function = UseFixed(instr->function(), x1); |
| 1617 LInvokeFunction* result = new(zone()) LInvokeFunction(function); | 1612 LInvokeFunction* result = new(zone()) LInvokeFunction(function); |
| 1618 return MarkAsCall(DefineFixed(result, x0), instr, CANNOT_DEOPTIMIZE_EAGERLY); | 1613 return MarkAsCall(DefineFixed(result, x0), instr, CANNOT_DEOPTIMIZE_EAGERLY); |
| 1619 } | 1614 } |
| 1620 | 1615 |
| 1621 | 1616 |
| 1622 LInstruction* LChunkBuilder::DoIsConstructCallAndBranch( | 1617 LInstruction* LChunkBuilder::DoIsConstructCallAndBranch( |
| 1623 HIsConstructCallAndBranch* instr) { | 1618 HIsConstructCallAndBranch* instr) { |
| (...skipping 926 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2550 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) { | 2545 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) { |
| 2551 LOperand* receiver = UseRegister(instr->receiver()); | 2546 LOperand* receiver = UseRegister(instr->receiver()); |
| 2552 LOperand* function = UseRegisterAtStart(instr->function()); | 2547 LOperand* function = UseRegisterAtStart(instr->function()); |
| 2553 LOperand* temp = TempRegister(); | 2548 LOperand* temp = TempRegister(); |
| 2554 LWrapReceiver* result = new(zone()) LWrapReceiver(receiver, function, temp); | 2549 LWrapReceiver* result = new(zone()) LWrapReceiver(receiver, function, temp); |
| 2555 return AssignEnvironment(DefineAsRegister(result)); | 2550 return AssignEnvironment(DefineAsRegister(result)); |
| 2556 } | 2551 } |
| 2557 | 2552 |
| 2558 | 2553 |
| 2559 } } // namespace v8::internal | 2554 } } // namespace v8::internal |
| OLD | NEW |