2012-01-09 16:37:47 +00:00
|
|
|
// Copyright 2012 the V8 project authors. All rights reserved.
|
2011-01-07 11:49:22 +00:00
|
|
|
// 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.
|
|
|
|
|
|
|
|
#ifndef V8_LITHIUM_H_
|
|
|
|
#define V8_LITHIUM_H_
|
|
|
|
|
2011-05-06 06:50:20 +00:00
|
|
|
#include "allocation.h"
|
2011-01-11 15:51:08 +00:00
|
|
|
#include "hydrogen.h"
|
|
|
|
#include "safepoint-table.h"
|
2011-01-07 11:49:22 +00:00
|
|
|
|
|
|
|
namespace v8 {
|
|
|
|
namespace internal {
|
|
|
|
|
2012-03-28 13:12:00 +00:00
|
|
|
#define LITHIUM_OPERAND_LIST(V) \
|
|
|
|
V(ConstantOperand, CONSTANT_OPERAND) \
|
|
|
|
V(StackSlot, STACK_SLOT) \
|
|
|
|
V(DoubleStackSlot, DOUBLE_STACK_SLOT) \
|
|
|
|
V(Register, REGISTER) \
|
|
|
|
V(DoubleRegister, DOUBLE_REGISTER)
|
|
|
|
|
|
|
|
|
2011-01-19 13:55:56 +00:00
|
|
|
class LOperand: public ZoneObject {
|
|
|
|
public:
|
|
|
|
enum Kind {
|
|
|
|
INVALID,
|
|
|
|
UNALLOCATED,
|
|
|
|
CONSTANT_OPERAND,
|
|
|
|
STACK_SLOT,
|
|
|
|
DOUBLE_STACK_SLOT,
|
|
|
|
REGISTER,
|
|
|
|
DOUBLE_REGISTER,
|
|
|
|
ARGUMENT
|
|
|
|
};
|
|
|
|
|
|
|
|
LOperand() : value_(KindField::encode(INVALID)) { }
|
|
|
|
|
|
|
|
Kind kind() const { return KindField::decode(value_); }
|
|
|
|
int index() const { return static_cast<int>(value_) >> kKindFieldWidth; }
|
2012-03-28 13:12:00 +00:00
|
|
|
#define LITHIUM_OPERAND_PREDICATE(name, type) \
|
|
|
|
bool Is##name() const { return kind() == type; }
|
|
|
|
LITHIUM_OPERAND_LIST(LITHIUM_OPERAND_PREDICATE)
|
|
|
|
LITHIUM_OPERAND_PREDICATE(Argument, ARGUMENT)
|
|
|
|
LITHIUM_OPERAND_PREDICATE(Unallocated, UNALLOCATED)
|
|
|
|
LITHIUM_OPERAND_PREDICATE(Ignored, INVALID)
|
|
|
|
#undef LITHIUM_OPERAND_PREDICATE
|
2011-01-19 13:55:56 +00:00
|
|
|
bool Equals(LOperand* other) const { return value_ == other->value_; }
|
|
|
|
|
|
|
|
void PrintTo(StringStream* stream);
|
|
|
|
void ConvertTo(Kind kind, int index) {
|
|
|
|
value_ = KindField::encode(kind);
|
|
|
|
value_ |= index << kKindFieldWidth;
|
|
|
|
ASSERT(this->index() == index);
|
|
|
|
}
|
|
|
|
|
2012-03-28 13:12:00 +00:00
|
|
|
// Calls SetUpCache()/TearDownCache() for each subclass.
|
2012-03-12 13:56:56 +00:00
|
|
|
static void SetUpCaches();
|
2012-03-28 13:12:00 +00:00
|
|
|
static void TearDownCaches();
|
2012-03-12 13:56:56 +00:00
|
|
|
|
2011-01-19 13:55:56 +00:00
|
|
|
protected:
|
|
|
|
static const int kKindFieldWidth = 3;
|
|
|
|
class KindField : public BitField<Kind, 0, kKindFieldWidth> { };
|
|
|
|
|
|
|
|
LOperand(Kind kind, int index) { ConvertTo(kind, index); }
|
|
|
|
|
|
|
|
unsigned value_;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class LUnallocated: public LOperand {
|
|
|
|
public:
|
2013-05-02 09:51:07 +00:00
|
|
|
enum BasicPolicy {
|
|
|
|
FIXED_SLOT,
|
|
|
|
EXTENDED_POLICY
|
|
|
|
};
|
|
|
|
|
|
|
|
enum ExtendedPolicy {
|
2011-01-19 13:55:56 +00:00
|
|
|
NONE,
|
|
|
|
ANY,
|
|
|
|
FIXED_REGISTER,
|
|
|
|
FIXED_DOUBLE_REGISTER,
|
|
|
|
MUST_HAVE_REGISTER,
|
|
|
|
WRITABLE_REGISTER,
|
2012-01-24 02:13:28 +00:00
|
|
|
SAME_AS_FIRST_INPUT
|
2011-01-19 13:55:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// Lifetime of operand inside the instruction.
|
|
|
|
enum Lifetime {
|
|
|
|
// USED_AT_START operand is guaranteed to be live only at
|
|
|
|
// instruction start. Register allocator is free to assign the same register
|
|
|
|
// to some other operand used inside instruction (i.e. temporary or
|
|
|
|
// output).
|
|
|
|
USED_AT_START,
|
|
|
|
|
|
|
|
// USED_AT_END operand is treated as live until the end of
|
|
|
|
// instruction. This means that register allocator will not reuse it's
|
|
|
|
// register for any other operand inside instruction.
|
|
|
|
USED_AT_END
|
|
|
|
};
|
|
|
|
|
2013-05-02 09:51:07 +00:00
|
|
|
explicit LUnallocated(ExtendedPolicy policy) : LOperand(UNALLOCATED, 0) {
|
|
|
|
value_ |= BasicPolicyField::encode(EXTENDED_POLICY);
|
|
|
|
value_ |= ExtendedPolicyField::encode(policy);
|
|
|
|
value_ |= LifetimeField::encode(USED_AT_END);
|
2011-01-19 13:55:56 +00:00
|
|
|
}
|
|
|
|
|
2013-05-02 09:51:07 +00:00
|
|
|
LUnallocated(BasicPolicy policy, int index) : LOperand(UNALLOCATED, 0) {
|
|
|
|
ASSERT(policy == FIXED_SLOT);
|
|
|
|
value_ |= BasicPolicyField::encode(policy);
|
|
|
|
value_ |= index << FixedSlotIndexField::kShift;
|
|
|
|
ASSERT(this->fixed_slot_index() == index);
|
2011-01-19 13:55:56 +00:00
|
|
|
}
|
|
|
|
|
2013-05-02 09:51:07 +00:00
|
|
|
LUnallocated(ExtendedPolicy policy, int index) : LOperand(UNALLOCATED, 0) {
|
|
|
|
ASSERT(policy == FIXED_REGISTER || policy == FIXED_DOUBLE_REGISTER);
|
|
|
|
value_ |= BasicPolicyField::encode(EXTENDED_POLICY);
|
|
|
|
value_ |= ExtendedPolicyField::encode(policy);
|
|
|
|
value_ |= LifetimeField::encode(USED_AT_END);
|
|
|
|
value_ |= FixedRegisterField::encode(index);
|
2011-01-19 13:55:56 +00:00
|
|
|
}
|
|
|
|
|
2013-05-02 09:51:07 +00:00
|
|
|
LUnallocated(ExtendedPolicy policy, Lifetime lifetime)
|
|
|
|
: LOperand(UNALLOCATED, 0) {
|
|
|
|
value_ |= BasicPolicyField::encode(EXTENDED_POLICY);
|
|
|
|
value_ |= ExtendedPolicyField::encode(policy);
|
|
|
|
value_ |= LifetimeField::encode(lifetime);
|
|
|
|
}
|
2011-01-19 13:55:56 +00:00
|
|
|
|
2013-05-02 09:51:07 +00:00
|
|
|
LUnallocated* CopyUnconstrained(Zone* zone) {
|
|
|
|
LUnallocated* result = new(zone) LUnallocated(ANY);
|
|
|
|
result->set_virtual_register(virtual_register());
|
|
|
|
return result;
|
|
|
|
}
|
2011-01-19 13:55:56 +00:00
|
|
|
|
2013-05-02 09:51:07 +00:00
|
|
|
static LUnallocated* cast(LOperand* op) {
|
|
|
|
ASSERT(op->IsUnallocated());
|
|
|
|
return reinterpret_cast<LUnallocated*>(op);
|
|
|
|
}
|
2011-01-19 13:55:56 +00:00
|
|
|
|
2013-05-02 09:51:07 +00:00
|
|
|
// The encoding used for LUnallocated operands depends on the policy that is
|
|
|
|
// stored within the operand. The FIXED_SLOT policy uses a compact encoding
|
|
|
|
// because it accommodates a larger pay-load.
|
|
|
|
//
|
|
|
|
// For FIXED_SLOT policy:
|
|
|
|
// +------------------------------------------+
|
|
|
|
// | slot_index | vreg | 0 | 001 |
|
|
|
|
// +------------------------------------------+
|
|
|
|
//
|
|
|
|
// For all other (extended) policies:
|
|
|
|
// +------------------------------------------+
|
|
|
|
// | reg_index | L | PPP | vreg | 1 | 001 | L ... Lifetime
|
|
|
|
// +------------------------------------------+ P ... Policy
|
|
|
|
//
|
|
|
|
// The slot index is a signed value which requires us to decode it manually
|
|
|
|
// instead of using the BitField utility class.
|
|
|
|
|
|
|
|
// The superclass has a KindField.
|
|
|
|
STATIC_ASSERT(kKindFieldWidth == 3);
|
|
|
|
|
|
|
|
// BitFields for all unallocated operands.
|
|
|
|
class BasicPolicyField : public BitField<BasicPolicy, 3, 1> {};
|
2013-05-02 11:22:32 +00:00
|
|
|
class VirtualRegisterField : public BitField<unsigned, 4, 18> {};
|
2013-05-02 09:51:07 +00:00
|
|
|
|
|
|
|
// BitFields specific to BasicPolicy::FIXED_SLOT.
|
|
|
|
class FixedSlotIndexField : public BitField<int, 22, 10> {};
|
|
|
|
|
|
|
|
// BitFields specific to BasicPolicy::EXTENDED_POLICY.
|
|
|
|
class ExtendedPolicyField : public BitField<ExtendedPolicy, 22, 3> {};
|
|
|
|
class LifetimeField : public BitField<Lifetime, 25, 1> {};
|
|
|
|
class FixedRegisterField : public BitField<int, 26, 6> {};
|
|
|
|
|
|
|
|
static const int kMaxVirtualRegisters = VirtualRegisterField::kMax + 1;
|
|
|
|
static const int kFixedSlotIndexWidth = FixedSlotIndexField::kSize;
|
|
|
|
static const int kMaxFixedSlotIndex = (1 << (kFixedSlotIndexWidth - 1)) - 1;
|
|
|
|
static const int kMinFixedSlotIndex = -(1 << (kFixedSlotIndexWidth - 1));
|
|
|
|
|
|
|
|
// Predicates for the operand policy.
|
2011-01-19 13:55:56 +00:00
|
|
|
bool HasAnyPolicy() const {
|
2013-05-02 09:51:07 +00:00
|
|
|
return basic_policy() == EXTENDED_POLICY &&
|
|
|
|
extended_policy() == ANY;
|
2011-01-19 13:55:56 +00:00
|
|
|
}
|
|
|
|
bool HasFixedPolicy() const {
|
2013-05-02 09:51:07 +00:00
|
|
|
return basic_policy() == FIXED_SLOT ||
|
|
|
|
extended_policy() == FIXED_REGISTER ||
|
|
|
|
extended_policy() == FIXED_DOUBLE_REGISTER;
|
2011-01-19 13:55:56 +00:00
|
|
|
}
|
|
|
|
bool HasRegisterPolicy() const {
|
2013-05-02 09:51:07 +00:00
|
|
|
return basic_policy() == EXTENDED_POLICY && (
|
|
|
|
extended_policy() == WRITABLE_REGISTER ||
|
|
|
|
extended_policy() == MUST_HAVE_REGISTER);
|
2011-01-19 13:55:56 +00:00
|
|
|
}
|
|
|
|
bool HasSameAsInputPolicy() const {
|
2013-05-02 09:51:07 +00:00
|
|
|
return basic_policy() == EXTENDED_POLICY &&
|
|
|
|
extended_policy() == SAME_AS_FIRST_INPUT;
|
|
|
|
}
|
|
|
|
bool HasFixedSlotPolicy() const {
|
|
|
|
return basic_policy() == FIXED_SLOT;
|
|
|
|
}
|
|
|
|
bool HasFixedRegisterPolicy() const {
|
|
|
|
return basic_policy() == EXTENDED_POLICY &&
|
|
|
|
extended_policy() == FIXED_REGISTER;
|
2011-01-19 13:55:56 +00:00
|
|
|
}
|
2013-05-02 09:51:07 +00:00
|
|
|
bool HasFixedDoubleRegisterPolicy() const {
|
|
|
|
return basic_policy() == EXTENDED_POLICY &&
|
|
|
|
extended_policy() == FIXED_DOUBLE_REGISTER;
|
2011-01-19 13:55:56 +00:00
|
|
|
}
|
2013-05-02 09:51:07 +00:00
|
|
|
bool HasWritableRegisterPolicy() const {
|
|
|
|
return basic_policy() == EXTENDED_POLICY &&
|
|
|
|
extended_policy() == WRITABLE_REGISTER;
|
2011-01-19 13:55:56 +00:00
|
|
|
}
|
|
|
|
|
2013-05-02 09:51:07 +00:00
|
|
|
// [basic_policy]: Distinguish between FIXED_SLOT and all other policies.
|
|
|
|
BasicPolicy basic_policy() const {
|
|
|
|
return BasicPolicyField::decode(value_);
|
2011-01-19 13:55:56 +00:00
|
|
|
}
|
|
|
|
|
2013-05-02 09:51:07 +00:00
|
|
|
// [extended_policy]: Only for non-FIXED_SLOT. The finer-grained policy.
|
|
|
|
ExtendedPolicy extended_policy() const {
|
|
|
|
ASSERT(basic_policy() == EXTENDED_POLICY);
|
|
|
|
return ExtendedPolicyField::decode(value_);
|
2011-01-19 13:55:56 +00:00
|
|
|
}
|
|
|
|
|
2013-05-02 09:51:07 +00:00
|
|
|
// [fixed_slot_index]: Only for FIXED_SLOT.
|
|
|
|
int fixed_slot_index() const {
|
|
|
|
ASSERT(HasFixedSlotPolicy());
|
|
|
|
return static_cast<int>(value_) >> FixedSlotIndexField::kShift;
|
2011-01-19 13:55:56 +00:00
|
|
|
}
|
|
|
|
|
2013-05-02 09:51:07 +00:00
|
|
|
// [fixed_register_index]: Only for FIXED_REGISTER or FIXED_DOUBLE_REGISTER.
|
|
|
|
int fixed_register_index() const {
|
|
|
|
ASSERT(HasFixedRegisterPolicy() || HasFixedDoubleRegisterPolicy());
|
|
|
|
return FixedRegisterField::decode(value_);
|
2011-01-19 13:55:56 +00:00
|
|
|
}
|
|
|
|
|
2013-05-02 09:51:07 +00:00
|
|
|
// [virtual_register]: The virtual register ID for this operand.
|
|
|
|
int virtual_register() const {
|
|
|
|
return VirtualRegisterField::decode(value_);
|
|
|
|
}
|
|
|
|
void set_virtual_register(unsigned id) {
|
|
|
|
value_ = VirtualRegisterField::update(value_, id);
|
2011-01-19 13:55:56 +00:00
|
|
|
}
|
|
|
|
|
2013-05-02 09:51:07 +00:00
|
|
|
// [lifetime]: Only for non-FIXED_SLOT.
|
|
|
|
bool IsUsedAtStart() {
|
|
|
|
ASSERT(basic_policy() == EXTENDED_POLICY);
|
|
|
|
return LifetimeField::decode(value_) == USED_AT_START;
|
2011-01-19 13:55:56 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class LMoveOperands BASE_EMBEDDED {
|
|
|
|
public:
|
|
|
|
LMoveOperands(LOperand* source, LOperand* destination)
|
|
|
|
: source_(source), destination_(destination) {
|
|
|
|
}
|
|
|
|
|
|
|
|
LOperand* source() const { return source_; }
|
|
|
|
void set_source(LOperand* operand) { source_ = operand; }
|
|
|
|
|
|
|
|
LOperand* destination() const { return destination_; }
|
|
|
|
void set_destination(LOperand* operand) { destination_ = operand; }
|
|
|
|
|
|
|
|
// The gap resolver marks moves as "in-progress" by clearing the
|
|
|
|
// destination (but not the source).
|
|
|
|
bool IsPending() const {
|
|
|
|
return destination_ == NULL && source_ != NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
// True if this move a move into the given destination operand.
|
|
|
|
bool Blocks(LOperand* operand) const {
|
|
|
|
return !IsEliminated() && source()->Equals(operand);
|
|
|
|
}
|
|
|
|
|
|
|
|
// A move is redundant if it's been eliminated, if its source and
|
|
|
|
// destination are the same, or if its destination is unneeded.
|
|
|
|
bool IsRedundant() const {
|
|
|
|
return IsEliminated() || source_->Equals(destination_) || IsIgnored();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool IsIgnored() const {
|
2012-01-24 02:13:28 +00:00
|
|
|
return destination_ != NULL && destination_->IsIgnored();
|
2011-01-19 13:55:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// We clear both operands to indicate move that's been eliminated.
|
|
|
|
void Eliminate() { source_ = destination_ = NULL; }
|
|
|
|
bool IsEliminated() const {
|
|
|
|
ASSERT(source_ != NULL || destination_ == NULL);
|
|
|
|
return source_ == NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
LOperand* source_;
|
|
|
|
LOperand* destination_;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class LConstantOperand: public LOperand {
|
|
|
|
public:
|
2012-06-11 12:42:31 +00:00
|
|
|
static LConstantOperand* Create(int index, Zone* zone) {
|
2011-01-19 13:55:56 +00:00
|
|
|
ASSERT(index >= 0);
|
|
|
|
if (index < kNumCachedOperands) return &cache[index];
|
2012-06-11 12:42:31 +00:00
|
|
|
return new(zone) LConstantOperand(index);
|
2011-01-19 13:55:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static LConstantOperand* cast(LOperand* op) {
|
|
|
|
ASSERT(op->IsConstantOperand());
|
|
|
|
return reinterpret_cast<LConstantOperand*>(op);
|
|
|
|
}
|
|
|
|
|
2012-01-13 13:09:52 +00:00
|
|
|
static void SetUpCache();
|
2012-03-28 13:12:00 +00:00
|
|
|
static void TearDownCache();
|
2011-01-19 13:55:56 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
static const int kNumCachedOperands = 128;
|
2012-03-12 13:56:56 +00:00
|
|
|
static LConstantOperand* cache;
|
2011-01-19 13:55:56 +00:00
|
|
|
|
|
|
|
LConstantOperand() : LOperand() { }
|
|
|
|
explicit LConstantOperand(int index) : LOperand(CONSTANT_OPERAND, index) { }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class LArgument: public LOperand {
|
|
|
|
public:
|
|
|
|
explicit LArgument(int index) : LOperand(ARGUMENT, index) { }
|
|
|
|
|
|
|
|
static LArgument* cast(LOperand* op) {
|
|
|
|
ASSERT(op->IsArgument());
|
|
|
|
return reinterpret_cast<LArgument*>(op);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class LStackSlot: public LOperand {
|
|
|
|
public:
|
2012-06-11 12:42:31 +00:00
|
|
|
static LStackSlot* Create(int index, Zone* zone) {
|
2011-01-19 13:55:56 +00:00
|
|
|
ASSERT(index >= 0);
|
|
|
|
if (index < kNumCachedOperands) return &cache[index];
|
2012-06-11 12:42:31 +00:00
|
|
|
return new(zone) LStackSlot(index);
|
2011-01-19 13:55:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static LStackSlot* cast(LOperand* op) {
|
|
|
|
ASSERT(op->IsStackSlot());
|
|
|
|
return reinterpret_cast<LStackSlot*>(op);
|
|
|
|
}
|
|
|
|
|
2012-01-13 13:09:52 +00:00
|
|
|
static void SetUpCache();
|
2012-03-28 13:12:00 +00:00
|
|
|
static void TearDownCache();
|
2011-01-19 13:55:56 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
static const int kNumCachedOperands = 128;
|
2012-03-12 13:56:56 +00:00
|
|
|
static LStackSlot* cache;
|
2011-01-19 13:55:56 +00:00
|
|
|
|
|
|
|
LStackSlot() : LOperand() { }
|
|
|
|
explicit LStackSlot(int index) : LOperand(STACK_SLOT, index) { }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class LDoubleStackSlot: public LOperand {
|
|
|
|
public:
|
2012-06-11 12:42:31 +00:00
|
|
|
static LDoubleStackSlot* Create(int index, Zone* zone) {
|
2011-01-19 13:55:56 +00:00
|
|
|
ASSERT(index >= 0);
|
|
|
|
if (index < kNumCachedOperands) return &cache[index];
|
2012-06-11 12:42:31 +00:00
|
|
|
return new(zone) LDoubleStackSlot(index);
|
2011-01-19 13:55:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static LDoubleStackSlot* cast(LOperand* op) {
|
|
|
|
ASSERT(op->IsStackSlot());
|
|
|
|
return reinterpret_cast<LDoubleStackSlot*>(op);
|
|
|
|
}
|
|
|
|
|
2012-01-13 13:09:52 +00:00
|
|
|
static void SetUpCache();
|
2012-03-28 13:12:00 +00:00
|
|
|
static void TearDownCache();
|
2011-01-19 13:55:56 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
static const int kNumCachedOperands = 128;
|
2012-03-12 13:56:56 +00:00
|
|
|
static LDoubleStackSlot* cache;
|
2011-01-19 13:55:56 +00:00
|
|
|
|
|
|
|
LDoubleStackSlot() : LOperand() { }
|
|
|
|
explicit LDoubleStackSlot(int index) : LOperand(DOUBLE_STACK_SLOT, index) { }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class LRegister: public LOperand {
|
|
|
|
public:
|
2012-06-11 12:42:31 +00:00
|
|
|
static LRegister* Create(int index, Zone* zone) {
|
2011-01-19 13:55:56 +00:00
|
|
|
ASSERT(index >= 0);
|
|
|
|
if (index < kNumCachedOperands) return &cache[index];
|
2012-06-11 12:42:31 +00:00
|
|
|
return new(zone) LRegister(index);
|
2011-01-19 13:55:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static LRegister* cast(LOperand* op) {
|
|
|
|
ASSERT(op->IsRegister());
|
|
|
|
return reinterpret_cast<LRegister*>(op);
|
|
|
|
}
|
|
|
|
|
2012-01-13 13:09:52 +00:00
|
|
|
static void SetUpCache();
|
2012-03-28 13:12:00 +00:00
|
|
|
static void TearDownCache();
|
2011-01-19 13:55:56 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
static const int kNumCachedOperands = 16;
|
2012-03-12 13:56:56 +00:00
|
|
|
static LRegister* cache;
|
2011-01-19 13:55:56 +00:00
|
|
|
|
|
|
|
LRegister() : LOperand() { }
|
|
|
|
explicit LRegister(int index) : LOperand(REGISTER, index) { }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class LDoubleRegister: public LOperand {
|
|
|
|
public:
|
2012-06-11 12:42:31 +00:00
|
|
|
static LDoubleRegister* Create(int index, Zone* zone) {
|
2011-01-19 13:55:56 +00:00
|
|
|
ASSERT(index >= 0);
|
|
|
|
if (index < kNumCachedOperands) return &cache[index];
|
2012-06-11 12:42:31 +00:00
|
|
|
return new(zone) LDoubleRegister(index);
|
2011-01-19 13:55:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static LDoubleRegister* cast(LOperand* op) {
|
|
|
|
ASSERT(op->IsDoubleRegister());
|
|
|
|
return reinterpret_cast<LDoubleRegister*>(op);
|
|
|
|
}
|
|
|
|
|
2012-01-13 13:09:52 +00:00
|
|
|
static void SetUpCache();
|
2012-03-28 13:12:00 +00:00
|
|
|
static void TearDownCache();
|
2011-01-19 13:55:56 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
static const int kNumCachedOperands = 16;
|
2012-03-12 13:56:56 +00:00
|
|
|
static LDoubleRegister* cache;
|
2011-01-19 13:55:56 +00:00
|
|
|
|
|
|
|
LDoubleRegister() : LOperand() { }
|
|
|
|
explicit LDoubleRegister(int index) : LOperand(DOUBLE_REGISTER, index) { }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2011-01-10 11:31:21 +00:00
|
|
|
class LParallelMove : public ZoneObject {
|
|
|
|
public:
|
2012-06-11 12:42:31 +00:00
|
|
|
explicit LParallelMove(Zone* zone) : move_operands_(4, zone) { }
|
2011-01-10 11:31:21 +00:00
|
|
|
|
2012-06-11 12:42:31 +00:00
|
|
|
void AddMove(LOperand* from, LOperand* to, Zone* zone) {
|
|
|
|
move_operands_.Add(LMoveOperands(from, to), zone);
|
2011-01-10 11:31:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool IsRedundant() const;
|
|
|
|
|
|
|
|
const ZoneList<LMoveOperands>* move_operands() const {
|
|
|
|
return &move_operands_;
|
|
|
|
}
|
|
|
|
|
|
|
|
void PrintDataTo(StringStream* stream) const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
ZoneList<LMoveOperands> move_operands_;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2011-01-11 15:51:08 +00:00
|
|
|
class LPointerMap: public ZoneObject {
|
|
|
|
public:
|
2012-06-11 12:42:31 +00:00
|
|
|
explicit LPointerMap(int position, Zone* zone)
|
|
|
|
: pointer_operands_(8, zone),
|
|
|
|
untagged_operands_(0, zone),
|
2011-09-19 18:36:47 +00:00
|
|
|
position_(position),
|
|
|
|
lithium_position_(-1) { }
|
|
|
|
|
|
|
|
const ZoneList<LOperand*>* GetNormalizedOperands() {
|
|
|
|
for (int i = 0; i < untagged_operands_.length(); ++i) {
|
|
|
|
RemovePointer(untagged_operands_[i]);
|
|
|
|
}
|
|
|
|
untagged_operands_.Clear();
|
|
|
|
return &pointer_operands_;
|
|
|
|
}
|
2011-01-11 15:51:08 +00:00
|
|
|
int position() const { return position_; }
|
|
|
|
int lithium_position() const { return lithium_position_; }
|
|
|
|
|
|
|
|
void set_lithium_position(int pos) {
|
|
|
|
ASSERT(lithium_position_ == -1);
|
|
|
|
lithium_position_ = pos;
|
|
|
|
}
|
|
|
|
|
2012-06-11 12:42:31 +00:00
|
|
|
void RecordPointer(LOperand* op, Zone* zone);
|
2011-09-19 18:36:47 +00:00
|
|
|
void RemovePointer(LOperand* op);
|
2012-06-11 12:42:31 +00:00
|
|
|
void RecordUntagged(LOperand* op, Zone* zone);
|
2011-01-11 15:51:08 +00:00
|
|
|
void PrintTo(StringStream* stream);
|
|
|
|
|
|
|
|
private:
|
|
|
|
ZoneList<LOperand*> pointer_operands_;
|
2011-09-19 18:36:47 +00:00
|
|
|
ZoneList<LOperand*> untagged_operands_;
|
2011-01-11 15:51:08 +00:00
|
|
|
int position_;
|
|
|
|
int lithium_position_;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class LEnvironment: public ZoneObject {
|
|
|
|
public:
|
|
|
|
LEnvironment(Handle<JSFunction> closure,
|
2012-02-28 09:05:55 +00:00
|
|
|
FrameType frame_type,
|
2012-08-06 14:13:09 +00:00
|
|
|
BailoutId ast_id,
|
2011-01-11 15:51:08 +00:00
|
|
|
int parameter_count,
|
|
|
|
int argument_count,
|
|
|
|
int value_count,
|
2012-06-04 14:42:58 +00:00
|
|
|
LEnvironment* outer,
|
2012-09-12 12:28:42 +00:00
|
|
|
HEnterInlined* entry,
|
2012-06-04 14:42:58 +00:00
|
|
|
Zone* zone)
|
2011-01-11 15:51:08 +00:00
|
|
|
: closure_(closure),
|
2012-02-28 09:05:55 +00:00
|
|
|
frame_type_(frame_type),
|
2011-01-11 15:51:08 +00:00
|
|
|
arguments_stack_height_(argument_count),
|
|
|
|
deoptimization_index_(Safepoint::kNoDeoptimizationIndex),
|
|
|
|
translation_index_(-1),
|
|
|
|
ast_id_(ast_id),
|
2013-06-12 14:22:49 +00:00
|
|
|
translation_size_(value_count),
|
2011-01-11 15:51:08 +00:00
|
|
|
parameter_count_(parameter_count),
|
2011-11-16 08:44:30 +00:00
|
|
|
pc_offset_(-1),
|
2012-06-11 12:42:31 +00:00
|
|
|
values_(value_count, zone),
|
2012-06-20 08:58:41 +00:00
|
|
|
is_tagged_(value_count, zone),
|
2012-08-22 15:44:17 +00:00
|
|
|
is_uint32_(value_count, zone),
|
2013-08-07 11:24:14 +00:00
|
|
|
object_mapping_(0, zone),
|
2012-06-04 14:42:58 +00:00
|
|
|
outer_(outer),
|
2012-09-12 12:28:42 +00:00
|
|
|
entry_(entry),
|
2012-06-04 14:42:58 +00:00
|
|
|
zone_(zone) { }
|
2011-01-11 15:51:08 +00:00
|
|
|
|
|
|
|
Handle<JSFunction> closure() const { return closure_; }
|
2012-02-28 09:05:55 +00:00
|
|
|
FrameType frame_type() const { return frame_type_; }
|
2011-01-11 15:51:08 +00:00
|
|
|
int arguments_stack_height() const { return arguments_stack_height_; }
|
|
|
|
int deoptimization_index() const { return deoptimization_index_; }
|
|
|
|
int translation_index() const { return translation_index_; }
|
2012-08-06 14:13:09 +00:00
|
|
|
BailoutId ast_id() const { return ast_id_; }
|
2013-06-12 14:22:49 +00:00
|
|
|
int translation_size() const { return translation_size_; }
|
2011-01-11 15:51:08 +00:00
|
|
|
int parameter_count() const { return parameter_count_; }
|
2011-11-16 08:44:30 +00:00
|
|
|
int pc_offset() const { return pc_offset_; }
|
2011-01-11 15:51:08 +00:00
|
|
|
const ZoneList<LOperand*>* values() const { return &values_; }
|
|
|
|
LEnvironment* outer() const { return outer_; }
|
2012-09-12 12:28:42 +00:00
|
|
|
HEnterInlined* entry() { return entry_; }
|
2013-06-12 14:22:49 +00:00
|
|
|
Zone* zone() const { return zone_; }
|
2011-01-11 15:51:08 +00:00
|
|
|
|
2012-08-22 15:44:17 +00:00
|
|
|
void AddValue(LOperand* operand,
|
|
|
|
Representation representation,
|
|
|
|
bool is_uint32) {
|
2012-06-11 12:42:31 +00:00
|
|
|
values_.Add(operand, zone());
|
2013-05-23 08:32:07 +00:00
|
|
|
if (representation.IsSmiOrTagged()) {
|
2012-08-22 15:44:17 +00:00
|
|
|
ASSERT(!is_uint32);
|
2013-06-12 14:22:49 +00:00
|
|
|
is_tagged_.Add(values_.length() - 1, zone());
|
2012-01-31 17:19:19 +00:00
|
|
|
}
|
2012-08-22 15:44:17 +00:00
|
|
|
|
|
|
|
if (is_uint32) {
|
2013-06-12 14:22:49 +00:00
|
|
|
is_uint32_.Add(values_.length() - 1, zone());
|
2012-08-22 15:44:17 +00:00
|
|
|
}
|
2011-01-11 15:51:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool HasTaggedValueAt(int index) const {
|
2012-01-31 17:19:19 +00:00
|
|
|
return is_tagged_.Contains(index);
|
2011-01-11 15:51:08 +00:00
|
|
|
}
|
|
|
|
|
2012-08-22 15:44:17 +00:00
|
|
|
bool HasUint32ValueAt(int index) const {
|
|
|
|
return is_uint32_.Contains(index);
|
|
|
|
}
|
|
|
|
|
2013-08-07 11:24:14 +00:00
|
|
|
void AddNewObject(int length, bool is_arguments) {
|
|
|
|
uint32_t encoded = LengthOrDupeField::encode(length) |
|
|
|
|
IsArgumentsField::encode(is_arguments) |
|
|
|
|
IsDuplicateField::encode(false);
|
|
|
|
object_mapping_.Add(encoded, zone());
|
|
|
|
}
|
|
|
|
|
|
|
|
void AddDuplicateObject(int dupe_of) {
|
|
|
|
uint32_t encoded = LengthOrDupeField::encode(dupe_of) |
|
|
|
|
IsDuplicateField::encode(true);
|
|
|
|
object_mapping_.Add(encoded, zone());
|
|
|
|
}
|
|
|
|
|
|
|
|
int ObjectDuplicateOfAt(int index) {
|
|
|
|
ASSERT(ObjectIsDuplicateAt(index));
|
|
|
|
return LengthOrDupeField::decode(object_mapping_[index]);
|
|
|
|
}
|
|
|
|
|
|
|
|
int ObjectLengthAt(int index) {
|
|
|
|
ASSERT(!ObjectIsDuplicateAt(index));
|
|
|
|
return LengthOrDupeField::decode(object_mapping_[index]);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ObjectIsArgumentsAt(int index) {
|
|
|
|
ASSERT(!ObjectIsDuplicateAt(index));
|
|
|
|
return IsArgumentsField::decode(object_mapping_[index]);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ObjectIsDuplicateAt(int index) {
|
|
|
|
return IsDuplicateField::decode(object_mapping_[index]);
|
|
|
|
}
|
|
|
|
|
2011-11-16 08:44:30 +00:00
|
|
|
void Register(int deoptimization_index,
|
|
|
|
int translation_index,
|
|
|
|
int pc_offset) {
|
2011-01-11 15:51:08 +00:00
|
|
|
ASSERT(!HasBeenRegistered());
|
|
|
|
deoptimization_index_ = deoptimization_index;
|
|
|
|
translation_index_ = translation_index;
|
2011-11-16 08:44:30 +00:00
|
|
|
pc_offset_ = pc_offset;
|
2011-01-11 15:51:08 +00:00
|
|
|
}
|
|
|
|
bool HasBeenRegistered() const {
|
|
|
|
return deoptimization_index_ != Safepoint::kNoDeoptimizationIndex;
|
|
|
|
}
|
|
|
|
|
|
|
|
void PrintTo(StringStream* stream);
|
|
|
|
|
2013-08-07 11:24:14 +00:00
|
|
|
// Marker value indicating a de-materialized object.
|
|
|
|
static LOperand* materialization_marker() { return NULL; }
|
|
|
|
|
|
|
|
// Encoding used for the object_mapping map below.
|
|
|
|
class LengthOrDupeField : public BitField<int, 0, 30> { };
|
|
|
|
class IsArgumentsField : public BitField<bool, 30, 1> { };
|
|
|
|
class IsDuplicateField : public BitField<bool, 31, 1> { };
|
|
|
|
|
2011-01-11 15:51:08 +00:00
|
|
|
private:
|
|
|
|
Handle<JSFunction> closure_;
|
2012-02-28 09:05:55 +00:00
|
|
|
FrameType frame_type_;
|
2011-01-11 15:51:08 +00:00
|
|
|
int arguments_stack_height_;
|
|
|
|
int deoptimization_index_;
|
|
|
|
int translation_index_;
|
2012-08-06 14:13:09 +00:00
|
|
|
BailoutId ast_id_;
|
2013-06-12 14:22:49 +00:00
|
|
|
int translation_size_;
|
2011-01-11 15:51:08 +00:00
|
|
|
int parameter_count_;
|
2011-11-16 08:44:30 +00:00
|
|
|
int pc_offset_;
|
2013-06-12 14:22:49 +00:00
|
|
|
|
|
|
|
// Value array: [parameters] [locals] [expression stack] [de-materialized].
|
|
|
|
// |>--------- translation_size ---------<|
|
2011-01-11 15:51:08 +00:00
|
|
|
ZoneList<LOperand*> values_;
|
2013-06-12 14:22:49 +00:00
|
|
|
GrowableBitVector is_tagged_;
|
|
|
|
GrowableBitVector is_uint32_;
|
2013-08-07 11:24:14 +00:00
|
|
|
|
|
|
|
// Map with encoded information about materialization_marker operands.
|
|
|
|
ZoneList<uint32_t> object_mapping_;
|
|
|
|
|
2011-01-11 15:51:08 +00:00
|
|
|
LEnvironment* outer_;
|
2012-09-12 12:28:42 +00:00
|
|
|
HEnterInlined* entry_;
|
2012-06-04 14:42:58 +00:00
|
|
|
Zone* zone_;
|
2011-01-11 15:51:08 +00:00
|
|
|
};
|
|
|
|
|
2011-02-04 13:28:23 +00:00
|
|
|
|
|
|
|
// Iterates over the non-null, non-constant operands in an environment.
|
|
|
|
class ShallowIterator BASE_EMBEDDED {
|
|
|
|
public:
|
|
|
|
explicit ShallowIterator(LEnvironment* env)
|
|
|
|
: env_(env),
|
|
|
|
limit_(env != NULL ? env->values()->length() : 0),
|
|
|
|
current_(0) {
|
2011-06-06 11:30:17 +00:00
|
|
|
SkipUninteresting();
|
2011-02-04 13:28:23 +00:00
|
|
|
}
|
|
|
|
|
2011-06-06 11:30:17 +00:00
|
|
|
bool Done() { return current_ >= limit_; }
|
2011-02-04 13:28:23 +00:00
|
|
|
|
2011-06-06 11:30:17 +00:00
|
|
|
LOperand* Current() {
|
|
|
|
ASSERT(!Done());
|
2012-12-28 16:25:38 +00:00
|
|
|
ASSERT(env_->values()->at(current_) != NULL);
|
2011-02-04 13:28:23 +00:00
|
|
|
return env_->values()->at(current_);
|
|
|
|
}
|
|
|
|
|
2011-06-06 11:30:17 +00:00
|
|
|
void Advance() {
|
|
|
|
ASSERT(!Done());
|
|
|
|
++current_;
|
|
|
|
SkipUninteresting();
|
2011-02-04 13:28:23 +00:00
|
|
|
}
|
|
|
|
|
2011-06-06 11:30:17 +00:00
|
|
|
LEnvironment* env() { return env_; }
|
2011-02-04 13:28:23 +00:00
|
|
|
|
|
|
|
private:
|
2011-06-06 11:30:17 +00:00
|
|
|
bool ShouldSkip(LOperand* op) {
|
2011-02-22 06:25:01 +00:00
|
|
|
return op == NULL || op->IsConstantOperand() || op->IsArgument();
|
|
|
|
}
|
|
|
|
|
2011-06-06 11:30:17 +00:00
|
|
|
// Skip until something interesting, beginning with and including current_.
|
|
|
|
void SkipUninteresting() {
|
|
|
|
while (current_ < limit_ && ShouldSkip(env_->values()->at(current_))) {
|
|
|
|
++current_;
|
2011-02-04 13:28:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
LEnvironment* env_;
|
|
|
|
int limit_;
|
|
|
|
int current_;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// Iterator for non-null, non-constant operands incl. outer environments.
|
|
|
|
class DeepIterator BASE_EMBEDDED {
|
|
|
|
public:
|
|
|
|
explicit DeepIterator(LEnvironment* env)
|
2011-06-06 11:30:17 +00:00
|
|
|
: current_iterator_(env) {
|
|
|
|
SkipUninteresting();
|
2011-02-04 13:28:23 +00:00
|
|
|
}
|
|
|
|
|
2011-06-06 11:30:17 +00:00
|
|
|
bool Done() { return current_iterator_.Done(); }
|
|
|
|
|
|
|
|
LOperand* Current() {
|
|
|
|
ASSERT(!current_iterator_.Done());
|
2012-12-28 16:25:38 +00:00
|
|
|
ASSERT(current_iterator_.Current() != NULL);
|
2011-06-06 11:30:17 +00:00
|
|
|
return current_iterator_.Current();
|
2011-02-04 13:28:23 +00:00
|
|
|
}
|
|
|
|
|
2011-06-06 11:30:17 +00:00
|
|
|
void Advance() {
|
|
|
|
current_iterator_.Advance();
|
|
|
|
SkipUninteresting();
|
2011-02-04 13:28:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2011-06-06 11:30:17 +00:00
|
|
|
void SkipUninteresting() {
|
|
|
|
while (current_iterator_.env() != NULL && current_iterator_.Done()) {
|
|
|
|
current_iterator_ = ShallowIterator(current_iterator_.env()->outer());
|
|
|
|
}
|
2011-02-04 13:28:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ShallowIterator current_iterator_;
|
|
|
|
};
|
|
|
|
|
2011-05-10 15:25:17 +00:00
|
|
|
|
2012-07-12 15:29:14 +00:00
|
|
|
class LPlatformChunk;
|
2012-07-11 14:42:17 +00:00
|
|
|
class LGap;
|
|
|
|
class LLabel;
|
|
|
|
|
|
|
|
// Superclass providing data and behavior common to all the
|
2012-07-12 15:29:14 +00:00
|
|
|
// arch-specific LPlatformChunk classes.
|
|
|
|
class LChunk: public ZoneObject {
|
2012-07-11 14:42:17 +00:00
|
|
|
public:
|
2012-07-12 15:29:14 +00:00
|
|
|
static LChunk* NewChunk(HGraph* graph);
|
2012-07-11 14:42:17 +00:00
|
|
|
|
|
|
|
void AddInstruction(LInstruction* instruction, HBasicBlock* block);
|
|
|
|
LConstantOperand* DefineConstantOperand(HConstant* constant);
|
2012-07-11 16:17:02 +00:00
|
|
|
HConstant* LookupConstant(LConstantOperand* operand) const;
|
2012-07-11 14:42:17 +00:00
|
|
|
Representation LookupLiteralRepresentation(LConstantOperand* operand) const;
|
|
|
|
|
|
|
|
int ParameterAt(int index);
|
|
|
|
int GetParameterStackSlot(int index) const;
|
|
|
|
int spill_slot_count() const { return spill_slot_count_; }
|
|
|
|
CompilationInfo* info() const { return info_; }
|
|
|
|
HGraph* graph() const { return graph_; }
|
2013-03-06 10:49:34 +00:00
|
|
|
Isolate* isolate() const { return graph_->isolate(); }
|
2012-07-11 14:42:17 +00:00
|
|
|
const ZoneList<LInstruction*>* instructions() const { return &instructions_; }
|
|
|
|
void AddGapMove(int index, LOperand* from, LOperand* to);
|
|
|
|
LGap* GetGapAt(int index) const;
|
|
|
|
bool IsGapAt(int index) const;
|
|
|
|
int NearestGapPos(int index) const;
|
|
|
|
void MarkEmptyBlocks();
|
|
|
|
const ZoneList<LPointerMap*>* pointer_maps() const { return &pointer_maps_; }
|
|
|
|
LLabel* GetLabel(int block_id) const;
|
|
|
|
int LookupDestination(int block_id) const;
|
|
|
|
Label* GetAssemblyLabel(int block_id) const;
|
|
|
|
|
|
|
|
const ZoneList<Handle<JSFunction> >* inlined_closures() const {
|
|
|
|
return &inlined_closures_;
|
|
|
|
}
|
|
|
|
|
|
|
|
void AddInlinedClosure(Handle<JSFunction> closure) {
|
|
|
|
inlined_closures_.Add(closure, zone());
|
|
|
|
}
|
|
|
|
|
|
|
|
Zone* zone() const { return info_->zone(); }
|
|
|
|
|
2013-04-18 09:50:46 +00:00
|
|
|
Handle<Code> Codegen();
|
2012-07-12 15:10:34 +00:00
|
|
|
|
2013-02-04 12:01:59 +00:00
|
|
|
void set_allocated_double_registers(BitVector* allocated_registers);
|
|
|
|
BitVector* allocated_double_registers() {
|
|
|
|
return allocated_double_registers_;
|
|
|
|
}
|
|
|
|
|
2012-07-11 14:42:17 +00:00
|
|
|
protected:
|
2013-02-04 12:01:59 +00:00
|
|
|
LChunk(CompilationInfo* info, HGraph* graph);
|
2012-07-12 15:10:34 +00:00
|
|
|
|
2012-07-11 14:42:17 +00:00
|
|
|
int spill_slot_count_;
|
|
|
|
|
|
|
|
private:
|
|
|
|
CompilationInfo* info_;
|
|
|
|
HGraph* const graph_;
|
2013-02-04 12:01:59 +00:00
|
|
|
BitVector* allocated_double_registers_;
|
2012-07-11 14:42:17 +00:00
|
|
|
ZoneList<LInstruction*> instructions_;
|
|
|
|
ZoneList<LPointerMap*> pointer_maps_;
|
|
|
|
ZoneList<Handle<JSFunction> > inlined_closures_;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2011-09-09 09:35:57 +00:00
|
|
|
int ElementsKindToShiftSize(ElementsKind elements_kind);
|
2013-02-07 13:15:41 +00:00
|
|
|
int StackSlotOffset(int index);
|
2011-05-10 15:25:17 +00:00
|
|
|
|
2013-02-04 12:01:59 +00:00
|
|
|
enum NumberUntagDMode {
|
|
|
|
NUMBER_CANDIDATE_IS_SMI,
|
2013-05-27 17:33:14 +00:00
|
|
|
NUMBER_CANDIDATE_IS_ANY_TAGGED,
|
|
|
|
NUMBER_CANDIDATE_IS_ANY_TAGGED_CONVERT_HOLE
|
2013-02-04 12:01:59 +00:00
|
|
|
};
|
|
|
|
|
2011-05-10 15:25:17 +00:00
|
|
|
|
2013-06-25 12:22:26 +00:00
|
|
|
class LPhase : public CompilationPhase {
|
|
|
|
public:
|
|
|
|
LPhase(const char* name, LChunk* chunk)
|
2013-06-27 13:03:01 +00:00
|
|
|
: CompilationPhase(name, chunk->info()),
|
2013-06-25 12:22:26 +00:00
|
|
|
chunk_(chunk) { }
|
|
|
|
~LPhase();
|
|
|
|
|
|
|
|
private:
|
|
|
|
LChunk* chunk_;
|
|
|
|
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(LPhase);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2011-01-07 11:49:22 +00:00
|
|
|
} } // namespace v8::internal
|
|
|
|
|
|
|
|
#endif // V8_LITHIUM_H_
|