OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1157 } | 1157 } |
1158 } else { | 1158 } else { |
1159 present_flags_ |= array_[i].value->flags(); // Keep it. | 1159 present_flags_ |= array_[i].value->flags(); // Keep it. |
1160 } | 1160 } |
1161 } | 1161 } |
1162 } | 1162 } |
1163 } | 1163 } |
1164 | 1164 |
1165 | 1165 |
1166 HValue* HValueMap::Lookup(HValue* value) const { | 1166 HValue* HValueMap::Lookup(HValue* value) const { |
1167 uint32_t hash = value->Hashcode(); | 1167 uint32_t hash = static_cast<uint32_t>(value->Hashcode()); |
1168 uint32_t pos = Bound(hash); | 1168 uint32_t pos = Bound(hash); |
1169 if (array_[pos].value != NULL) { | 1169 if (array_[pos].value != NULL) { |
1170 if (array_[pos].value->Equals(value)) return array_[pos].value; | 1170 if (array_[pos].value->Equals(value)) return array_[pos].value; |
1171 int next = array_[pos].next; | 1171 int next = array_[pos].next; |
1172 while (next != kNil) { | 1172 while (next != kNil) { |
1173 if (lists_[next].value->Equals(value)) return lists_[next].value; | 1173 if (lists_[next].value->Equals(value)) return lists_[next].value; |
1174 next = lists_[next].next; | 1174 next = lists_[next].next; |
1175 } | 1175 } |
1176 } | 1176 } |
1177 return NULL; | 1177 return NULL; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1245 } | 1245 } |
1246 } | 1246 } |
1247 | 1247 |
1248 | 1248 |
1249 void HValueMap::Insert(HValue* value) { | 1249 void HValueMap::Insert(HValue* value) { |
1250 ASSERT(value != NULL); | 1250 ASSERT(value != NULL); |
1251 // Resizing when half of the hashtable is filled up. | 1251 // Resizing when half of the hashtable is filled up. |
1252 if (count_ >= array_size_ >> 1) Resize(array_size_ << 1); | 1252 if (count_ >= array_size_ >> 1) Resize(array_size_ << 1); |
1253 ASSERT(count_ < array_size_); | 1253 ASSERT(count_ < array_size_); |
1254 count_++; | 1254 count_++; |
1255 uint32_t pos = Bound(value->Hashcode()); | 1255 uint32_t pos = Bound(static_cast<uint32_t>(value->Hashcode())); |
1256 if (array_[pos].value == NULL) { | 1256 if (array_[pos].value == NULL) { |
1257 array_[pos].value = value; | 1257 array_[pos].value = value; |
1258 array_[pos].next = kNil; | 1258 array_[pos].next = kNil; |
1259 } else { | 1259 } else { |
1260 if (free_list_head_ == kNil) { | 1260 if (free_list_head_ == kNil) { |
1261 ResizeLists(lists_size_ << 1); | 1261 ResizeLists(lists_size_ << 1); |
1262 } | 1262 } |
1263 int new_element_pos = free_list_head_; | 1263 int new_element_pos = free_list_head_; |
1264 ASSERT(new_element_pos != kNil); | 1264 ASSERT(new_element_pos != kNil); |
1265 free_list_head_ = lists_[free_list_head_].next; | 1265 free_list_head_ = lists_[free_list_head_].next; |
(...skipping 4265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5531 } | 5531 } |
5532 | 5532 |
5533 #ifdef DEBUG | 5533 #ifdef DEBUG |
5534 if (graph_ != NULL) graph_->Verify(); | 5534 if (graph_ != NULL) graph_->Verify(); |
5535 if (chunk_ != NULL) chunk_->Verify(); | 5535 if (chunk_ != NULL) chunk_->Verify(); |
5536 if (allocator_ != NULL) allocator_->Verify(); | 5536 if (allocator_ != NULL) allocator_->Verify(); |
5537 #endif | 5537 #endif |
5538 } | 5538 } |
5539 | 5539 |
5540 } } // namespace v8::internal | 5540 } } // namespace v8::internal |
OLD | NEW |