summaryrefslogtreecommitdiff
path: root/deps/v8/src/compiler/instruction.cc
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2015-01-07 18:38:38 +0100
committerBen Noordhuis <info@bnoordhuis.nl>2015-01-07 22:11:18 +0100
commitdad73f645cde6920e79db956e7ef82ed640d7615 (patch)
tree7ba3f3fc7e0722c5f130065461b7c56f571af383 /deps/v8/src/compiler/instruction.cc
parent53ba494537259b18b346dc6150d6a100c557e08f (diff)
downloadnode-new-dad73f645cde6920e79db956e7ef82ed640d7615.tar.gz
deps: upgrade v8 to 3.31.74.1
PR-URL: https://github.com/iojs/io.js/pull/243 Reviewed-By: Fedor Indutny <fedor@indutny.com> Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Diffstat (limited to 'deps/v8/src/compiler/instruction.cc')
-rw-r--r--deps/v8/src/compiler/instruction.cc51
1 files changed, 39 insertions, 12 deletions
diff --git a/deps/v8/src/compiler/instruction.cc b/deps/v8/src/compiler/instruction.cc
index d575be4d12..f83cdebede 100644
--- a/deps/v8/src/compiler/instruction.cc
+++ b/deps/v8/src/compiler/instruction.cc
@@ -3,7 +3,6 @@
// found in the LICENSE file.
#include "src/compiler/common-operator.h"
-#include "src/compiler/generic-node-inl.h"
#include "src/compiler/graph.h"
#include "src/compiler/instruction.h"
@@ -16,8 +15,6 @@ std::ostream& operator<<(std::ostream& os,
const InstructionOperand& op = *printable.op_;
const RegisterConfiguration* conf = printable.register_configuration_;
switch (op.kind()) {
- case InstructionOperand::INVALID:
- return os << "(0)";
case InstructionOperand::UNALLOCATED: {
const UnallocatedOperand* unalloc = UnallocatedOperand::cast(&op);
os << "v" << unalloc->virtual_register();
@@ -120,6 +117,16 @@ bool ParallelMove::IsRedundant() const {
}
+bool GapInstruction::IsRedundant() const {
+ for (int i = GapInstruction::FIRST_INNER_POSITION;
+ i <= GapInstruction::LAST_INNER_POSITION; i++) {
+ if (parallel_moves_[i] != NULL && !parallel_moves_[i]->IsRedundant())
+ return false;
+ }
+ return true;
+}
+
+
std::ostream& operator<<(std::ostream& os,
const PrintableParallelMove& printable) {
const ParallelMove& pm = *printable.parallel_move_;
@@ -332,6 +339,8 @@ std::ostream& operator<<(std::ostream& os, const Constant& constant) {
constant.ToExternalReference().address());
case Constant::kHeapObject:
return os << Brief(*constant.ToHeapObject());
+ case Constant::kRpoNumber:
+ return os << "RPO" << constant.ToRpoNumber().ToInt();
}
UNREACHABLE();
return os;
@@ -339,7 +348,6 @@ std::ostream& operator<<(std::ostream& os, const Constant& constant) {
InstructionBlock::InstructionBlock(Zone* zone, BasicBlock::Id id,
- BasicBlock::RpoNumber ao_number,
BasicBlock::RpoNumber rpo_number,
BasicBlock::RpoNumber loop_header,
BasicBlock::RpoNumber loop_end,
@@ -348,7 +356,7 @@ InstructionBlock::InstructionBlock(Zone* zone, BasicBlock::Id id,
predecessors_(zone),
phis_(zone),
id_(id),
- ao_number_(ao_number),
+ ao_number_(rpo_number),
rpo_number_(rpo_number),
loop_header_(loop_header),
loop_end_(loop_end),
@@ -383,8 +391,8 @@ static BasicBlock::RpoNumber GetLoopEndRpo(const BasicBlock* block) {
static InstructionBlock* InstructionBlockFor(Zone* zone,
const BasicBlock* block) {
InstructionBlock* instr_block = new (zone) InstructionBlock(
- zone, block->id(), block->GetAoNumber(), block->GetRpoNumber(),
- GetRpo(block->loop_header()), GetLoopEndRpo(block), block->deferred());
+ zone, block->id(), block->GetRpoNumber(), GetRpo(block->loop_header()),
+ GetLoopEndRpo(block), block->deferred());
// Map successors and precessors
instr_block->successors().reserve(block->SuccessorCount());
for (auto it = block->successors_begin(); it != block->successors_end();
@@ -412,10 +420,26 @@ InstructionBlocks* InstructionSequence::InstructionBlocksFor(
DCHECK((*it)->GetRpoNumber().ToSize() == rpo_number);
(*blocks)[rpo_number] = InstructionBlockFor(zone, *it);
}
+ ComputeAssemblyOrder(blocks);
return blocks;
}
+void InstructionSequence::ComputeAssemblyOrder(InstructionBlocks* blocks) {
+ int ao = 0;
+ for (auto const block : *blocks) {
+ if (!block->IsDeferred()) {
+ block->set_ao_number(BasicBlock::RpoNumber::FromInt(ao++));
+ }
+ }
+ for (auto const block : *blocks) {
+ if (block->IsDeferred()) {
+ block->set_ao_number(BasicBlock::RpoNumber::FromInt(ao++));
+ }
+ }
+}
+
+
InstructionSequence::InstructionSequence(Zone* instruction_zone,
InstructionBlocks* instruction_blocks)
: zone_(instruction_zone),
@@ -435,8 +459,8 @@ InstructionSequence::InstructionSequence(Zone* instruction_zone,
BlockStartInstruction* InstructionSequence::GetBlockStart(
- BasicBlock::RpoNumber rpo) {
- InstructionBlock* block = InstructionBlockAt(rpo);
+ BasicBlock::RpoNumber rpo) const {
+ const InstructionBlock* block = InstructionBlockAt(rpo);
return BlockStartInstruction::cast(InstructionAt(block->code_start()));
}
@@ -644,9 +668,12 @@ std::ostream& operator<<(std::ostream& os,
os << "\n";
for (auto phi : block->phis()) {
- os << " phi: v" << phi->virtual_register() << " =";
- for (auto op_vreg : phi->operands()) {
- os << " v" << op_vreg;
+ PrintableInstructionOperand printable_op = {
+ printable.register_configuration_, phi->output()};
+ os << " phi: " << printable_op << " =";
+ for (auto input : phi->inputs()) {
+ printable_op.op_ = input;
+ os << " " << printable_op;
}
os << "\n";
}