summaryrefslogtreecommitdiff
path: root/deps/v8/src/compiler/gap-resolver.cc
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2015-06-19 13:23:56 +0200
committerRod Vagg <rod@vagg.org>2015-08-04 11:56:14 -0700
commit70d1f32f5605465a1a630a64f6f0d35f96c7709d (patch)
tree0a349040a686eafcb0a09943ebc733477dce2781 /deps/v8/src/compiler/gap-resolver.cc
parent4643b8b6671607a7aff60cbbd0b384dcf2f6959e (diff)
downloadnode-new-70d1f32f5605465a1a630a64f6f0d35f96c7709d.tar.gz
deps: update v8 to 4.4.63.9
Upgrade the bundled V8 and update code in src/ and lib/ to the new API. Notable backwards incompatible changes are the removal of the smalloc module and dropped support for CESU-8 decoding. CESU-8 support can be brought back if necessary by doing UTF-8 decoding ourselves. This commit includes https://codereview.chromium.org/1192973004 to fix a build error on python 2.6 systems. The original commit log follows: Use optparse in js2c.py for python compatibility Without this change, V8 won't build on RHEL/CentOS 6 because the distro python is too old to know about the argparse module. PR-URL: https://github.com/nodejs/io.js/pull/2022 Reviewed-By: Rod Vagg <rod@vagg.org> Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Diffstat (limited to 'deps/v8/src/compiler/gap-resolver.cc')
-rw-r--r--deps/v8/src/compiler/gap-resolver.cc76
1 files changed, 28 insertions, 48 deletions
diff --git a/deps/v8/src/compiler/gap-resolver.cc b/deps/v8/src/compiler/gap-resolver.cc
index f369607170..e5de73781b 100644
--- a/deps/v8/src/compiler/gap-resolver.cc
+++ b/deps/v8/src/compiler/gap-resolver.cc
@@ -12,49 +12,30 @@ namespace v8 {
namespace internal {
namespace compiler {
-typedef ZoneList<MoveOperands>::iterator op_iterator;
-
-#ifdef ENABLE_SLOW_DCHECKS
-// TODO(svenpanne) Brush up InstructionOperand with comparison?
-struct InstructionOperandComparator {
- bool operator()(const InstructionOperand* x,
- const InstructionOperand* y) const {
- return (x->kind() < y->kind()) ||
- (x->kind() == y->kind() && x->index() < y->index());
- }
-};
-#endif
-
-// No operand should be the destination for more than one move.
-static void VerifyMovesAreInjective(ZoneList<MoveOperands>* moves) {
-#ifdef ENABLE_SLOW_DCHECKS
- std::set<InstructionOperand*, InstructionOperandComparator> seen;
- for (op_iterator i = moves->begin(); i != moves->end(); ++i) {
- SLOW_DCHECK(seen.find(i->destination()) == seen.end());
- seen.insert(i->destination());
- }
-#endif
+namespace {
+
+inline bool Blocks(MoveOperands* move, InstructionOperand destination) {
+ return move->Blocks(destination);
}
-void GapResolver::Resolve(ParallelMove* parallel_move) const {
- ZoneList<MoveOperands>* moves = parallel_move->move_operands();
- // TODO(svenpanne) Use the member version of remove_if when we use real lists.
- op_iterator end =
- std::remove_if(moves->begin(), moves->end(),
- std::mem_fun_ref(&MoveOperands::IsRedundant));
- moves->Rewind(static_cast<int>(end - moves->begin()));
+inline bool IsRedundant(MoveOperands* move) { return move->IsRedundant(); }
+
+} // namespace
- VerifyMovesAreInjective(moves);
- for (op_iterator move = moves->begin(); move != moves->end(); ++move) {
- if (!move->IsEliminated()) PerformMove(moves, &*move);
+void GapResolver::Resolve(ParallelMove* moves) const {
+ // Clear redundant moves.
+ auto it =
+ std::remove_if(moves->begin(), moves->end(), std::ptr_fun(IsRedundant));
+ moves->erase(it, moves->end());
+ for (auto move : *moves) {
+ if (!move->IsEliminated()) PerformMove(moves, move);
}
}
-void GapResolver::PerformMove(ZoneList<MoveOperands>* moves,
- MoveOperands* move) const {
+void GapResolver::PerformMove(ParallelMove* moves, MoveOperands* move) const {
// Each call to this function performs a move and deletes it from the move
// graph. We first recursively perform any move blocking this one. We mark a
// move as "pending" on entry to PerformMove in order to detect cycles in the
@@ -65,14 +46,14 @@ void GapResolver::PerformMove(ZoneList<MoveOperands>* moves,
// Clear this move's destination to indicate a pending move. The actual
// destination is saved on the side.
- DCHECK_NOT_NULL(move->source()); // Or else it will look eliminated.
- InstructionOperand* destination = move->destination();
- move->set_destination(NULL);
+ DCHECK(!move->source().IsInvalid()); // Or else it will look eliminated.
+ InstructionOperand destination = move->destination();
+ move->SetPending();
// Perform a depth-first traversal of the move graph to resolve dependencies.
// Any unperformed, unpending move with a source the same as this one's
// destination blocks this one so recursively perform all such moves.
- for (op_iterator other = moves->begin(); other != moves->end(); ++other) {
+ for (auto other : *moves) {
if (other->Blocks(destination) && !other->IsPending()) {
// Though PerformMove can change any source operand in the move graph,
// this call cannot create a blocking move via a swap (this loop does not
@@ -93,8 +74,8 @@ void GapResolver::PerformMove(ZoneList<MoveOperands>* moves,
// This move's source may have changed due to swaps to resolve cycles and so
// it may now be the last move in the cycle. If so remove it.
- InstructionOperand* source = move->source();
- if (source->Equals(destination)) {
+ InstructionOperand source = move->source();
+ if (source.EqualsModuloType(destination)) {
move->Eliminate();
return;
}
@@ -102,28 +83,27 @@ void GapResolver::PerformMove(ZoneList<MoveOperands>* moves,
// The move may be blocked on a (at most one) pending move, in which case we
// have a cycle. Search for such a blocking move and perform a swap to
// resolve it.
- op_iterator blocker = std::find_if(
- moves->begin(), moves->end(),
- std::bind2nd(std::mem_fun_ref(&MoveOperands::Blocks), destination));
+ auto blocker = std::find_if(moves->begin(), moves->end(),
+ std::bind2nd(std::ptr_fun(&Blocks), destination));
if (blocker == moves->end()) {
// The easy case: This move is not blocked.
- assembler_->AssembleMove(source, destination);
+ assembler_->AssembleMove(&source, &destination);
move->Eliminate();
return;
}
- DCHECK(blocker->IsPending());
+ DCHECK((*blocker)->IsPending());
// Ensure source is a register or both are stack slots, to limit swap cases.
- if (source->IsStackSlot() || source->IsDoubleStackSlot()) {
+ if (source.IsStackSlot() || source.IsDoubleStackSlot()) {
std::swap(source, destination);
}
- assembler_->AssembleSwap(source, destination);
+ assembler_->AssembleSwap(&source, &destination);
move->Eliminate();
// Any unperformed (including pending) move with a source of either this
// move's source or destination needs to have their source changed to
// reflect the state of affairs after the swap.
- for (op_iterator other = moves->begin(); other != moves->end(); ++other) {
+ for (auto other : *moves) {
if (other->Blocks(source)) {
other->set_source(destination);
} else if (other->Blocks(destination)) {