| 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 990 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1001 void Kill(int flags); | 1001 void Kill(int flags); |
| 1002 | 1002 |
| 1003 void Add(HValue* value) { | 1003 void Add(HValue* value) { |
| 1004 present_flags_ |= value->flags(); | 1004 present_flags_ |= value->flags(); |
| 1005 Insert(value); | 1005 Insert(value); |
| 1006 } | 1006 } |
| 1007 | 1007 |
| 1008 HValue* Lookup(HValue* value) const; | 1008 HValue* Lookup(HValue* value) const; |
| 1009 | 1009 |
| 1010 HValueMap* Copy(Zone* zone) const { | 1010 HValueMap* Copy(Zone* zone) const { |
| 1011 return new(zone) HValueMap(this); | 1011 return new(zone) HValueMap(zone, this); |
| 1012 } | 1012 } |
| 1013 | 1013 |
| 1014 bool IsEmpty() const { return count_ == 0; } |
| 1015 |
| 1014 private: | 1016 private: |
| 1015 // A linked list of HValue* values. Stored in arrays. | 1017 // A linked list of HValue* values. Stored in arrays. |
| 1016 struct HValueMapListElement { | 1018 struct HValueMapListElement { |
| 1017 HValue* value; | 1019 HValue* value; |
| 1018 int next; // Index in the array of the next list element. | 1020 int next; // Index in the array of the next list element. |
| 1019 }; | 1021 }; |
| 1020 static const int kNil = -1; // The end of a linked list | 1022 static const int kNil = -1; // The end of a linked list |
| 1021 | 1023 |
| 1022 // Must be a power of 2. | 1024 // Must be a power of 2. |
| 1023 static const int kInitialSize = 16; | 1025 static const int kInitialSize = 16; |
| 1024 | 1026 |
| 1025 explicit HValueMap(const HValueMap* other); | 1027 HValueMap(Zone* zone, const HValueMap* other); |
| 1026 | 1028 |
| 1027 void Resize(int new_size); | 1029 void Resize(int new_size); |
| 1028 void ResizeLists(int new_size); | 1030 void ResizeLists(int new_size); |
| 1029 void Insert(HValue* value); | 1031 void Insert(HValue* value); |
| 1030 uint32_t Bound(uint32_t value) const { return value & (array_size_ - 1); } | 1032 uint32_t Bound(uint32_t value) const { return value & (array_size_ - 1); } |
| 1031 | 1033 |
| 1032 int array_size_; | 1034 int array_size_; |
| 1033 int lists_size_; | 1035 int lists_size_; |
| 1034 int count_; // The number of values stored in the HValueMap. | 1036 int count_; // The number of values stored in the HValueMap. |
| 1035 int present_flags_; // All flags that are in any value in the HValueMap. | 1037 int present_flags_; // All flags that are in any value in the HValueMap. |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1197 const char* filename_; | 1199 const char* filename_; |
| 1198 HeapStringAllocator string_allocator_; | 1200 HeapStringAllocator string_allocator_; |
| 1199 StringStream trace_; | 1201 StringStream trace_; |
| 1200 int indent_; | 1202 int indent_; |
| 1201 }; | 1203 }; |
| 1202 | 1204 |
| 1203 | 1205 |
| 1204 } } // namespace v8::internal | 1206 } } // namespace v8::internal |
| 1205 | 1207 |
| 1206 #endif // V8_HYDROGEN_H_ | 1208 #endif // V8_HYDROGEN_H_ |
| OLD | NEW |