Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Side by Side Diff: src/hydrogen-instructions.h

Issue 24072016: Use Unique<Cell> and Unique<PropertyCell> in LoadGlobalCell and StoreGlobalCell. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/arm/lithium-codegen-arm.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 5104 matching lines...) Expand 10 before | Expand all | Expand 10 after
5115 5115
5116 HEnvironment* environment_; 5116 HEnvironment* environment_;
5117 int index_; 5117 int index_;
5118 HPhi* incoming_value_; 5118 HPhi* incoming_value_;
5119 }; 5119 };
5120 5120
5121 5121
5122 class HLoadGlobalCell V8_FINAL : public HTemplateInstruction<0> { 5122 class HLoadGlobalCell V8_FINAL : public HTemplateInstruction<0> {
5123 public: 5123 public:
5124 HLoadGlobalCell(Handle<Cell> cell, PropertyDetails details) 5124 HLoadGlobalCell(Handle<Cell> cell, PropertyDetails details)
5125 : cell_(cell), details_(details), unique_id_() { 5125 : cell_(Unique<Cell>::CreateUninitialized(cell)), details_(details) {
5126 set_representation(Representation::Tagged()); 5126 set_representation(Representation::Tagged());
5127 SetFlag(kUseGVN); 5127 SetFlag(kUseGVN);
5128 SetGVNFlag(kDependsOnGlobalVars); 5128 SetGVNFlag(kDependsOnGlobalVars);
5129 } 5129 }
5130 5130
5131 Handle<Cell> cell() const { return cell_; } 5131 Unique<Cell> cell() const { return cell_; }
5132 bool RequiresHoleCheck() const; 5132 bool RequiresHoleCheck() const;
5133 5133
5134 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 5134 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
5135 5135
5136 virtual intptr_t Hashcode() V8_OVERRIDE { 5136 virtual intptr_t Hashcode() V8_OVERRIDE {
5137 return unique_id_.Hashcode(); 5137 return cell_.Hashcode();
5138 } 5138 }
5139 5139
5140 virtual void FinalizeUniqueValueId() V8_OVERRIDE { 5140 virtual void FinalizeUniqueValueId() V8_OVERRIDE {
5141 unique_id_ = UniqueValueId(cell_); 5141 cell_ = Unique<Cell>(cell_.handle());
5142 } 5142 }
5143 5143
5144 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 5144 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
5145 return Representation::None(); 5145 return Representation::None();
5146 } 5146 }
5147 5147
5148 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalCell) 5148 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalCell)
5149 5149
5150 protected: 5150 protected:
5151 virtual bool DataEquals(HValue* other) V8_OVERRIDE { 5151 virtual bool DataEquals(HValue* other) V8_OVERRIDE {
5152 HLoadGlobalCell* b = HLoadGlobalCell::cast(other); 5152 return cell_ == HLoadGlobalCell::cast(other)->cell_;
5153 return unique_id_ == b->unique_id_;
5154 } 5153 }
5155 5154
5156 private: 5155 private:
5157 virtual bool IsDeletable() const V8_OVERRIDE { return !RequiresHoleCheck(); } 5156 virtual bool IsDeletable() const V8_OVERRIDE { return !RequiresHoleCheck(); }
5158 5157
5159 Handle<Cell> cell_; 5158 Unique<Cell> cell_;
5160 PropertyDetails details_; 5159 PropertyDetails details_;
5161 UniqueValueId unique_id_;
5162 }; 5160 };
5163 5161
5164 5162
5165 class HLoadGlobalGeneric V8_FINAL : public HTemplateInstruction<2> { 5163 class HLoadGlobalGeneric V8_FINAL : public HTemplateInstruction<2> {
5166 public: 5164 public:
5167 HLoadGlobalGeneric(HValue* context, 5165 HLoadGlobalGeneric(HValue* context,
5168 HValue* global_object, 5166 HValue* global_object,
5169 Handle<Object> name, 5167 Handle<Object> name,
5170 bool for_typeof) 5168 bool for_typeof)
5171 : name_(name), 5169 : name_(name),
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
5422 } 5420 }
5423 return true; 5421 return true;
5424 } 5422 }
5425 5423
5426 5424
5427 class HStoreGlobalCell V8_FINAL : public HUnaryOperation { 5425 class HStoreGlobalCell V8_FINAL : public HUnaryOperation {
5428 public: 5426 public:
5429 DECLARE_INSTRUCTION_FACTORY_P3(HStoreGlobalCell, HValue*, 5427 DECLARE_INSTRUCTION_FACTORY_P3(HStoreGlobalCell, HValue*,
5430 Handle<PropertyCell>, PropertyDetails); 5428 Handle<PropertyCell>, PropertyDetails);
5431 5429
5432 Handle<PropertyCell> cell() const { return cell_; } 5430 Unique<PropertyCell> cell() const { return cell_; }
5433 bool RequiresHoleCheck() { 5431 bool RequiresHoleCheck() {
5434 return !details_.IsDontDelete() || details_.IsReadOnly(); 5432 return !details_.IsDontDelete() || details_.IsReadOnly();
5435 } 5433 }
5436 bool NeedsWriteBarrier() { 5434 bool NeedsWriteBarrier() {
5437 return StoringValueNeedsWriteBarrier(value()); 5435 return StoringValueNeedsWriteBarrier(value());
5438 } 5436 }
5439 5437
5438 virtual void FinalizeUniqueValueId() V8_OVERRIDE {
5439 cell_ = Unique<PropertyCell>(cell_.handle());
5440 }
5441
5440 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 5442 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
5441 return Representation::Tagged(); 5443 return Representation::Tagged();
5442 } 5444 }
5443 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 5445 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
5444 5446
5445 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalCell) 5447 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalCell)
5446 5448
5447 private: 5449 private:
5448 HStoreGlobalCell(HValue* value, 5450 HStoreGlobalCell(HValue* value,
5449 Handle<PropertyCell> cell, 5451 Handle<PropertyCell> cell,
5450 PropertyDetails details) 5452 PropertyDetails details)
5451 : HUnaryOperation(value), 5453 : HUnaryOperation(value),
5452 cell_(cell), 5454 cell_(Unique<PropertyCell>::CreateUninitialized(cell)),
5453 details_(details) { 5455 details_(details) {
5454 SetGVNFlag(kChangesGlobalVars); 5456 SetGVNFlag(kChangesGlobalVars);
5455 } 5457 }
5456 5458
5457 Handle<PropertyCell> cell_; 5459 Unique<PropertyCell> cell_;
5458 PropertyDetails details_; 5460 PropertyDetails details_;
5459 }; 5461 };
5460 5462
5461 5463
5462 class HStoreGlobalGeneric : public HTemplateInstruction<3> { 5464 class HStoreGlobalGeneric : public HTemplateInstruction<3> {
5463 public: 5465 public:
5464 inline static HStoreGlobalGeneric* New(Zone* zone, 5466 inline static HStoreGlobalGeneric* New(Zone* zone,
5465 HValue* context, 5467 HValue* context,
5466 HValue* global_object, 5468 HValue* global_object,
5467 Handle<Object> name, 5469 Handle<Object> name,
(...skipping 1603 matching lines...) Expand 10 before | Expand all | Expand 10 after
7071 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 7073 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
7072 }; 7074 };
7073 7075
7074 7076
7075 #undef DECLARE_INSTRUCTION 7077 #undef DECLARE_INSTRUCTION
7076 #undef DECLARE_CONCRETE_INSTRUCTION 7078 #undef DECLARE_CONCRETE_INSTRUCTION
7077 7079
7078 } } // namespace v8::internal 7080 } } // namespace v8::internal
7079 7081
7080 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 7082 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « src/arm/lithium-codegen-arm.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698