OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_CRANKSHAFT_HYDROGEN_INSTRUCTIONS_H_ | 5 #ifndef V8_CRANKSHAFT_HYDROGEN_INSTRUCTIONS_H_ |
6 #define V8_CRANKSHAFT_HYDROGEN_INSTRUCTIONS_H_ | 6 #define V8_CRANKSHAFT_HYDROGEN_INSTRUCTIONS_H_ |
7 | 7 |
8 #include <cstring> | 8 #include <cstring> |
9 #include <iosfwd> | 9 #include <iosfwd> |
10 | 10 |
(...skipping 5208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5219 | 5219 |
5220 class HLoadContextSlot final : public HUnaryOperation { | 5220 class HLoadContextSlot final : public HUnaryOperation { |
5221 public: | 5221 public: |
5222 enum Mode { | 5222 enum Mode { |
5223 // Perform a normal load of the context slot without checking its value. | 5223 // Perform a normal load of the context slot without checking its value. |
5224 kNoCheck, | 5224 kNoCheck, |
5225 // Load and check the value of the context slot. Deoptimize if it's the | 5225 // Load and check the value of the context slot. Deoptimize if it's the |
5226 // hole value. This is used for checking for loading of uninitialized | 5226 // hole value. This is used for checking for loading of uninitialized |
5227 // harmony bindings where we deoptimize into full-codegen generated code | 5227 // harmony bindings where we deoptimize into full-codegen generated code |
5228 // which will subsequently throw a reference error. | 5228 // which will subsequently throw a reference error. |
5229 kCheckDeoptimize, | 5229 kCheckDeoptimize |
5230 // Load and check the value of the context slot. Return undefined if it's | |
5231 // the hole value. This is used for non-harmony const assignments | |
5232 kCheckReturnUndefined | |
5233 }; | 5230 }; |
5234 | 5231 |
5235 HLoadContextSlot(HValue* context, int slot_index, Mode mode) | 5232 HLoadContextSlot(HValue* context, int slot_index, Mode mode) |
5236 : HUnaryOperation(context), slot_index_(slot_index), mode_(mode) { | 5233 : HUnaryOperation(context), slot_index_(slot_index), mode_(mode) { |
5237 set_representation(Representation::Tagged()); | 5234 set_representation(Representation::Tagged()); |
5238 SetFlag(kUseGVN); | 5235 SetFlag(kUseGVN); |
5239 SetDependsOnFlag(kContextSlots); | 5236 SetDependsOnFlag(kContextSlots); |
5240 } | 5237 } |
5241 | 5238 |
5242 int slot_index() const { return slot_index_; } | 5239 int slot_index() const { return slot_index_; } |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5275 class HStoreContextSlot final : public HTemplateInstruction<2> { | 5272 class HStoreContextSlot final : public HTemplateInstruction<2> { |
5276 public: | 5273 public: |
5277 enum Mode { | 5274 enum Mode { |
5278 // Perform a normal store to the context slot without checking its previous | 5275 // Perform a normal store to the context slot without checking its previous |
5279 // value. | 5276 // value. |
5280 kNoCheck, | 5277 kNoCheck, |
5281 // Check the previous value of the context slot and deoptimize if it's the | 5278 // Check the previous value of the context slot and deoptimize if it's the |
5282 // hole value. This is used for checking for assignments to uninitialized | 5279 // hole value. This is used for checking for assignments to uninitialized |
5283 // harmony bindings where we deoptimize into full-codegen generated code | 5280 // harmony bindings where we deoptimize into full-codegen generated code |
5284 // which will subsequently throw a reference error. | 5281 // which will subsequently throw a reference error. |
5285 kCheckDeoptimize, | 5282 kCheckDeoptimize |
5286 // Check the previous value and ignore assignment if it isn't a hole value | |
5287 kCheckIgnoreAssignment | |
5288 }; | 5283 }; |
5289 | 5284 |
5290 DECLARE_INSTRUCTION_FACTORY_P4(HStoreContextSlot, HValue*, int, | 5285 DECLARE_INSTRUCTION_FACTORY_P4(HStoreContextSlot, HValue*, int, |
5291 Mode, HValue*); | 5286 Mode, HValue*); |
5292 | 5287 |
5293 HValue* context() const { return OperandAt(0); } | 5288 HValue* context() const { return OperandAt(0); } |
5294 HValue* value() const { return OperandAt(1); } | 5289 HValue* value() const { return OperandAt(1); } |
5295 int slot_index() const { return slot_index_; } | 5290 int slot_index() const { return slot_index_; } |
5296 Mode mode() const { return mode_; } | 5291 Mode mode() const { return mode_; } |
5297 | 5292 |
(...skipping 1944 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7242 bool IsDeletable() const override { return true; } | 7237 bool IsDeletable() const override { return true; } |
7243 }; | 7238 }; |
7244 | 7239 |
7245 #undef DECLARE_INSTRUCTION | 7240 #undef DECLARE_INSTRUCTION |
7246 #undef DECLARE_CONCRETE_INSTRUCTION | 7241 #undef DECLARE_CONCRETE_INSTRUCTION |
7247 | 7242 |
7248 } // namespace internal | 7243 } // namespace internal |
7249 } // namespace v8 | 7244 } // namespace v8 |
7250 | 7245 |
7251 #endif // V8_CRANKSHAFT_HYDROGEN_INSTRUCTIONS_H_ | 7246 #endif // V8_CRANKSHAFT_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |