| Index: src/ia32/lithium-ia32.cc
|
| diff --git a/src/ia32/lithium-ia32.cc b/src/ia32/lithium-ia32.cc
|
| index 4fde3d464a0c0bd1e1d01c6e11e32af5a11a5874..6355f16f44def51787089977a22dd8c65b30017a 100644
|
| --- a/src/ia32/lithium-ia32.cc
|
| +++ b/src/ia32/lithium-ia32.cc
|
| @@ -1,4 +1,4 @@
|
| -// Copyright 2010 the V8 project authors. All rights reserved.
|
| +// Copyright 2011 the V8 project authors. All rights reserved.
|
| // Redistribution and use in source and binary forms, with or without
|
| // modification, are permitted provided that the following conditions are
|
| // met:
|
| @@ -322,15 +322,6 @@ void LAccessArgumentsAt::PrintDataTo(StringStream* stream) const {
|
| }
|
|
|
|
|
| -LChunk::LChunk(HGraph* graph)
|
| - : spill_slot_count_(0),
|
| - graph_(graph),
|
| - instructions_(32),
|
| - pointer_maps_(8),
|
| - inlined_closures_(1) {
|
| -}
|
| -
|
| -
|
| void LChunk::Verify() const {
|
| // TODO(twuerthinger): Implement verification for chunk.
|
| }
|
| @@ -472,151 +463,6 @@ void LChunk::AddGapMove(int index, LOperand* from, LOperand* to) {
|
| }
|
|
|
|
|
| -class LGapNode: public ZoneObject {
|
| - public:
|
| - explicit LGapNode(LOperand* operand)
|
| - : operand_(operand), resolved_(false), visited_id_(-1) { }
|
| -
|
| - LOperand* operand() const { return operand_; }
|
| - bool IsResolved() const { return !IsAssigned() || resolved_; }
|
| - void MarkResolved() {
|
| - ASSERT(!IsResolved());
|
| - resolved_ = true;
|
| - }
|
| - int visited_id() const { return visited_id_; }
|
| - void set_visited_id(int id) {
|
| - ASSERT(id > visited_id_);
|
| - visited_id_ = id;
|
| - }
|
| -
|
| - bool IsAssigned() const { return assigned_from_.is_set(); }
|
| - LGapNode* assigned_from() const { return assigned_from_.get(); }
|
| - void set_assigned_from(LGapNode* n) { assigned_from_.set(n); }
|
| -
|
| - private:
|
| - LOperand* operand_;
|
| - SetOncePointer<LGapNode> assigned_from_;
|
| - bool resolved_;
|
| - int visited_id_;
|
| -};
|
| -
|
| -
|
| -LGapResolver::LGapResolver(const ZoneList<LMoveOperands>* moves,
|
| - LOperand* marker_operand)
|
| - : nodes_(4),
|
| - identified_cycles_(4),
|
| - result_(4),
|
| - marker_operand_(marker_operand),
|
| - next_visited_id_(0) {
|
| - for (int i = 0; i < moves->length(); ++i) {
|
| - LMoveOperands move = moves->at(i);
|
| - if (!move.IsRedundant()) RegisterMove(move);
|
| - }
|
| -}
|
| -
|
| -
|
| -const ZoneList<LMoveOperands>* LGapResolver::ResolveInReverseOrder() {
|
| - for (int i = 0; i < identified_cycles_.length(); ++i) {
|
| - ResolveCycle(identified_cycles_[i]);
|
| - }
|
| -
|
| - int unresolved_nodes;
|
| - do {
|
| - unresolved_nodes = 0;
|
| - for (int j = 0; j < nodes_.length(); j++) {
|
| - LGapNode* node = nodes_[j];
|
| - if (!node->IsResolved() && node->assigned_from()->IsResolved()) {
|
| - AddResultMove(node->assigned_from(), node);
|
| - node->MarkResolved();
|
| - }
|
| - if (!node->IsResolved()) ++unresolved_nodes;
|
| - }
|
| - } while (unresolved_nodes > 0);
|
| - return &result_;
|
| -}
|
| -
|
| -
|
| -void LGapResolver::AddResultMove(LGapNode* from, LGapNode* to) {
|
| - AddResultMove(from->operand(), to->operand());
|
| -}
|
| -
|
| -
|
| -void LGapResolver::AddResultMove(LOperand* from, LOperand* to) {
|
| - result_.Add(LMoveOperands(from, to));
|
| -}
|
| -
|
| -
|
| -void LGapResolver::ResolveCycle(LGapNode* start) {
|
| - ZoneList<LOperand*> circle_operands(8);
|
| - circle_operands.Add(marker_operand_);
|
| - LGapNode* cur = start;
|
| - do {
|
| - cur->MarkResolved();
|
| - circle_operands.Add(cur->operand());
|
| - cur = cur->assigned_from();
|
| - } while (cur != start);
|
| - circle_operands.Add(marker_operand_);
|
| -
|
| - for (int i = circle_operands.length() - 1; i > 0; --i) {
|
| - LOperand* from = circle_operands[i];
|
| - LOperand* to = circle_operands[i - 1];
|
| - AddResultMove(from, to);
|
| - }
|
| -}
|
| -
|
| -
|
| -bool LGapResolver::CanReach(LGapNode* a, LGapNode* b, int visited_id) {
|
| - ASSERT(a != b);
|
| - LGapNode* cur = a;
|
| - while (cur != b && cur->visited_id() != visited_id && cur->IsAssigned()) {
|
| - cur->set_visited_id(visited_id);
|
| - cur = cur->assigned_from();
|
| - }
|
| -
|
| - return cur == b;
|
| -}
|
| -
|
| -
|
| -bool LGapResolver::CanReach(LGapNode* a, LGapNode* b) {
|
| - ASSERT(a != b);
|
| - return CanReach(a, b, next_visited_id_++);
|
| -}
|
| -
|
| -
|
| -void LGapResolver::RegisterMove(LMoveOperands move) {
|
| - if (move.from()->IsConstantOperand()) {
|
| - // Constant moves should be last in the machine code. Therefore add them
|
| - // first to the result set.
|
| - AddResultMove(move.from(), move.to());
|
| - } else {
|
| - LGapNode* from = LookupNode(move.from());
|
| - LGapNode* to = LookupNode(move.to());
|
| - if (to->IsAssigned() && to->assigned_from() == from) {
|
| - move.Eliminate();
|
| - return;
|
| - }
|
| - ASSERT(!to->IsAssigned());
|
| - if (CanReach(from, to)) {
|
| - // This introduces a circle. Save.
|
| - identified_cycles_.Add(from);
|
| - }
|
| - to->set_assigned_from(from);
|
| - }
|
| -}
|
| -
|
| -
|
| -LGapNode* LGapResolver::LookupNode(LOperand* operand) {
|
| - for (int i = 0; i < nodes_.length(); ++i) {
|
| - if (nodes_[i]->operand()->Equals(operand)) return nodes_[i];
|
| - }
|
| -
|
| - // No node found => create a new one.
|
| - LGapNode* result = new LGapNode(operand);
|
| - nodes_.Add(result);
|
| - return result;
|
| -}
|
| -
|
| -
|
| Handle<Object> LChunk::LookupLiteral(LConstantOperand* operand) const {
|
| return HConstant::cast(graph_->LookupValue(operand->index()))->handle();
|
| }
|
| @@ -833,6 +679,12 @@ LInstruction* LChunkBuilder::MarkAsCall(LInstruction* instr,
|
| }
|
|
|
|
|
| +LInstruction* LChunkBuilder::MarkAsSaveDoubles(LInstruction* instr) {
|
| + allocator_->MarkAsSaveDoubles();
|
| + return instr;
|
| +}
|
| +
|
| +
|
| LInstruction* LChunkBuilder::AssignPointerMap(LInstruction* instr) {
|
| ASSERT(!instr->HasPointerMap());
|
| instr->set_pointer_map(new LPointerMap(position_));
|
| @@ -1257,10 +1109,11 @@ LInstruction* LChunkBuilder::DoBranch(HBranch* instr) {
|
| } else if (v->IsInstanceOf()) {
|
| HInstanceOf* instance_of = HInstanceOf::cast(v);
|
| LInstruction* result =
|
| - new LInstanceOfAndBranch(UseFixed(instance_of->left(), eax),
|
| - UseFixed(instance_of->right(), edx),
|
| - first_id,
|
| - second_id);
|
| + new LInstanceOfAndBranch(
|
| + UseFixed(instance_of->left(), InstanceofStub::left()),
|
| + UseFixed(instance_of->right(), InstanceofStub::right()),
|
| + first_id,
|
| + second_id);
|
| return MarkAsCall(result, instr);
|
| } else if (v->IsTypeofIs()) {
|
| HTypeofIs* typeof_is = HTypeofIs::cast(v);
|
| @@ -1287,12 +1140,7 @@ LInstruction* LChunkBuilder::DoCompareMapAndBranch(
|
| HCompareMapAndBranch* instr) {
|
| ASSERT(instr->value()->representation().IsTagged());
|
| LOperand* value = UseRegisterAtStart(instr->value());
|
| - HBasicBlock* first = instr->FirstSuccessor();
|
| - HBasicBlock* second = instr->SecondSuccessor();
|
| - return new LCmpMapAndBranch(value,
|
| - instr->map(),
|
| - first->block_id(),
|
| - second->block_id());
|
| + return new LCmpMapAndBranch(value);
|
| }
|
|
|
|
|
| @@ -1308,12 +1156,23 @@ LInstruction* LChunkBuilder::DoArgumentsElements(HArgumentsElements* elems) {
|
|
|
| LInstruction* LChunkBuilder::DoInstanceOf(HInstanceOf* instr) {
|
| LInstruction* result =
|
| - new LInstanceOf(UseFixed(instr->left(), eax),
|
| - UseFixed(instr->right(), edx));
|
| + new LInstanceOf(UseFixed(instr->left(), InstanceofStub::left()),
|
| + UseFixed(instr->right(), InstanceofStub::right()));
|
| return MarkAsCall(DefineFixed(result, eax), instr);
|
| }
|
|
|
|
|
| +LInstruction* LChunkBuilder::DoInstanceOfKnownGlobal(
|
| + HInstanceOfKnownGlobal* instr) {
|
| + LInstruction* result =
|
| + new LInstanceOfKnownGlobal(
|
| + UseFixed(instr->value(), InstanceofStub::left()),
|
| + FixedTemp(edi));
|
| + MarkAsSaveDoubles(result);
|
| + return AssignEnvironment(AssignPointerMap(DefineFixed(result, eax)));
|
| +}
|
| +
|
| +
|
| LInstruction* LChunkBuilder::DoApplyArguments(HApplyArguments* instr) {
|
| LOperand* function = UseFixed(instr->function(), edi);
|
| LOperand* receiver = UseFixed(instr->receiver(), eax);
|
|
|