Use Unique<Cell> and Unique<PropertyCell> in LoadGlobalCell and StoreGlobalCell.
BUG= R=verwaest@chromium.org Review URL: https://codereview.chromium.org/24072016 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16865 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
05babb3dca
commit
94a0a95b7a
@ -2954,7 +2954,7 @@ void LCodeGen::DoReturn(LReturn* instr) {
|
|||||||
|
|
||||||
void LCodeGen::DoLoadGlobalCell(LLoadGlobalCell* instr) {
|
void LCodeGen::DoLoadGlobalCell(LLoadGlobalCell* instr) {
|
||||||
Register result = ToRegister(instr->result());
|
Register result = ToRegister(instr->result());
|
||||||
__ mov(ip, Operand(Handle<Object>(instr->hydrogen()->cell())));
|
__ mov(ip, Operand(Handle<Object>(instr->hydrogen()->cell().handle())));
|
||||||
__ ldr(result, FieldMemOperand(ip, Cell::kValueOffset));
|
__ ldr(result, FieldMemOperand(ip, Cell::kValueOffset));
|
||||||
if (instr->hydrogen()->RequiresHoleCheck()) {
|
if (instr->hydrogen()->RequiresHoleCheck()) {
|
||||||
__ LoadRoot(ip, Heap::kTheHoleValueRootIndex);
|
__ LoadRoot(ip, Heap::kTheHoleValueRootIndex);
|
||||||
@ -2981,7 +2981,7 @@ void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) {
|
|||||||
Register cell = scratch0();
|
Register cell = scratch0();
|
||||||
|
|
||||||
// Load the cell.
|
// Load the cell.
|
||||||
__ mov(cell, Operand(instr->hydrogen()->cell()));
|
__ mov(cell, Operand(instr->hydrogen()->cell().handle()));
|
||||||
|
|
||||||
// If the cell we are storing to contains the hole it could have
|
// If the cell we are storing to contains the hole it could have
|
||||||
// been deleted from the property dictionary. In that case, we need
|
// been deleted from the property dictionary. In that case, we need
|
||||||
|
@ -3145,7 +3145,7 @@ void HTransitionElementsKind::PrintDataTo(StringStream* stream) {
|
|||||||
|
|
||||||
|
|
||||||
void HLoadGlobalCell::PrintDataTo(StringStream* stream) {
|
void HLoadGlobalCell::PrintDataTo(StringStream* stream) {
|
||||||
stream->Add("[%p]", *cell());
|
stream->Add("[%p]", *cell().handle());
|
||||||
if (!details_.IsDontDelete()) stream->Add(" (deleteable)");
|
if (!details_.IsDontDelete()) stream->Add(" (deleteable)");
|
||||||
if (details_.IsReadOnly()) stream->Add(" (read-only)");
|
if (details_.IsReadOnly()) stream->Add(" (read-only)");
|
||||||
}
|
}
|
||||||
@ -3173,7 +3173,7 @@ void HInnerAllocatedObject::PrintDataTo(StringStream* stream) {
|
|||||||
|
|
||||||
|
|
||||||
void HStoreGlobalCell::PrintDataTo(StringStream* stream) {
|
void HStoreGlobalCell::PrintDataTo(StringStream* stream) {
|
||||||
stream->Add("[%p] = ", *cell());
|
stream->Add("[%p] = ", *cell().handle());
|
||||||
value()->PrintNameTo(stream);
|
value()->PrintNameTo(stream);
|
||||||
if (!details_.IsDontDelete()) stream->Add(" (deleteable)");
|
if (!details_.IsDontDelete()) stream->Add(" (deleteable)");
|
||||||
if (details_.IsReadOnly()) stream->Add(" (read-only)");
|
if (details_.IsReadOnly()) stream->Add(" (read-only)");
|
||||||
|
@ -5122,23 +5122,23 @@ class HUnknownOSRValue V8_FINAL : public HTemplateInstruction<0> {
|
|||||||
class HLoadGlobalCell V8_FINAL : public HTemplateInstruction<0> {
|
class HLoadGlobalCell V8_FINAL : public HTemplateInstruction<0> {
|
||||||
public:
|
public:
|
||||||
HLoadGlobalCell(Handle<Cell> cell, PropertyDetails details)
|
HLoadGlobalCell(Handle<Cell> cell, PropertyDetails details)
|
||||||
: cell_(cell), details_(details), unique_id_() {
|
: cell_(Unique<Cell>::CreateUninitialized(cell)), details_(details) {
|
||||||
set_representation(Representation::Tagged());
|
set_representation(Representation::Tagged());
|
||||||
SetFlag(kUseGVN);
|
SetFlag(kUseGVN);
|
||||||
SetGVNFlag(kDependsOnGlobalVars);
|
SetGVNFlag(kDependsOnGlobalVars);
|
||||||
}
|
}
|
||||||
|
|
||||||
Handle<Cell> cell() const { return cell_; }
|
Unique<Cell> cell() const { return cell_; }
|
||||||
bool RequiresHoleCheck() const;
|
bool RequiresHoleCheck() const;
|
||||||
|
|
||||||
virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
|
virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
|
||||||
|
|
||||||
virtual intptr_t Hashcode() V8_OVERRIDE {
|
virtual intptr_t Hashcode() V8_OVERRIDE {
|
||||||
return unique_id_.Hashcode();
|
return cell_.Hashcode();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void FinalizeUniqueValueId() V8_OVERRIDE {
|
virtual void FinalizeUniqueValueId() V8_OVERRIDE {
|
||||||
unique_id_ = UniqueValueId(cell_);
|
cell_ = Unique<Cell>(cell_.handle());
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
|
virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
|
||||||
@ -5149,16 +5149,14 @@ class HLoadGlobalCell V8_FINAL : public HTemplateInstruction<0> {
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool DataEquals(HValue* other) V8_OVERRIDE {
|
virtual bool DataEquals(HValue* other) V8_OVERRIDE {
|
||||||
HLoadGlobalCell* b = HLoadGlobalCell::cast(other);
|
return cell_ == HLoadGlobalCell::cast(other)->cell_;
|
||||||
return unique_id_ == b->unique_id_;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual bool IsDeletable() const V8_OVERRIDE { return !RequiresHoleCheck(); }
|
virtual bool IsDeletable() const V8_OVERRIDE { return !RequiresHoleCheck(); }
|
||||||
|
|
||||||
Handle<Cell> cell_;
|
Unique<Cell> cell_;
|
||||||
PropertyDetails details_;
|
PropertyDetails details_;
|
||||||
UniqueValueId unique_id_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -5429,7 +5427,7 @@ class HStoreGlobalCell V8_FINAL : public HUnaryOperation {
|
|||||||
DECLARE_INSTRUCTION_FACTORY_P3(HStoreGlobalCell, HValue*,
|
DECLARE_INSTRUCTION_FACTORY_P3(HStoreGlobalCell, HValue*,
|
||||||
Handle<PropertyCell>, PropertyDetails);
|
Handle<PropertyCell>, PropertyDetails);
|
||||||
|
|
||||||
Handle<PropertyCell> cell() const { return cell_; }
|
Unique<PropertyCell> cell() const { return cell_; }
|
||||||
bool RequiresHoleCheck() {
|
bool RequiresHoleCheck() {
|
||||||
return !details_.IsDontDelete() || details_.IsReadOnly();
|
return !details_.IsDontDelete() || details_.IsReadOnly();
|
||||||
}
|
}
|
||||||
@ -5437,6 +5435,10 @@ class HStoreGlobalCell V8_FINAL : public HUnaryOperation {
|
|||||||
return StoringValueNeedsWriteBarrier(value());
|
return StoringValueNeedsWriteBarrier(value());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual void FinalizeUniqueValueId() V8_OVERRIDE {
|
||||||
|
cell_ = Unique<PropertyCell>(cell_.handle());
|
||||||
|
}
|
||||||
|
|
||||||
virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
|
virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
|
||||||
return Representation::Tagged();
|
return Representation::Tagged();
|
||||||
}
|
}
|
||||||
@ -5449,12 +5451,12 @@ class HStoreGlobalCell V8_FINAL : public HUnaryOperation {
|
|||||||
Handle<PropertyCell> cell,
|
Handle<PropertyCell> cell,
|
||||||
PropertyDetails details)
|
PropertyDetails details)
|
||||||
: HUnaryOperation(value),
|
: HUnaryOperation(value),
|
||||||
cell_(cell),
|
cell_(Unique<PropertyCell>::CreateUninitialized(cell)),
|
||||||
details_(details) {
|
details_(details) {
|
||||||
SetGVNFlag(kChangesGlobalVars);
|
SetGVNFlag(kChangesGlobalVars);
|
||||||
}
|
}
|
||||||
|
|
||||||
Handle<PropertyCell> cell_;
|
Unique<PropertyCell> cell_;
|
||||||
PropertyDetails details_;
|
PropertyDetails details_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -3151,7 +3151,7 @@ void LCodeGen::DoReturn(LReturn* instr) {
|
|||||||
|
|
||||||
void LCodeGen::DoLoadGlobalCell(LLoadGlobalCell* instr) {
|
void LCodeGen::DoLoadGlobalCell(LLoadGlobalCell* instr) {
|
||||||
Register result = ToRegister(instr->result());
|
Register result = ToRegister(instr->result());
|
||||||
__ mov(result, Operand::ForCell(instr->hydrogen()->cell()));
|
__ mov(result, Operand::ForCell(instr->hydrogen()->cell().handle()));
|
||||||
if (instr->hydrogen()->RequiresHoleCheck()) {
|
if (instr->hydrogen()->RequiresHoleCheck()) {
|
||||||
__ cmp(result, factory()->the_hole_value());
|
__ cmp(result, factory()->the_hole_value());
|
||||||
DeoptimizeIf(equal, instr->environment());
|
DeoptimizeIf(equal, instr->environment());
|
||||||
@ -3174,7 +3174,7 @@ void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) {
|
|||||||
|
|
||||||
void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) {
|
void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) {
|
||||||
Register value = ToRegister(instr->value());
|
Register value = ToRegister(instr->value());
|
||||||
Handle<PropertyCell> cell_handle = instr->hydrogen()->cell();
|
Handle<PropertyCell> cell_handle = instr->hydrogen()->cell().handle();
|
||||||
|
|
||||||
// If the cell we are storing to contains the hole it could have
|
// If the cell we are storing to contains the hole it could have
|
||||||
// been deleted from the property dictionary. In that case, we need
|
// been deleted from the property dictionary. In that case, we need
|
||||||
|
@ -2805,7 +2805,7 @@ void LCodeGen::DoReturn(LReturn* instr) {
|
|||||||
|
|
||||||
void LCodeGen::DoLoadGlobalCell(LLoadGlobalCell* instr) {
|
void LCodeGen::DoLoadGlobalCell(LLoadGlobalCell* instr) {
|
||||||
Register result = ToRegister(instr->result());
|
Register result = ToRegister(instr->result());
|
||||||
__ li(at, Operand(Handle<Object>(instr->hydrogen()->cell())));
|
__ li(at, Operand(Handle<Object>(instr->hydrogen()->cell().handle())));
|
||||||
__ lw(result, FieldMemOperand(at, Cell::kValueOffset));
|
__ lw(result, FieldMemOperand(at, Cell::kValueOffset));
|
||||||
if (instr->hydrogen()->RequiresHoleCheck()) {
|
if (instr->hydrogen()->RequiresHoleCheck()) {
|
||||||
__ LoadRoot(at, Heap::kTheHoleValueRootIndex);
|
__ LoadRoot(at, Heap::kTheHoleValueRootIndex);
|
||||||
@ -2831,7 +2831,7 @@ void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) {
|
|||||||
Register cell = scratch0();
|
Register cell = scratch0();
|
||||||
|
|
||||||
// Load the cell.
|
// Load the cell.
|
||||||
__ li(cell, Operand(instr->hydrogen()->cell()));
|
__ li(cell, Operand(instr->hydrogen()->cell().handle()));
|
||||||
|
|
||||||
// If the cell we are storing to contains the hole it could have
|
// If the cell we are storing to contains the hole it could have
|
||||||
// been deleted from the property dictionary. In that case, we need
|
// been deleted from the property dictionary. In that case, we need
|
||||||
|
12
src/unique.h
12
src/unique.h
@ -90,34 +90,34 @@ class Unique V8_FINAL {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename U>
|
template <typename U>
|
||||||
bool operator==(const Unique<U>& other) const {
|
inline bool operator==(const Unique<U>& other) const {
|
||||||
ASSERT(IsInitialized() && other.IsInitialized());
|
ASSERT(IsInitialized() && other.IsInitialized());
|
||||||
return raw_address_ == other.raw_address_;
|
return raw_address_ == other.raw_address_;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename U>
|
template <typename U>
|
||||||
bool operator!=(const Unique<U>& other) const {
|
inline bool operator!=(const Unique<U>& other) const {
|
||||||
ASSERT(IsInitialized() && other.IsInitialized());
|
ASSERT(IsInitialized() && other.IsInitialized());
|
||||||
return raw_address_ != other.raw_address_;
|
return raw_address_ != other.raw_address_;
|
||||||
}
|
}
|
||||||
|
|
||||||
intptr_t Hashcode() const {
|
inline intptr_t Hashcode() const {
|
||||||
ASSERT(IsInitialized());
|
ASSERT(IsInitialized());
|
||||||
return reinterpret_cast<intptr_t>(raw_address_);
|
return reinterpret_cast<intptr_t>(raw_address_);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsNull() const {
|
inline bool IsNull() const {
|
||||||
ASSERT(IsInitialized());
|
ASSERT(IsInitialized());
|
||||||
return raw_address_ == NULL;
|
return raw_address_ == NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extract the handle from this Unique in order to dereference it.
|
// Extract the handle from this Unique in order to dereference it.
|
||||||
// WARNING: Only do this if you have access to the heap.
|
// WARNING: Only do this if you have access to the heap.
|
||||||
Handle<T> handle() const {
|
inline Handle<T> handle() const {
|
||||||
return handle_;
|
return handle_;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsInitialized() const {
|
inline bool IsInitialized() const {
|
||||||
return raw_address_ != NULL || handle_.is_null();
|
return raw_address_ != NULL || handle_.is_null();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2668,7 +2668,7 @@ void LCodeGen::DoReturn(LReturn* instr) {
|
|||||||
|
|
||||||
void LCodeGen::DoLoadGlobalCell(LLoadGlobalCell* instr) {
|
void LCodeGen::DoLoadGlobalCell(LLoadGlobalCell* instr) {
|
||||||
Register result = ToRegister(instr->result());
|
Register result = ToRegister(instr->result());
|
||||||
__ LoadGlobalCell(result, instr->hydrogen()->cell());
|
__ LoadGlobalCell(result, instr->hydrogen()->cell().handle());
|
||||||
if (instr->hydrogen()->RequiresHoleCheck()) {
|
if (instr->hydrogen()->RequiresHoleCheck()) {
|
||||||
__ CompareRoot(result, Heap::kTheHoleValueRootIndex);
|
__ CompareRoot(result, Heap::kTheHoleValueRootIndex);
|
||||||
DeoptimizeIf(equal, instr->environment());
|
DeoptimizeIf(equal, instr->environment());
|
||||||
@ -2690,7 +2690,7 @@ void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) {
|
|||||||
|
|
||||||
void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) {
|
void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) {
|
||||||
Register value = ToRegister(instr->value());
|
Register value = ToRegister(instr->value());
|
||||||
Handle<Cell> cell_handle = instr->hydrogen()->cell();
|
Handle<Cell> cell_handle = instr->hydrogen()->cell().handle();
|
||||||
|
|
||||||
// If the cell we are storing to contains the hole it could have
|
// If the cell we are storing to contains the hole it could have
|
||||||
// been deleted from the property dictionary. In that case, we need
|
// been deleted from the property dictionary. In that case, we need
|
||||||
|
Loading…
Reference in New Issue
Block a user