Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(330)

Unified Diff: src/compiler/instruction.cc

Issue 1081053002: [turbofan] cleanup PointerMap (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: renames Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/instruction.h ('k') | src/compiler/pipeline.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/instruction.cc
diff --git a/src/compiler/instruction.cc b/src/compiler/instruction.cc
index 9b051bab7a6add13dd2bbf1acc13db3cfc4886d0..c361571dfdf41d1acd711b854a407bfacd84cbad 100644
--- a/src/compiler/instruction.cc
+++ b/src/compiler/instruction.cc
@@ -126,7 +126,7 @@ Instruction::Instruction(InstructionCode opcode)
: opcode_(opcode),
bit_field_(OutputCountField::encode(0) | InputCountField::encode(0) |
TempCountField::encode(0) | IsCallField::encode(false)),
- pointer_map_(NULL) {
+ reference_map_(NULL) {
parallel_moves_[0] = nullptr;
parallel_moves_[1] = nullptr;
}
@@ -141,7 +141,7 @@ Instruction::Instruction(InstructionCode opcode, size_t output_count,
InputCountField::encode(input_count) |
TempCountField::encode(temp_count) |
IsCallField::encode(false)),
- pointer_map_(NULL) {
+ reference_map_(NULL) {
parallel_moves_[0] = nullptr;
parallel_moves_[1] = nullptr;
size_t offset = 0;
@@ -187,42 +187,27 @@ std::ostream& operator<<(std::ostream& os,
}
-void PointerMap::RecordPointer(InstructionOperand* op, Zone* zone) {
+void ReferenceMap::RecordReference(const InstructionOperand& op) {
// Do not record arguments as pointers.
- if (op->IsStackSlot() && StackSlotOperand::cast(op)->index() < 0) return;
- DCHECK(!op->IsDoubleRegister() && !op->IsDoubleStackSlot());
- pointer_operands_.Add(op, zone);
+ if (op.IsStackSlot() && StackSlotOperand::cast(op).index() < 0) return;
+ DCHECK(!op.IsDoubleRegister() && !op.IsDoubleStackSlot());
+ reference_operands_.push_back(op);
}
-void PointerMap::RemovePointer(InstructionOperand* op) {
- // Do not record arguments as pointers.
- if (op->IsStackSlot() && StackSlotOperand::cast(op)->index() < 0) return;
- DCHECK(!op->IsDoubleRegister() && !op->IsDoubleStackSlot());
- for (int i = 0; i < pointer_operands_.length(); ++i) {
- if (pointer_operands_[i]->Equals(op)) {
- pointer_operands_.Remove(i);
- --i;
- }
- }
-}
-
-
-void PointerMap::RecordUntagged(InstructionOperand* op, Zone* zone) {
- // Do not record arguments as pointers.
- if (op->IsStackSlot() && StackSlotOperand::cast(op)->index() < 0) return;
- DCHECK(!op->IsDoubleRegister() && !op->IsDoubleStackSlot());
- untagged_operands_.Add(op, zone);
-}
-
-
-std::ostream& operator<<(std::ostream& os, const PointerMap& pm) {
+std::ostream& operator<<(std::ostream& os, const ReferenceMap& pm) {
os << "{";
- for (ZoneList<InstructionOperand*>::iterator op =
- pm.pointer_operands_.begin();
- op != pm.pointer_operands_.end(); ++op) {
- if (op != pm.pointer_operands_.begin()) os << ";";
- os << *op;
+ bool first = true;
+ PrintableInstructionOperand poi = {RegisterConfiguration::ArchDefault(),
+ nullptr};
+ for (auto& op : pm.reference_operands_) {
+ if (!first) {
+ os << ";";
+ } else {
+ first = false;
+ }
+ poi.op_ = &op;
+ os << poi;
}
return os << "}";
}
@@ -501,7 +486,7 @@ InstructionSequence::InstructionSequence(Isolate* isolate,
immediates_(zone()),
instructions_(zone()),
next_virtual_register_(0),
- pointer_maps_(zone()),
+ reference_maps_(zone()),
doubles_(std::less<int>(), VirtualRegisterSet::allocator_type(zone())),
references_(std::less<int>(), VirtualRegisterSet::allocator_type(zone())),
deoptimization_entries_(zone()) {
@@ -546,12 +531,12 @@ void InstructionSequence::EndBlock(RpoNumber rpo) {
int InstructionSequence::AddInstruction(Instruction* instr) {
int index = static_cast<int>(instructions_.size());
instructions_.push_back(instr);
- if (instr->NeedsPointerMap()) {
- DCHECK(instr->pointer_map() == NULL);
- PointerMap* pointer_map = new (zone()) PointerMap(zone());
- pointer_map->set_instruction_position(index);
- instr->set_pointer_map(pointer_map);
- pointer_maps_.push_back(pointer_map);
+ if (instr->NeedsReferenceMap()) {
+ DCHECK(instr->reference_map() == NULL);
+ ReferenceMap* reference_map = new (zone()) ReferenceMap(zone());
+ reference_map->set_instruction_position(index);
+ instr->set_reference_map(reference_map);
+ reference_maps_.push_back(reference_map);
}
return index;
}
« no previous file with comments | « src/compiler/instruction.h ('k') | src/compiler/pipeline.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698