OLD | NEW |
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 4948 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4959 // TODO(svenpanne) Might be safe, but leave it out until we know for sure. | 4959 // TODO(svenpanne) Might be safe, but leave it out until we know for sure. |
4960 // virtual bool IsDeletable() const { return true; } | 4960 // virtual bool IsDeletable() const { return true; } |
4961 | 4961 |
4962 Handle<JSFunction> constructor_; | 4962 Handle<JSFunction> constructor_; |
4963 }; | 4963 }; |
4964 | 4964 |
4965 | 4965 |
4966 template <int V> | 4966 template <int V> |
4967 class HMaterializedLiteral: public HTemplateInstruction<V> { | 4967 class HMaterializedLiteral: public HTemplateInstruction<V> { |
4968 public: | 4968 public: |
| 4969 HMaterializedLiteral<V>(int index, int depth, AllocationSiteMode mode) |
| 4970 : literal_index_(index), depth_(depth), allocation_site_mode_(mode) { |
| 4971 this->set_representation(Representation::Tagged()); |
| 4972 } |
| 4973 |
4969 HMaterializedLiteral<V>(int index, int depth) | 4974 HMaterializedLiteral<V>(int index, int depth) |
4970 : literal_index_(index), depth_(depth) { | 4975 : literal_index_(index), depth_(depth), |
| 4976 allocation_site_mode_(DONT_TRACK_ALLOCATION_SITE) { |
4971 this->set_representation(Representation::Tagged()); | 4977 this->set_representation(Representation::Tagged()); |
4972 } | 4978 } |
4973 | 4979 |
4974 int literal_index() const { return literal_index_; } | 4980 int literal_index() const { return literal_index_; } |
4975 int depth() const { return depth_; } | 4981 int depth() const { return depth_; } |
| 4982 AllocationSiteMode allocation_site_mode() const { |
| 4983 return allocation_site_mode_; |
| 4984 } |
4976 | 4985 |
4977 private: | 4986 private: |
4978 virtual bool IsDeletable() const { return true; } | 4987 virtual bool IsDeletable() const { return true; } |
4979 | 4988 |
4980 int literal_index_; | 4989 int literal_index_; |
4981 int depth_; | 4990 int depth_; |
| 4991 AllocationSiteMode allocation_site_mode_; |
4982 }; | 4992 }; |
4983 | 4993 |
4984 | 4994 |
4985 class HFastLiteral: public HMaterializedLiteral<1> { | 4995 class HFastLiteral: public HMaterializedLiteral<1> { |
4986 public: | 4996 public: |
4987 HFastLiteral(HValue* context, | 4997 HFastLiteral(HValue* context, |
4988 Handle<JSObject> boilerplate, | 4998 Handle<JSObject> boilerplate, |
4989 int total_size, | 4999 int total_size, |
4990 int literal_index, | 5000 int literal_index, |
4991 int depth) | 5001 int depth, |
4992 : HMaterializedLiteral<1>(literal_index, depth), | 5002 AllocationSiteMode mode) |
| 5003 : HMaterializedLiteral<1>(literal_index, depth, mode), |
4993 boilerplate_(boilerplate), | 5004 boilerplate_(boilerplate), |
4994 total_size_(total_size) { | 5005 total_size_(total_size) { |
4995 SetOperandAt(0, context); | 5006 SetOperandAt(0, context); |
4996 SetGVNFlag(kChangesNewSpacePromotion); | 5007 SetGVNFlag(kChangesNewSpacePromotion); |
4997 } | 5008 } |
4998 | 5009 |
4999 // Maximum depth and total number of elements and properties for literal | 5010 // Maximum depth and total number of elements and properties for literal |
5000 // graphs to be considered for fast deep-copying. | 5011 // graphs to be considered for fast deep-copying. |
5001 static const int kMaxLiteralDepth = 3; | 5012 static const int kMaxLiteralDepth = 3; |
5002 static const int kMaxLiteralProperties = 8; | 5013 static const int kMaxLiteralProperties = 8; |
5003 | 5014 |
5004 HValue* context() { return OperandAt(0); } | 5015 HValue* context() { return OperandAt(0); } |
5005 Handle<JSObject> boilerplate() const { return boilerplate_; } | 5016 Handle<JSObject> boilerplate() const { return boilerplate_; } |
5006 int total_size() const { return total_size_; } | 5017 int total_size() const { return total_size_; } |
5007 | |
5008 virtual Representation RequiredInputRepresentation(int index) { | 5018 virtual Representation RequiredInputRepresentation(int index) { |
5009 return Representation::Tagged(); | 5019 return Representation::Tagged(); |
5010 } | 5020 } |
5011 virtual HType CalculateInferredType(); | 5021 virtual HType CalculateInferredType(); |
5012 | 5022 |
5013 DECLARE_CONCRETE_INSTRUCTION(FastLiteral) | 5023 DECLARE_CONCRETE_INSTRUCTION(FastLiteral) |
5014 | 5024 |
5015 private: | 5025 private: |
5016 Handle<JSObject> boilerplate_; | 5026 Handle<JSObject> boilerplate_; |
5017 int total_size_; | 5027 int total_size_; |
5018 }; | 5028 }; |
5019 | 5029 |
5020 | 5030 |
5021 class HArrayLiteral: public HMaterializedLiteral<1> { | 5031 class HArrayLiteral: public HMaterializedLiteral<1> { |
5022 public: | 5032 public: |
5023 HArrayLiteral(HValue* context, | 5033 HArrayLiteral(HValue* context, |
5024 Handle<HeapObject> boilerplate_object, | 5034 Handle<HeapObject> boilerplate_object, |
5025 int length, | 5035 int length, |
5026 int literal_index, | 5036 int literal_index, |
5027 int depth) | 5037 int depth, |
5028 : HMaterializedLiteral<1>(literal_index, depth), | 5038 AllocationSiteMode mode) |
| 5039 : HMaterializedLiteral<1>(literal_index, depth, mode), |
5029 length_(length), | 5040 length_(length), |
5030 boilerplate_object_(boilerplate_object) { | 5041 boilerplate_object_(boilerplate_object) { |
5031 SetOperandAt(0, context); | 5042 SetOperandAt(0, context); |
5032 SetGVNFlag(kChangesNewSpacePromotion); | 5043 SetGVNFlag(kChangesNewSpacePromotion); |
5033 } | 5044 } |
5034 | 5045 |
5035 HValue* context() { return OperandAt(0); } | 5046 HValue* context() { return OperandAt(0); } |
5036 ElementsKind boilerplate_elements_kind() const { | 5047 ElementsKind boilerplate_elements_kind() const { |
5037 if (!boilerplate_object_->IsJSObject()) { | 5048 if (!boilerplate_object_->IsJSObject()) { |
5038 return TERMINAL_FAST_ELEMENTS_KIND; | 5049 return TERMINAL_FAST_ELEMENTS_KIND; |
5039 } | 5050 } |
5040 return Handle<JSObject>::cast(boilerplate_object_)->GetElementsKind(); | 5051 return Handle<JSObject>::cast(boilerplate_object_)->GetElementsKind(); |
5041 } | 5052 } |
5042 Handle<HeapObject> boilerplate_object() const { return boilerplate_object_; } | 5053 Handle<HeapObject> boilerplate_object() const { return boilerplate_object_; } |
5043 int length() const { return length_; } | 5054 int length() const { return length_; } |
5044 | |
5045 bool IsCopyOnWrite() const; | 5055 bool IsCopyOnWrite() const; |
5046 | 5056 |
5047 virtual Representation RequiredInputRepresentation(int index) { | 5057 virtual Representation RequiredInputRepresentation(int index) { |
5048 return Representation::Tagged(); | 5058 return Representation::Tagged(); |
5049 } | 5059 } |
5050 virtual HType CalculateInferredType(); | 5060 virtual HType CalculateInferredType(); |
5051 | 5061 |
5052 DECLARE_CONCRETE_INSTRUCTION(ArrayLiteral) | 5062 DECLARE_CONCRETE_INSTRUCTION(ArrayLiteral) |
5053 | 5063 |
5054 private: | 5064 private: |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5446 virtual bool IsDeletable() const { return true; } | 5456 virtual bool IsDeletable() const { return true; } |
5447 }; | 5457 }; |
5448 | 5458 |
5449 | 5459 |
5450 #undef DECLARE_INSTRUCTION | 5460 #undef DECLARE_INSTRUCTION |
5451 #undef DECLARE_CONCRETE_INSTRUCTION | 5461 #undef DECLARE_CONCRETE_INSTRUCTION |
5452 | 5462 |
5453 } } // namespace v8::internal | 5463 } } // namespace v8::internal |
5454 | 5464 |
5455 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 5465 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |