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/base/functional.h" | 5 #include "src/base/functional.h" |
6 #include "src/compiler/frame-states.h" | 6 #include "src/compiler/frame-states.h" |
7 | 7 |
8 namespace v8 { | 8 namespace v8 { |
9 namespace internal { | 9 namespace internal { |
10 namespace compiler { | 10 namespace compiler { |
11 | 11 |
12 size_t hash_value(OutputFrameStateCombine const& sc) { | 12 size_t hash_value(OutputFrameStateCombine const& sc) { |
13 return base::hash_combine(sc.kind_, sc.parameter_); | 13 return base::hash_combine(sc.kind_, sc.parameter_); |
14 } | 14 } |
15 | 15 |
16 | 16 |
17 std::ostream& operator<<(std::ostream& os, OutputFrameStateCombine const& sc) { | 17 std::ostream& operator<<(std::ostream& os, OutputFrameStateCombine const& sc) { |
18 switch (sc.kind_) { | 18 switch (sc.kind_) { |
19 case OutputFrameStateCombine::kPushOutput: | 19 case OutputFrameStateCombine::kPushOutput: |
20 if (sc.parameter_ == 0) return os << "Ignore"; | 20 if (sc.parameter_ == 0) return os << "Ignore"; |
21 return os << "Push(" << sc.parameter_ << ")"; | 21 return os << "Push(" << sc.parameter_ << ")"; |
22 case OutputFrameStateCombine::kPokeAt: | 22 case OutputFrameStateCombine::kPokeAt: |
23 return os << "PokeAt(" << sc.parameter_ << ")"; | 23 return os << "PokeAt(" << sc.parameter_ << ")"; |
24 } | 24 } |
25 UNREACHABLE(); | 25 UNREACHABLE(); |
26 return os; | 26 return os; |
27 } | 27 } |
28 | 28 |
29 | 29 |
30 bool operator==(FrameStateCallInfo const& lhs, FrameStateCallInfo const& rhs) { | 30 bool operator==(FrameStateInfo const& lhs, FrameStateInfo const& rhs) { |
31 return lhs.type() == rhs.type() && lhs.bailout_id() == rhs.bailout_id() && | 31 return lhs.type() == rhs.type() && lhs.bailout_id() == rhs.bailout_id() && |
32 lhs.state_combine() == rhs.state_combine(); | 32 lhs.state_combine() == rhs.state_combine() && |
| 33 lhs.function_info() == rhs.function_info(); |
33 } | 34 } |
34 | 35 |
35 | 36 |
36 bool operator!=(FrameStateCallInfo const& lhs, FrameStateCallInfo const& rhs) { | 37 bool operator!=(FrameStateInfo const& lhs, FrameStateInfo const& rhs) { |
37 return !(lhs == rhs); | 38 return !(lhs == rhs); |
38 } | 39 } |
39 | 40 |
40 | 41 |
41 size_t hash_value(FrameStateCallInfo const& info) { | 42 size_t hash_value(FrameStateInfo const& info) { |
42 return base::hash_combine(info.type(), info.bailout_id(), | 43 return base::hash_combine(static_cast<int>(info.type()), info.bailout_id(), |
43 info.state_combine()); | 44 info.state_combine()); |
44 } | 45 } |
45 | 46 |
46 | 47 |
47 std::ostream& operator<<(std::ostream& os, FrameStateCallInfo const& info) { | 48 std::ostream& operator<<(std::ostream& os, FrameStateType type) { |
| 49 switch (type) { |
| 50 case FrameStateType::kJavaScriptFunction: |
| 51 os << "JS_FRAME"; |
| 52 break; |
| 53 case FrameStateType::kArgumentsAdaptor: |
| 54 os << "ARGUMENTS_ADAPTOR"; |
| 55 break; |
| 56 } |
| 57 return os; |
| 58 } |
| 59 |
| 60 |
| 61 std::ostream& operator<<(std::ostream& os, FrameStateInfo const& info) { |
48 os << info.type() << ", " << info.bailout_id() << ", " | 62 os << info.type() << ", " << info.bailout_id() << ", " |
49 << info.state_combine(); | 63 << info.state_combine(); |
50 Handle<SharedFunctionInfo> shared_info; | 64 Handle<SharedFunctionInfo> shared_info; |
51 if (info.shared_info().ToHandle(&shared_info)) { | 65 if (info.shared_info().ToHandle(&shared_info)) { |
52 os << ", " << Brief(*shared_info); | 66 os << ", " << Brief(*shared_info); |
53 } | 67 } |
54 return os; | 68 return os; |
55 } | 69 } |
56 | 70 |
57 } // namespace compiler | 71 } // namespace compiler |
58 } // namespace internal | 72 } // namespace internal |
59 } // namespace v8 | 73 } // namespace v8 |
OLD | NEW |