| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 #include "src/compiler/state-values-utils.h" | 5 #include "src/compiler/state-values-utils.h" |
| 6 | 6 |
| 7 namespace v8 { | 7 namespace v8 { |
| 8 namespace internal { | 8 namespace internal { |
| 9 namespace compiler { | 9 namespace compiler { |
| 10 | 10 |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 } | 163 } |
| 164 if (count == 1) { | 164 if (count == 1) { |
| 165 return (*buffer)[0]; | 165 return (*buffer)[0]; |
| 166 } else { | 166 } else { |
| 167 return GetValuesNodeFromCache(&(buffer->front()), count); | 167 return GetValuesNodeFromCache(&(buffer->front()), count); |
| 168 } | 168 } |
| 169 } | 169 } |
| 170 | 170 |
| 171 | 171 |
| 172 Node* StateValuesCache::GetNodeForValues(Node** values, size_t count) { | 172 Node* StateValuesCache::GetNodeForValues(Node** values, size_t count) { |
| 173 #if DEBUG |
| 174 for (size_t i = 0; i < count; i++) { |
| 175 DCHECK_NE(values[i]->opcode(), IrOpcode::kStateValues); |
| 176 } |
| 177 #endif |
| 173 if (count == 0) { | 178 if (count == 0) { |
| 174 return GetEmptyStateValues(); | 179 return GetEmptyStateValues(); |
| 175 } | 180 } |
| 176 size_t height = 0; | 181 size_t height = 0; |
| 177 size_t max_nodes = 1; | 182 size_t max_nodes = 1; |
| 178 while (count > max_nodes) { | 183 while (count > max_nodes) { |
| 179 height++; | 184 height++; |
| 180 max_nodes *= kMaxInputCount; | 185 max_nodes *= kMaxInputCount; |
| 181 } | 186 } |
| 182 | 187 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 } else { | 289 } else { |
| 285 count++; | 290 count++; |
| 286 } | 291 } |
| 287 } | 292 } |
| 288 return count; | 293 return count; |
| 289 } | 294 } |
| 290 | 295 |
| 291 } // namespace compiler | 296 } // namespace compiler |
| 292 } // namespace internal | 297 } // namespace internal |
| 293 } // namespace v8 | 298 } // namespace v8 |
| OLD | NEW |