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 5991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6002 bool IsSkipWriteBarrier() const { | 6002 bool IsSkipWriteBarrier() const { |
6003 return write_barrier_mode_ == SKIP_WRITE_BARRIER; | 6003 return write_barrier_mode_ == SKIP_WRITE_BARRIER; |
6004 } | 6004 } |
6005 | 6005 |
6006 HValue* object() const { return OperandAt(0); } | 6006 HValue* object() const { return OperandAt(0); } |
6007 HValue* value() const { return OperandAt(1); } | 6007 HValue* value() const { return OperandAt(1); } |
6008 HValue* transition() const { return OperandAt(2); } | 6008 HValue* transition() const { return OperandAt(2); } |
6009 | 6009 |
6010 HObjectAccess access() const { return access_; } | 6010 HObjectAccess access() const { return access_; } |
6011 HValue* new_space_dominator() const { return new_space_dominator_; } | 6011 HValue* new_space_dominator() const { return new_space_dominator_; } |
6012 | 6012 bool has_transition() const { return has_transition_; } |
6013 bool has_transition() const { | |
6014 return transition() != object(); | |
6015 } | |
6016 | 6013 |
6017 Handle<Map> transition_map() const { | 6014 Handle<Map> transition_map() const { |
6018 if (has_transition()) { | 6015 if (has_transition()) { |
6019 return Handle<Map>::cast(HConstant::cast(transition())->handle()); | 6016 return Handle<Map>::cast(HConstant::cast(transition())->handle()); |
6020 } else { | 6017 } else { |
6021 return Handle<Map>(); | 6018 return Handle<Map>(); |
6022 } | 6019 } |
6023 } | 6020 } |
6024 | 6021 |
6025 void SetTransition(HConstant* map_constant, CompilationInfo* info) { | 6022 void SetTransition(HConstant* map_constant, CompilationInfo* info) { |
6026 ASSERT(!has_transition()); // Only set once. | 6023 ASSERT(!has_transition()); // Only set once. |
6027 Handle<Map> map = Handle<Map>::cast(map_constant->handle()); | 6024 Handle<Map> map = Handle<Map>::cast(map_constant->handle()); |
6028 if (map->CanBeDeprecated()) { | 6025 if (map->CanBeDeprecated()) { |
6029 map->AddDependentCompilationInfo(DependentCode::kTransitionGroup, info); | 6026 map->AddDependentCompilationInfo(DependentCode::kTransitionGroup, info); |
6030 } | 6027 } |
6031 SetOperandAt(2, map_constant); | 6028 SetOperandAt(2, map_constant); |
| 6029 has_transition_ = true; |
6032 } | 6030 } |
6033 | 6031 |
6034 bool NeedsWriteBarrier() { | 6032 bool NeedsWriteBarrier() { |
6035 ASSERT(!(FLAG_track_double_fields && field_representation().IsDouble()) || | 6033 ASSERT(!(FLAG_track_double_fields && field_representation().IsDouble()) || |
6036 !has_transition()); | 6034 !has_transition()); |
6037 if (IsSkipWriteBarrier()) return false; | 6035 if (IsSkipWriteBarrier()) return false; |
6038 if (field_representation().IsDouble()) return false; | 6036 if (field_representation().IsDouble()) return false; |
6039 if (field_representation().IsSmi()) return false; | 6037 if (field_representation().IsSmi()) return false; |
6040 if (field_representation().IsInteger32()) return false; | 6038 if (field_representation().IsInteger32()) return false; |
6041 if (field_representation().IsExternal()) return false; | 6039 if (field_representation().IsExternal()) return false; |
6042 return StoringValueNeedsWriteBarrier(value()) && | 6040 return StoringValueNeedsWriteBarrier(value()) && |
6043 ReceiverObjectNeedsWriteBarrier(object(), new_space_dominator()); | 6041 ReceiverObjectNeedsWriteBarrier(object(), new_space_dominator()); |
6044 } | 6042 } |
6045 | 6043 |
6046 bool NeedsWriteBarrierForMap() { | 6044 bool NeedsWriteBarrierForMap() { |
6047 if (IsSkipWriteBarrier()) return false; | 6045 if (IsSkipWriteBarrier()) return false; |
6048 return ReceiverObjectNeedsWriteBarrier(object(), new_space_dominator()); | 6046 return ReceiverObjectNeedsWriteBarrier(object(), new_space_dominator()); |
6049 } | 6047 } |
6050 | 6048 |
6051 Representation field_representation() const { | 6049 Representation field_representation() const { |
6052 return access_.representation(); | 6050 return access_.representation(); |
6053 } | 6051 } |
6054 | 6052 |
6055 private: | 6053 private: |
6056 HStoreNamedField(HValue* obj, | 6054 HStoreNamedField(HValue* obj, |
6057 HObjectAccess access, | 6055 HObjectAccess access, |
6058 HValue* val) | 6056 HValue* val) |
6059 : access_(access), | 6057 : access_(access), |
6060 new_space_dominator_(NULL), | 6058 new_space_dominator_(NULL), |
6061 write_barrier_mode_(UPDATE_WRITE_BARRIER) { | 6059 write_barrier_mode_(UPDATE_WRITE_BARRIER), |
| 6060 has_transition_(false) { |
6062 SetOperandAt(0, obj); | 6061 SetOperandAt(0, obj); |
6063 SetOperandAt(1, val); | 6062 SetOperandAt(1, val); |
6064 SetOperandAt(2, obj); | 6063 SetOperandAt(2, obj); |
6065 access.SetGVNFlags(this, true); | 6064 access.SetGVNFlags(this, true); |
6066 } | 6065 } |
6067 | 6066 |
6068 HObjectAccess access_; | 6067 HObjectAccess access_; |
6069 HValue* new_space_dominator_; | 6068 HValue* new_space_dominator_; |
6070 WriteBarrierMode write_barrier_mode_; | 6069 WriteBarrierMode write_barrier_mode_ : 1; |
| 6070 bool has_transition_ : 1; |
6071 }; | 6071 }; |
6072 | 6072 |
6073 | 6073 |
6074 class HStoreNamedGeneric: public HTemplateInstruction<3> { | 6074 class HStoreNamedGeneric: public HTemplateInstruction<3> { |
6075 public: | 6075 public: |
6076 HStoreNamedGeneric(HValue* context, | 6076 HStoreNamedGeneric(HValue* context, |
6077 HValue* object, | 6077 HValue* object, |
6078 Handle<String> name, | 6078 Handle<String> name, |
6079 HValue* value, | 6079 HValue* value, |
6080 StrictModeFlag strict_mode_flag) | 6080 StrictModeFlag strict_mode_flag) |
(...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6854 virtual bool IsDeletable() const { return true; } | 6854 virtual bool IsDeletable() const { return true; } |
6855 }; | 6855 }; |
6856 | 6856 |
6857 | 6857 |
6858 #undef DECLARE_INSTRUCTION | 6858 #undef DECLARE_INSTRUCTION |
6859 #undef DECLARE_CONCRETE_INSTRUCTION | 6859 #undef DECLARE_CONCRETE_INSTRUCTION |
6860 | 6860 |
6861 } } // namespace v8::internal | 6861 } } // namespace v8::internal |
6862 | 6862 |
6863 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 6863 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |