| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 3429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3440 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalGeneric) | 3440 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalGeneric) |
| 3441 | 3441 |
| 3442 private: | 3442 private: |
| 3443 Handle<Object> name_; | 3443 Handle<Object> name_; |
| 3444 StrictModeFlag strict_mode_flag_; | 3444 StrictModeFlag strict_mode_flag_; |
| 3445 }; | 3445 }; |
| 3446 | 3446 |
| 3447 | 3447 |
| 3448 class HLoadContextSlot: public HUnaryOperation { | 3448 class HLoadContextSlot: public HUnaryOperation { |
| 3449 public: | 3449 public: |
| 3450 HLoadContextSlot(HValue* context , int slot_index) | 3450 HLoadContextSlot(HValue* context , Variable* var) |
| 3451 : HUnaryOperation(context), slot_index_(slot_index) { | 3451 : HUnaryOperation(context), var_(var) { |
| 3452 ASSERT(var_->IsContextSlot()); |
| 3452 set_representation(Representation::Tagged()); | 3453 set_representation(Representation::Tagged()); |
| 3453 SetFlag(kUseGVN); | 3454 SetFlag(kUseGVN); |
| 3454 SetFlag(kDependsOnContextSlots); | 3455 SetFlag(kDependsOnContextSlots); |
| 3455 } | 3456 } |
| 3456 | 3457 |
| 3457 int slot_index() const { return slot_index_; } | 3458 int slot_index() const { return var_->index(); } |
| 3459 Variable* var() const { return var_; } |
| 3460 |
| 3461 bool RequiresHoleCheck() { |
| 3462 return var_->mode() == LET || var_->mode() == CONST_HARMONY; |
| 3463 } |
| 3458 | 3464 |
| 3459 virtual Representation RequiredInputRepresentation(int index) { | 3465 virtual Representation RequiredInputRepresentation(int index) { |
| 3460 return Representation::Tagged(); | 3466 return Representation::Tagged(); |
| 3461 } | 3467 } |
| 3462 | 3468 |
| 3463 virtual void PrintDataTo(StringStream* stream); | 3469 virtual void PrintDataTo(StringStream* stream); |
| 3464 | 3470 |
| 3465 DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot) | 3471 DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot) |
| 3466 | 3472 |
| 3467 protected: | 3473 protected: |
| 3468 virtual bool DataEquals(HValue* other) { | 3474 virtual bool DataEquals(HValue* other) { |
| 3469 HLoadContextSlot* b = HLoadContextSlot::cast(other); | 3475 HLoadContextSlot* b = HLoadContextSlot::cast(other); |
| 3470 return (slot_index() == b->slot_index()); | 3476 return (slot_index() == b->slot_index()); |
| 3471 } | 3477 } |
| 3472 | 3478 |
| 3473 private: | 3479 private: |
| 3474 int slot_index_; | 3480 Variable* var_; |
| 3475 }; | 3481 }; |
| 3476 | 3482 |
| 3477 | 3483 |
| 3478 class HStoreContextSlot: public HTemplateInstruction<2> { | 3484 class HStoreContextSlot: public HTemplateInstruction<2> { |
| 3479 public: | 3485 public: |
| 3480 HStoreContextSlot(HValue* context, int slot_index, HValue* value) | 3486 // Indicates whether this store to the context is an initializing store or |
| 3481 : slot_index_(slot_index) { | 3487 // a proper assignment. Non-initializing assignments to harmony bindings |
| 3488 // perform a hole check. |
| 3489 enum Mode { |
| 3490 kInitialize, |
| 3491 kAssign |
| 3492 }; |
| 3493 |
| 3494 HStoreContextSlot(HValue* context, Variable* var, Mode mode, HValue* value) |
| 3495 : var_(var), mode_(mode) { |
| 3496 ASSERT(var->IsContextSlot()); |
| 3482 SetOperandAt(0, context); | 3497 SetOperandAt(0, context); |
| 3483 SetOperandAt(1, value); | 3498 SetOperandAt(1, value); |
| 3484 SetFlag(kChangesContextSlots); | 3499 SetFlag(kChangesContextSlots); |
| 3485 } | 3500 } |
| 3486 | 3501 |
| 3487 HValue* context() { return OperandAt(0); } | 3502 HValue* context() { return OperandAt(0); } |
| 3488 HValue* value() { return OperandAt(1); } | 3503 HValue* value() { return OperandAt(1); } |
| 3489 int slot_index() const { return slot_index_; } | 3504 int slot_index() const { return var_->index(); } |
| 3505 Variable* var() const { return var_; } |
| 3506 Mode mode() const { return mode_; } |
| 3490 | 3507 |
| 3491 bool NeedsWriteBarrier() { | 3508 bool NeedsWriteBarrier() { |
| 3492 return StoringValueNeedsWriteBarrier(value()); | 3509 return StoringValueNeedsWriteBarrier(value()); |
| 3493 } | 3510 } |
| 3494 | 3511 |
| 3512 bool RequiresHoleCheck() { |
| 3513 return mode_ == kAssign && |
| 3514 (var_->mode() == LET || var_->mode() == CONST_HARMONY); |
| 3515 } |
| 3516 |
| 3495 virtual Representation RequiredInputRepresentation(int index) { | 3517 virtual Representation RequiredInputRepresentation(int index) { |
| 3496 return Representation::Tagged(); | 3518 return Representation::Tagged(); |
| 3497 } | 3519 } |
| 3498 | 3520 |
| 3499 virtual void PrintDataTo(StringStream* stream); | 3521 virtual void PrintDataTo(StringStream* stream); |
| 3500 | 3522 |
| 3501 DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot) | 3523 DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot) |
| 3502 | 3524 |
| 3503 private: | 3525 private: |
| 3504 int slot_index_; | 3526 Variable* var_; |
| 3527 Mode mode_; |
| 3505 }; | 3528 }; |
| 3506 | 3529 |
| 3507 | 3530 |
| 3508 class HLoadNamedField: public HUnaryOperation { | 3531 class HLoadNamedField: public HUnaryOperation { |
| 3509 public: | 3532 public: |
| 3510 HLoadNamedField(HValue* object, bool is_in_object, int offset) | 3533 HLoadNamedField(HValue* object, bool is_in_object, int offset) |
| 3511 : HUnaryOperation(object), | 3534 : HUnaryOperation(object), |
| 3512 is_in_object_(is_in_object), | 3535 is_in_object_(is_in_object), |
| 3513 offset_(offset) { | 3536 offset_(offset) { |
| 3514 set_representation(Representation::Tagged()); | 3537 set_representation(Representation::Tagged()); |
| (...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4429 | 4452 |
| 4430 DECLARE_CONCRETE_INSTRUCTION(In) | 4453 DECLARE_CONCRETE_INSTRUCTION(In) |
| 4431 }; | 4454 }; |
| 4432 | 4455 |
| 4433 #undef DECLARE_INSTRUCTION | 4456 #undef DECLARE_INSTRUCTION |
| 4434 #undef DECLARE_CONCRETE_INSTRUCTION | 4457 #undef DECLARE_CONCRETE_INSTRUCTION |
| 4435 | 4458 |
| 4436 } } // namespace v8::internal | 4459 } } // namespace v8::internal |
| 4437 | 4460 |
| 4438 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 4461 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
| OLD | NEW |