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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
| 7 #include "src/base/functional.h" |
7 #include "src/objects.h" | 8 #include "src/objects.h" |
8 #include "src/type-feedback-vector-inl.h" | 9 #include "src/type-feedback-vector-inl.h" |
9 | 10 |
10 namespace v8 { | 11 namespace v8 { |
11 namespace internal { | 12 namespace internal { |
12 | 13 |
| 14 bool operator==(FeedbackNode const& lhs, FeedbackNode const& rhs) { |
| 15 return lhs.slot() == rhs.slot() && lhs.vector().is_identical_to(rhs.vector()); |
| 16 } |
| 17 |
| 18 |
| 19 bool operator!=(FeedbackNode const& lhs, FeedbackNode const& rhs) { |
| 20 return !(lhs == rhs); |
| 21 } |
| 22 |
| 23 |
| 24 size_t hash_value(FeedbackNode const& p) { |
| 25 // TODO(mvstanton): include the vector in the hash. |
| 26 base::hash<int> h; |
| 27 return h(p.slot()); |
| 28 } |
| 29 |
| 30 |
13 // static | 31 // static |
14 Handle<TypeFeedbackVector> TypeFeedbackVector::Copy( | 32 Handle<TypeFeedbackVector> TypeFeedbackVector::Copy( |
15 Isolate* isolate, Handle<TypeFeedbackVector> vector) { | 33 Isolate* isolate, Handle<TypeFeedbackVector> vector) { |
16 Handle<TypeFeedbackVector> result; | 34 Handle<TypeFeedbackVector> result; |
17 result = Handle<TypeFeedbackVector>::cast( | 35 result = Handle<TypeFeedbackVector>::cast( |
18 isolate->factory()->CopyFixedArray(Handle<FixedArray>::cast(vector))); | 36 isolate->factory()->CopyFixedArray(Handle<FixedArray>::cast(vector))); |
19 return result; | 37 return result; |
20 } | 38 } |
21 } | 39 } |
22 } // namespace v8::internal | 40 } // namespace v8::internal |
OLD | NEW |