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_HYDROGEN_INSTRUCTIONS_H_ | 5 #ifndef V8_HYDROGEN_INSTRUCTIONS_H_ |
6 #define V8_HYDROGEN_INSTRUCTIONS_H_ | 6 #define V8_HYDROGEN_INSTRUCTIONS_H_ |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
11 #include "src/code-stubs.h" | 11 #include "src/code-stubs.h" |
12 #include "src/conversions.h" | 12 #include "src/conversions.h" |
13 #include "src/data-flow.h" | 13 #include "src/data-flow.h" |
14 #include "src/deoptimizer.h" | 14 #include "src/deoptimizer.h" |
| 15 #include "src/feedback-slots.h" |
15 #include "src/hydrogen-types.h" | 16 #include "src/hydrogen-types.h" |
16 #include "src/ostreams.h" | 17 #include "src/ostreams.h" |
17 #include "src/small-pointer-list.h" | 18 #include "src/small-pointer-list.h" |
18 #include "src/unique.h" | 19 #include "src/unique.h" |
19 #include "src/utils.h" | 20 #include "src/utils.h" |
20 #include "src/zone.h" | 21 #include "src/zone.h" |
21 | 22 |
22 namespace v8 { | 23 namespace v8 { |
23 namespace internal { | 24 namespace internal { |
24 | 25 |
(...skipping 5401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5426 | 5427 |
5427 class HLoadGlobalGeneric V8_FINAL : public HTemplateInstruction<2> { | 5428 class HLoadGlobalGeneric V8_FINAL : public HTemplateInstruction<2> { |
5428 public: | 5429 public: |
5429 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HLoadGlobalGeneric, HValue*, | 5430 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HLoadGlobalGeneric, HValue*, |
5430 Handle<String>, bool); | 5431 Handle<String>, bool); |
5431 | 5432 |
5432 HValue* context() { return OperandAt(0); } | 5433 HValue* context() { return OperandAt(0); } |
5433 HValue* global_object() { return OperandAt(1); } | 5434 HValue* global_object() { return OperandAt(1); } |
5434 Handle<String> name() const { return name_; } | 5435 Handle<String> name() const { return name_; } |
5435 bool for_typeof() const { return for_typeof_; } | 5436 bool for_typeof() const { return for_typeof_; } |
| 5437 int slot() const { |
| 5438 ASSERT(FLAG_vector_ics && |
| 5439 slot_ != FeedbackSlotInterface::kInvalidFeedbackSlot); |
| 5440 return slot_; |
| 5441 } |
| 5442 Handle<FixedArray> feedback_vector() const { return feedback_vector_; } |
| 5443 void SetVectorAndSlot(Handle<FixedArray> vector, int slot) { |
| 5444 ASSERT(FLAG_vector_ics); |
| 5445 feedback_vector_ = vector; |
| 5446 slot_ = slot; |
| 5447 } |
5436 | 5448 |
5437 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT | 5449 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT |
5438 | 5450 |
5439 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 5451 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
5440 return Representation::Tagged(); | 5452 return Representation::Tagged(); |
5441 } | 5453 } |
5442 | 5454 |
5443 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalGeneric) | 5455 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalGeneric) |
5444 | 5456 |
5445 private: | 5457 private: |
5446 HLoadGlobalGeneric(HValue* context, HValue* global_object, | 5458 HLoadGlobalGeneric(HValue* context, HValue* global_object, |
5447 Handle<String> name, bool for_typeof) | 5459 Handle<String> name, bool for_typeof) |
5448 : name_(name), for_typeof_(for_typeof) { | 5460 : name_(name), for_typeof_(for_typeof), |
| 5461 slot_(FeedbackSlotInterface::kInvalidFeedbackSlot) { |
5449 SetOperandAt(0, context); | 5462 SetOperandAt(0, context); |
5450 SetOperandAt(1, global_object); | 5463 SetOperandAt(1, global_object); |
5451 set_representation(Representation::Tagged()); | 5464 set_representation(Representation::Tagged()); |
5452 SetAllSideEffects(); | 5465 SetAllSideEffects(); |
5453 } | 5466 } |
5454 | 5467 |
5455 Handle<String> name_; | 5468 Handle<String> name_; |
5456 bool for_typeof_; | 5469 bool for_typeof_; |
| 5470 Handle<FixedArray> feedback_vector_; |
| 5471 int slot_; |
5457 }; | 5472 }; |
5458 | 5473 |
5459 | 5474 |
5460 class HAllocate V8_FINAL : public HTemplateInstruction<2> { | 5475 class HAllocate V8_FINAL : public HTemplateInstruction<2> { |
5461 public: | 5476 public: |
5462 static bool CompatibleInstanceTypes(InstanceType type1, | 5477 static bool CompatibleInstanceTypes(InstanceType type1, |
5463 InstanceType type2) { | 5478 InstanceType type2) { |
5464 return ComputeFlags(TENURED, type1) == ComputeFlags(TENURED, type2) && | 5479 return ComputeFlags(TENURED, type1) == ComputeFlags(TENURED, type2) && |
5465 ComputeFlags(NOT_TENURED, type1) == ComputeFlags(NOT_TENURED, type2); | 5480 ComputeFlags(NOT_TENURED, type1) == ComputeFlags(NOT_TENURED, type2); |
5466 } | 5481 } |
(...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6415 | 6430 |
6416 class HLoadNamedGeneric V8_FINAL : public HTemplateInstruction<2> { | 6431 class HLoadNamedGeneric V8_FINAL : public HTemplateInstruction<2> { |
6417 public: | 6432 public: |
6418 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HLoadNamedGeneric, HValue*, | 6433 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HLoadNamedGeneric, HValue*, |
6419 Handle<Object>); | 6434 Handle<Object>); |
6420 | 6435 |
6421 HValue* context() const { return OperandAt(0); } | 6436 HValue* context() const { return OperandAt(0); } |
6422 HValue* object() const { return OperandAt(1); } | 6437 HValue* object() const { return OperandAt(1); } |
6423 Handle<Object> name() const { return name_; } | 6438 Handle<Object> name() const { return name_; } |
6424 | 6439 |
| 6440 int slot() const { |
| 6441 ASSERT(FLAG_vector_ics && |
| 6442 slot_ != FeedbackSlotInterface::kInvalidFeedbackSlot); |
| 6443 return slot_; |
| 6444 } |
| 6445 Handle<FixedArray> feedback_vector() const { return feedback_vector_; } |
| 6446 void SetVectorAndSlot(Handle<FixedArray> vector, int slot) { |
| 6447 ASSERT(FLAG_vector_ics); |
| 6448 feedback_vector_ = vector; |
| 6449 slot_ = slot; |
| 6450 } |
| 6451 |
6425 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 6452 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
6426 return Representation::Tagged(); | 6453 return Representation::Tagged(); |
6427 } | 6454 } |
6428 | 6455 |
6429 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT | 6456 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT |
6430 | 6457 |
6431 DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric) | 6458 DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric) |
6432 | 6459 |
6433 private: | 6460 private: |
6434 HLoadNamedGeneric(HValue* context, HValue* object, Handle<Object> name) | 6461 HLoadNamedGeneric(HValue* context, HValue* object, Handle<Object> name) |
6435 : name_(name) { | 6462 : name_(name), |
| 6463 slot_(FeedbackSlotInterface::kInvalidFeedbackSlot) { |
6436 SetOperandAt(0, context); | 6464 SetOperandAt(0, context); |
6437 SetOperandAt(1, object); | 6465 SetOperandAt(1, object); |
6438 set_representation(Representation::Tagged()); | 6466 set_representation(Representation::Tagged()); |
6439 SetAllSideEffects(); | 6467 SetAllSideEffects(); |
6440 } | 6468 } |
6441 | 6469 |
6442 Handle<Object> name_; | 6470 Handle<Object> name_; |
| 6471 Handle<FixedArray> feedback_vector_; |
| 6472 int slot_; |
6443 }; | 6473 }; |
6444 | 6474 |
6445 | 6475 |
6446 class HLoadFunctionPrototype V8_FINAL : public HUnaryOperation { | 6476 class HLoadFunctionPrototype V8_FINAL : public HUnaryOperation { |
6447 public: | 6477 public: |
6448 DECLARE_INSTRUCTION_FACTORY_P1(HLoadFunctionPrototype, HValue*); | 6478 DECLARE_INSTRUCTION_FACTORY_P1(HLoadFunctionPrototype, HValue*); |
6449 | 6479 |
6450 HValue* function() { return OperandAt(0); } | 6480 HValue* function() { return OperandAt(0); } |
6451 | 6481 |
6452 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 6482 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6678 }; | 6708 }; |
6679 | 6709 |
6680 | 6710 |
6681 class HLoadKeyedGeneric V8_FINAL : public HTemplateInstruction<3> { | 6711 class HLoadKeyedGeneric V8_FINAL : public HTemplateInstruction<3> { |
6682 public: | 6712 public: |
6683 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HLoadKeyedGeneric, HValue*, | 6713 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HLoadKeyedGeneric, HValue*, |
6684 HValue*); | 6714 HValue*); |
6685 HValue* object() const { return OperandAt(0); } | 6715 HValue* object() const { return OperandAt(0); } |
6686 HValue* key() const { return OperandAt(1); } | 6716 HValue* key() const { return OperandAt(1); } |
6687 HValue* context() const { return OperandAt(2); } | 6717 HValue* context() const { return OperandAt(2); } |
| 6718 int slot() const { |
| 6719 ASSERT(FLAG_vector_ics && |
| 6720 slot_ != FeedbackSlotInterface::kInvalidFeedbackSlot); |
| 6721 return slot_; |
| 6722 } |
| 6723 Handle<FixedArray> feedback_vector() const { return feedback_vector_; } |
| 6724 void SetVectorAndSlot(Handle<FixedArray> vector, int slot) { |
| 6725 ASSERT(FLAG_vector_ics); |
| 6726 feedback_vector_ = vector; |
| 6727 slot_ = slot; |
| 6728 } |
6688 | 6729 |
6689 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT | 6730 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT |
6690 | 6731 |
6691 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 6732 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
6692 // tagged[tagged] | 6733 // tagged[tagged] |
6693 return Representation::Tagged(); | 6734 return Representation::Tagged(); |
6694 } | 6735 } |
6695 | 6736 |
6696 virtual HValue* Canonicalize() V8_OVERRIDE; | 6737 virtual HValue* Canonicalize() V8_OVERRIDE; |
6697 | 6738 |
6698 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric) | 6739 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric) |
6699 | 6740 |
6700 private: | 6741 private: |
6701 HLoadKeyedGeneric(HValue* context, HValue* obj, HValue* key) { | 6742 HLoadKeyedGeneric(HValue* context, HValue* obj, HValue* key) |
| 6743 : slot_(FeedbackSlotInterface::kInvalidFeedbackSlot) { |
6702 set_representation(Representation::Tagged()); | 6744 set_representation(Representation::Tagged()); |
6703 SetOperandAt(0, obj); | 6745 SetOperandAt(0, obj); |
6704 SetOperandAt(1, key); | 6746 SetOperandAt(1, key); |
6705 SetOperandAt(2, context); | 6747 SetOperandAt(2, context); |
6706 SetAllSideEffects(); | 6748 SetAllSideEffects(); |
6707 } | 6749 } |
| 6750 |
| 6751 Handle<FixedArray> feedback_vector_; |
| 6752 int slot_; |
6708 }; | 6753 }; |
6709 | 6754 |
6710 | 6755 |
6711 // Indicates whether the store is a store to an entry that was previously | 6756 // Indicates whether the store is a store to an entry that was previously |
6712 // initialized or not. | 6757 // initialized or not. |
6713 enum StoreFieldOrKeyedMode { | 6758 enum StoreFieldOrKeyedMode { |
6714 // The entry could be either previously initialized or not. | 6759 // The entry could be either previously initialized or not. |
6715 INITIALIZING_STORE, | 6760 INITIALIZING_STORE, |
6716 // At the time of this store it is guaranteed that the entry is already | 6761 // At the time of this store it is guaranteed that the entry is already |
6717 // initialized. | 6762 // initialized. |
(...skipping 1096 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7814 }; | 7859 }; |
7815 | 7860 |
7816 | 7861 |
7817 | 7862 |
7818 #undef DECLARE_INSTRUCTION | 7863 #undef DECLARE_INSTRUCTION |
7819 #undef DECLARE_CONCRETE_INSTRUCTION | 7864 #undef DECLARE_CONCRETE_INSTRUCTION |
7820 | 7865 |
7821 } } // namespace v8::internal | 7866 } } // namespace v8::internal |
7822 | 7867 |
7823 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7868 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |