| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/value-numbering-reducer.h" | 5 #include "src/compiler/value-numbering-reducer.h" |
| 6 | 6 |
| 7 #include <cstring> | 7 #include <cstring> |
| 8 | 8 |
| 9 #include "src/base/functional.h" | 9 #include "src/base/functional.h" |
| 10 #include "src/compiler/node.h" | 10 #include "src/compiler/node.h" |
| 11 | 11 |
| 12 namespace v8 { | 12 namespace v8 { |
| 13 namespace internal { | 13 namespace internal { |
| 14 namespace compiler { | 14 namespace compiler { |
| 15 | 15 |
| 16 namespace { | 16 namespace { |
| 17 | 17 |
| 18 size_t HashCode(Node* node) { | 18 size_t HashCode(Node* node) { |
| 19 size_t h = base::hash_combine(node->op()->HashCode(), node->InputCount()); | 19 size_t h = base::hash_combine(node->op()->HashCode(), node->InputCount()); |
| 20 for (int j = 0; j < node->InputCount(); ++j) { | 20 for (int j = 0; j < node->InputCount(); ++j) { |
| 21 h = base::hash_combine(h, node->InputAt(j)->id()); | 21 h = base::hash_combine(h, node->InputAt(j)->id()); |
| 22 } | 22 } |
| 23 return h; | 23 return h; |
| 24 } | 24 } |
| 25 | 25 |
| 26 | 26 |
| 27 bool Equals(Node* a, Node* b) { | 27 bool Equals(Node* a, Node* b) { |
| 28 DCHECK_NOT_NULL(a); | 28 DCHECK(a); |
| 29 DCHECK_NOT_NULL(b); | 29 DCHECK(b); |
| 30 DCHECK_NOT_NULL(a->op()); | 30 DCHECK(a->op()); |
| 31 DCHECK_NOT_NULL(b->op()); | 31 DCHECK(b->op()); |
| 32 if (!a->op()->Equals(b->op())) return false; | 32 if (!a->op()->Equals(b->op())) return false; |
| 33 if (a->InputCount() != b->InputCount()) return false; | 33 if (a->InputCount() != b->InputCount()) return false; |
| 34 for (int j = 0; j < a->InputCount(); ++j) { | 34 for (int j = 0; j < a->InputCount(); ++j) { |
| 35 DCHECK_NOT_NULL(a->InputAt(j)); | 35 DCHECK(a->InputAt(j)); |
| 36 DCHECK_NOT_NULL(b->InputAt(j)); | 36 DCHECK(b->InputAt(j)); |
| 37 if (a->InputAt(j)->id() != b->InputAt(j)->id()) return false; | 37 if (a->InputAt(j)->id() != b->InputAt(j)->id()) return false; |
| 38 } | 38 } |
| 39 return true; | 39 return true; |
| 40 } | 40 } |
| 41 | 41 |
| 42 } // namespace | 42 } // namespace |
| 43 | 43 |
| 44 | 44 |
| 45 ValueNumberingReducer::ValueNumberingReducer(Zone* zone) | 45 ValueNumberingReducer::ValueNumberingReducer(Zone* zone) |
| 46 : entries_(nullptr), capacity_(0), size_(0), zone_(zone) {} | 46 : entries_(nullptr), capacity_(0), size_(0), zone_(zone) {} |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 size_++; | 155 size_++; |
| 156 break; | 156 break; |
| 157 } | 157 } |
| 158 } | 158 } |
| 159 } | 159 } |
| 160 } | 160 } |
| 161 | 161 |
| 162 } // namespace compiler | 162 } // namespace compiler |
| 163 } // namespace internal | 163 } // namespace internal |
| 164 } // namespace v8 | 164 } // namespace v8 |
| OLD | NEW |