OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/compiler/common-operator.h" | 5 #include "src/compiler/common-operator.h" |
6 #include "src/compiler/graph.h" | 6 #include "src/compiler/graph.h" |
7 #include "src/compiler/instruction.h" | 7 #include "src/compiler/instruction.h" |
8 #include "src/compiler/schedule.h" | 8 #include "src/compiler/schedule.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 if (instr.OutputCount() > 1) os << "("; | 312 if (instr.OutputCount() > 1) os << "("; |
313 for (size_t i = 0; i < instr.OutputCount(); i++) { | 313 for (size_t i = 0; i < instr.OutputCount(); i++) { |
314 if (i > 0) os << ", "; | 314 if (i > 0) os << ", "; |
315 printable_op.op_ = instr.OutputAt(i); | 315 printable_op.op_ = instr.OutputAt(i); |
316 os << printable_op; | 316 os << printable_op; |
317 } | 317 } |
318 | 318 |
319 if (instr.OutputCount() > 1) os << ") = "; | 319 if (instr.OutputCount() > 1) os << ") = "; |
320 if (instr.OutputCount() == 1) os << " = "; | 320 if (instr.OutputCount() == 1) os << " = "; |
321 | 321 |
322 if (instr.IsSourcePosition()) { | 322 os << ArchOpcodeField::decode(instr.opcode()); |
323 const SourcePositionInstruction* pos = | 323 AddressingMode am = AddressingModeField::decode(instr.opcode()); |
324 SourcePositionInstruction::cast(&instr); | 324 if (am != kMode_None) { |
325 os << "position (" << pos->source_position().raw() << ")"; | 325 os << " : " << AddressingModeField::decode(instr.opcode()); |
326 } else { | 326 } |
327 os << ArchOpcodeField::decode(instr.opcode()); | 327 FlagsMode fm = FlagsModeField::decode(instr.opcode()); |
328 AddressingMode am = AddressingModeField::decode(instr.opcode()); | 328 if (fm != kFlags_none) { |
329 if (am != kMode_None) { | 329 os << " && " << fm << " if " << FlagsConditionField::decode(instr.opcode()); |
330 os << " : " << AddressingModeField::decode(instr.opcode()); | |
331 } | |
332 FlagsMode fm = FlagsModeField::decode(instr.opcode()); | |
333 if (fm != kFlags_none) { | |
334 os << " && " << fm << " if " | |
335 << FlagsConditionField::decode(instr.opcode()); | |
336 } | |
337 } | 330 } |
338 if (instr.InputCount() > 0) { | 331 if (instr.InputCount() > 0) { |
339 for (size_t i = 0; i < instr.InputCount(); i++) { | 332 for (size_t i = 0; i < instr.InputCount(); i++) { |
340 printable_op.op_ = instr.InputAt(i); | 333 printable_op.op_ = instr.InputAt(i); |
341 os << " " << printable_op; | 334 os << " " << printable_op; |
342 } | 335 } |
343 } | 336 } |
344 return os; | 337 return os; |
345 } | 338 } |
346 | 339 |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 } | 466 } |
474 } | 467 } |
475 | 468 |
476 | 469 |
477 InstructionSequence::InstructionSequence(Isolate* isolate, | 470 InstructionSequence::InstructionSequence(Isolate* isolate, |
478 Zone* instruction_zone, | 471 Zone* instruction_zone, |
479 InstructionBlocks* instruction_blocks) | 472 InstructionBlocks* instruction_blocks) |
480 : isolate_(isolate), | 473 : isolate_(isolate), |
481 zone_(instruction_zone), | 474 zone_(instruction_zone), |
482 instruction_blocks_(instruction_blocks), | 475 instruction_blocks_(instruction_blocks), |
| 476 source_positions_(zone()), |
483 block_starts_(zone()), | 477 block_starts_(zone()), |
484 constants_(ConstantMap::key_compare(), | 478 constants_(ConstantMap::key_compare(), |
485 ConstantMap::allocator_type(zone())), | 479 ConstantMap::allocator_type(zone())), |
486 immediates_(zone()), | 480 immediates_(zone()), |
487 instructions_(zone()), | 481 instructions_(zone()), |
488 next_virtual_register_(0), | 482 next_virtual_register_(0), |
489 reference_maps_(zone()), | 483 reference_maps_(zone()), |
490 doubles_(std::less<int>(), VirtualRegisterSet::allocator_type(zone())), | 484 doubles_(std::less<int>(), VirtualRegisterSet::allocator_type(zone())), |
491 references_(std::less<int>(), VirtualRegisterSet::allocator_type(zone())), | 485 references_(std::less<int>(), VirtualRegisterSet::allocator_type(zone())), |
492 deoptimization_entries_(zone()) { | 486 deoptimization_entries_(zone()) { |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
597 RpoNumber InstructionSequence::InputRpo(Instruction* instr, size_t index) { | 591 RpoNumber InstructionSequence::InputRpo(Instruction* instr, size_t index) { |
598 InstructionOperand* operand = instr->InputAt(index); | 592 InstructionOperand* operand = instr->InputAt(index); |
599 Constant constant = | 593 Constant constant = |
600 operand->IsImmediate() | 594 operand->IsImmediate() |
601 ? GetImmediate(ImmediateOperand::cast(operand)) | 595 ? GetImmediate(ImmediateOperand::cast(operand)) |
602 : GetConstant(ConstantOperand::cast(operand)->virtual_register()); | 596 : GetConstant(ConstantOperand::cast(operand)->virtual_register()); |
603 return constant.ToRpoNumber(); | 597 return constant.ToRpoNumber(); |
604 } | 598 } |
605 | 599 |
606 | 600 |
| 601 bool InstructionSequence::GetSourcePosition(const Instruction* instr, |
| 602 SourcePosition* result) const { |
| 603 auto it = source_positions_.find(instr); |
| 604 if (it == source_positions_.end()) return false; |
| 605 *result = it->second; |
| 606 return true; |
| 607 } |
| 608 |
| 609 |
| 610 void InstructionSequence::SetSourcePosition(const Instruction* instr, |
| 611 SourcePosition value) { |
| 612 DCHECK(!value.IsInvalid()); |
| 613 DCHECK(!value.IsUnknown()); |
| 614 source_positions_.insert(std::make_pair(instr, value)); |
| 615 } |
| 616 |
| 617 |
607 FrameStateDescriptor::FrameStateDescriptor( | 618 FrameStateDescriptor::FrameStateDescriptor( |
608 Zone* zone, const FrameStateCallInfo& state_info, size_t parameters_count, | 619 Zone* zone, const FrameStateCallInfo& state_info, size_t parameters_count, |
609 size_t locals_count, size_t stack_count, FrameStateDescriptor* outer_state) | 620 size_t locals_count, size_t stack_count, FrameStateDescriptor* outer_state) |
610 : type_(state_info.type()), | 621 : type_(state_info.type()), |
611 bailout_id_(state_info.bailout_id()), | 622 bailout_id_(state_info.bailout_id()), |
612 frame_state_combine_(state_info.state_combine()), | 623 frame_state_combine_(state_info.state_combine()), |
613 parameters_count_(parameters_count), | 624 parameters_count_(parameters_count), |
614 locals_count_(locals_count), | 625 locals_count_(locals_count), |
615 stack_count_(stack_count), | 626 stack_count_(stack_count), |
616 types_(zone), | 627 types_(zone), |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
739 os << " B" << succ.ToInt(); | 750 os << " B" << succ.ToInt(); |
740 } | 751 } |
741 os << "\n"; | 752 os << "\n"; |
742 } | 753 } |
743 return os; | 754 return os; |
744 } | 755 } |
745 | 756 |
746 } // namespace compiler | 757 } // namespace compiler |
747 } // namespace internal | 758 } // namespace internal |
748 } // namespace v8 | 759 } // namespace v8 |
OLD | NEW |