| Index: src/register-allocator.h
|
| ===================================================================
|
| --- src/register-allocator.h (revision 3935)
|
| +++ src/register-allocator.h (working copy)
|
| @@ -29,6 +29,7 @@
|
| #define V8_REGISTER_ALLOCATOR_H_
|
|
|
| #include "macro-assembler.h"
|
| +#include "number-info.h"
|
|
|
| #if V8_TARGET_ARCH_IA32
|
| #include "ia32/register-allocator-ia32.h"
|
| @@ -64,28 +65,21 @@
|
| Result() { invalidate(); }
|
|
|
| // Construct a register Result.
|
| - explicit Result(Register reg);
|
| + explicit Result(Register reg, NumberInfo::Type info = NumberInfo::kUnknown);
|
|
|
| // Construct a Result whose value is a compile-time constant.
|
| explicit Result(Handle<Object> value) {
|
| value_ = TypeField::encode(CONSTANT)
|
| + | NumberInfoField::encode(NumberInfo::kUninitialized)
|
| | DataField::encode(ConstantList()->length());
|
| ConstantList()->Add(value);
|
| }
|
|
|
| // The copy constructor and assignment operators could each create a new
|
| // register reference.
|
| - Result(const Result& other) {
|
| - other.CopyTo(this);
|
| - }
|
| + inline Result(const Result& other);
|
|
|
| - Result& operator=(const Result& other) {
|
| - if (this != &other) {
|
| - Unuse();
|
| - other.CopyTo(this);
|
| - }
|
| - return *this;
|
| - }
|
| + inline Result& operator=(const Result& other);
|
|
|
| inline ~Result();
|
|
|
| @@ -107,6 +101,14 @@
|
|
|
| void invalidate() { value_ = TypeField::encode(INVALID); }
|
|
|
| + NumberInfo::Type number_info();
|
| + void set_number_info(NumberInfo::Type info);
|
| + bool is_number() {
|
| + return (number_info() & NumberInfo::kNumber) != 0;
|
| + }
|
| + bool is_smi() { return number_info() == NumberInfo::kSmi; }
|
| + bool is_heap_number() { return number_info() == NumberInfo::kHeapNumber; }
|
| +
|
| bool is_valid() const { return type() != INVALID; }
|
| bool is_register() const { return type() == REGISTER; }
|
| bool is_constant() const { return type() == CONSTANT; }
|
| @@ -138,7 +140,8 @@
|
| uint32_t value_;
|
|
|
| class TypeField: public BitField<Type, 0, 2> {};
|
| - class DataField: public BitField<uint32_t, 2, 32 - 3> {};
|
| + class NumberInfoField : public BitField<NumberInfo::Type, 2, 3> {};
|
| + class DataField: public BitField<uint32_t, 5, 32 - 5> {};
|
|
|
| inline void CopyTo(Result* destination) const;
|
|
|
| @@ -237,18 +240,18 @@
|
|
|
| // Predicates and accessors for the registers' reference counts.
|
| bool is_used(int num) { return registers_.is_used(num); }
|
| - bool is_used(Register reg) { return registers_.is_used(ToNumber(reg)); }
|
| + inline bool is_used(Register reg);
|
|
|
| int count(int num) { return registers_.count(num); }
|
| - int count(Register reg) { return registers_.count(ToNumber(reg)); }
|
| + inline int count(Register reg);
|
|
|
| // Explicitly record a reference to a register.
|
| void Use(int num) { registers_.Use(num); }
|
| - void Use(Register reg) { registers_.Use(ToNumber(reg)); }
|
| + inline void Use(Register reg);
|
|
|
| // Explicitly record that a register will no longer be used.
|
| void Unuse(int num) { registers_.Unuse(num); }
|
| - void Unuse(Register reg) { registers_.Unuse(ToNumber(reg)); }
|
| + inline void Unuse(Register reg);
|
|
|
| // Reset the register reference counts to free all non-reserved registers.
|
| void Reset() { registers_.Reset(); }
|
|
|