// Copyright 2012 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:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
#ifndef V8_LITHIUM_ALLOCATOR_H_
#define V8_LITHIUM_ALLOCATOR_H_
-#include "v8.h"
+#include "src/v8.h"
-#include "allocation.h"
-#include "lithium.h"
-#include "zone.h"
+#include "src/allocation.h"
+#include "src/lithium.h"
+#include "src/zone.h"
namespace v8 {
namespace internal {
// Forward declarations.
class HBasicBlock;
class HGraph;
-class HInstruction;
class HPhi;
class HTracer;
class HValue;
class BitVector;
class StringStream;
-class LArgument;
class LPlatformChunk;
class LOperand;
class LUnallocated;
-class LConstantOperand;
class LGap;
class LParallelMove;
class LPointerMap;
-class LStackSlot;
-class LRegister;
// This class represents a single point of a LOperand's lifetime.
// Returns the index of the instruction to which this lifetime position
// corresponds.
int InstructionIndex() const {
- ASSERT(IsValid());
+ DCHECK(IsValid());
return value_ / kStep;
}
// Returns the lifetime position for the start of the instruction which
// corresponds to this lifetime position.
LifetimePosition InstructionStart() const {
- ASSERT(IsValid());
+ DCHECK(IsValid());
return LifetimePosition(value_ & ~(kStep - 1));
}
// Returns the lifetime position for the end of the instruction which
// corresponds to this lifetime position.
LifetimePosition InstructionEnd() const {
- ASSERT(IsValid());
+ DCHECK(IsValid());
return LifetimePosition(InstructionStart().Value() + kStep/2);
}
// Returns the lifetime position for the beginning of the next instruction.
LifetimePosition NextInstruction() const {
- ASSERT(IsValid());
+ DCHECK(IsValid());
return LifetimePosition(InstructionStart().Value() + kStep);
}
// Returns the lifetime position for the beginning of the previous
// instruction.
LifetimePosition PrevInstruction() const {
- ASSERT(IsValid());
- ASSERT(value_ > 1);
+ DCHECK(IsValid());
+ DCHECK(value_ > 1);
return LifetimePosition(InstructionStart().Value() - kStep);
}
};
-enum RegisterKind {
- UNALLOCATED_REGISTERS,
- GENERAL_REGISTERS,
- DOUBLE_REGISTERS
-};
-
-
-// A register-allocator view of a Lithium instruction. It contains the id of
-// the output operand and a list of input operand uses.
-
-class LInstruction;
-class LEnvironment;
-
-// Iterator for non-null temp operands.
-class TempIterator BASE_EMBEDDED {
- public:
- inline explicit TempIterator(LInstruction* instr);
- inline bool Done();
- inline LOperand* Current();
- inline void Advance();
-
- private:
- inline void SkipUninteresting();
- LInstruction* instr_;
- int limit_;
- int current_;
-};
-
-
-// Iterator for non-constant input operands.
-class InputIterator BASE_EMBEDDED {
- public:
- inline explicit InputIterator(LInstruction* instr);
- inline bool Done();
- inline LOperand* Current();
- inline void Advance();
-
- private:
- inline void SkipUninteresting();
- LInstruction* instr_;
- int limit_;
- int current_;
-};
-
-
-class UseIterator BASE_EMBEDDED {
- public:
- inline explicit UseIterator(LInstruction* instr);
- inline bool Done();
- inline LOperand* Current();
- inline void Advance();
-
- private:
- InputIterator input_iterator_;
- DeepIterator env_iterator_;
-};
-
-
// Representation of the non-empty interval [start,end[.
class UseInterval: public ZoneObject {
public:
UseInterval(LifetimePosition start, LifetimePosition end)
: start_(start), end_(end), next_(NULL) {
- ASSERT(start.Value() < end.Value());
+ DCHECK(start.Value() < end.Value());
}
LifetimePosition start() const { return start_; }
bool IsSpilled() const { return spilled_; }
LOperand* current_hint_operand() const {
- ASSERT(current_hint_operand_ == FirstHint());
+ DCHECK(current_hint_operand_ == FirstHint());
return current_hint_operand_;
}
LOperand* FirstHint() const {
}
LifetimePosition Start() const {
- ASSERT(!IsEmpty());
+ DCHECK(!IsEmpty());
return first_interval()->start();
}
LifetimePosition End() const {
- ASSERT(!IsEmpty());
+ DCHECK(!IsEmpty());
return last_interval_->end();
}
void MarkAsOsrEntry() {
// There can be only one.
- ASSERT(!has_osr_entry_);
+ DCHECK(!has_osr_entry_);
// Simply set a flag to find and process instruction later.
has_osr_entry_ = true;
}