Index: src/hydrogen-instructions.h |
diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h |
index c9a4bf062d3a7c3c6b4c79d36d4abe4959c6d8e2..35fc363b46efba3057ce880ae6fa916a915f21a7 100644 |
--- a/src/hydrogen-instructions.h |
+++ b/src/hydrogen-instructions.h |
@@ -3447,14 +3447,20 @@ class HStoreGlobalGeneric: public HTemplateInstruction<3> { |
class HLoadContextSlot: public HUnaryOperation { |
public: |
- HLoadContextSlot(HValue* context , int slot_index) |
- : HUnaryOperation(context), slot_index_(slot_index) { |
+ HLoadContextSlot(HValue* context , Variable* var) |
+ : HUnaryOperation(context), var_(var) { |
+ ASSERT(var_->IsContextSlot()); |
set_representation(Representation::Tagged()); |
SetFlag(kUseGVN); |
SetFlag(kDependsOnContextSlots); |
} |
- int slot_index() const { return slot_index_; } |
+ int slot_index() const { return var_->index(); } |
+ Variable* var() const { return var_; } |
+ |
+ bool RequiresHoleCheck() { |
+ return var_->mode() == LET || var_->mode() == CONST_HARMONY; |
+ } |
virtual Representation RequiredInputRepresentation(int index) { |
return Representation::Tagged(); |
@@ -3471,14 +3477,23 @@ class HLoadContextSlot: public HUnaryOperation { |
} |
private: |
- int slot_index_; |
+ Variable* var_; |
}; |
class HStoreContextSlot: public HTemplateInstruction<2> { |
public: |
- HStoreContextSlot(HValue* context, int slot_index, HValue* value) |
- : slot_index_(slot_index) { |
+ // Indicates whether this store to the context is an initializing store or |
+ // a proper assignment. Non-initializing assignments to harmony bindings |
+ // perform a hole check. |
+ enum Mode { |
+ kInitialize, |
+ kAssign |
+ }; |
+ |
+ HStoreContextSlot(HValue* context, Variable* var, Mode mode, HValue* value) |
+ : var_(var), mode_(mode) { |
+ ASSERT(var->IsContextSlot()); |
SetOperandAt(0, context); |
SetOperandAt(1, value); |
SetFlag(kChangesContextSlots); |
@@ -3486,12 +3501,19 @@ class HStoreContextSlot: public HTemplateInstruction<2> { |
HValue* context() { return OperandAt(0); } |
HValue* value() { return OperandAt(1); } |
- int slot_index() const { return slot_index_; } |
+ int slot_index() const { return var_->index(); } |
+ Variable* var() const { return var_; } |
+ Mode mode() const { return mode_; } |
bool NeedsWriteBarrier() { |
return StoringValueNeedsWriteBarrier(value()); |
} |
+ bool RequiresHoleCheck() { |
+ return mode_ == kAssign && |
+ (var_->mode() == LET || var_->mode() == CONST_HARMONY); |
+ } |
+ |
virtual Representation RequiredInputRepresentation(int index) { |
return Representation::Tagged(); |
} |
@@ -3501,7 +3523,8 @@ class HStoreContextSlot: public HTemplateInstruction<2> { |
DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot) |
private: |
- int slot_index_; |
+ Variable* var_; |
+ Mode mode_; |
}; |