Line data Source code
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
3 : // found in the LICENSE file.
4 :
5 : #include "src/compiler/frame-states.h"
6 :
7 : #include "src/base/functional.h"
8 : #include "src/handles-inl.h"
9 : #include "src/objects-inl.h"
10 :
11 : namespace v8 {
12 : namespace internal {
13 : namespace compiler {
14 :
15 15815049 : size_t hash_value(OutputFrameStateCombine const& sc) {
16 15814958 : return base::hash_combine(sc.kind_, sc.parameter_);
17 : }
18 :
19 :
20 0 : std::ostream& operator<<(std::ostream& os, OutputFrameStateCombine const& sc) {
21 0 : switch (sc.kind_) {
22 : case OutputFrameStateCombine::kPushOutput:
23 0 : if (sc.parameter_ == 0) return os << "Ignore";
24 0 : return os << "Push(" << sc.parameter_ << ")";
25 : case OutputFrameStateCombine::kPokeAt:
26 0 : return os << "PokeAt(" << sc.parameter_ << ")";
27 : }
28 0 : UNREACHABLE();
29 : return os;
30 : }
31 :
32 :
33 9349730 : bool operator==(FrameStateInfo const& lhs, FrameStateInfo const& rhs) {
34 5146967 : return lhs.type() == rhs.type() && lhs.bailout_id() == rhs.bailout_id() &&
35 5139539 : lhs.state_combine() == rhs.state_combine() &&
36 4674865 : lhs.function_info() == rhs.function_info();
37 : }
38 :
39 :
40 0 : bool operator!=(FrameStateInfo const& lhs, FrameStateInfo const& rhs) {
41 0 : return !(lhs == rhs);
42 : }
43 :
44 :
45 31630182 : size_t hash_value(FrameStateInfo const& info) {
46 : return base::hash_combine(static_cast<int>(info.type()), info.bailout_id(),
47 31629963 : info.state_combine());
48 : }
49 :
50 :
51 0 : std::ostream& operator<<(std::ostream& os, FrameStateType type) {
52 0 : switch (type) {
53 : case FrameStateType::kJavaScriptFunction:
54 0 : os << "JS_FRAME";
55 0 : break;
56 : case FrameStateType::kInterpretedFunction:
57 0 : os << "INTERPRETED_FRAME";
58 0 : break;
59 : case FrameStateType::kArgumentsAdaptor:
60 0 : os << "ARGUMENTS_ADAPTOR";
61 0 : break;
62 : case FrameStateType::kTailCallerFunction:
63 0 : os << "TAIL_CALLER_FRAME";
64 0 : break;
65 : case FrameStateType::kConstructStub:
66 0 : os << "CONSTRUCT_STUB";
67 0 : break;
68 : case FrameStateType::kGetterStub:
69 0 : os << "GETTER_STUB";
70 0 : break;
71 : case FrameStateType::kSetterStub:
72 0 : os << "SETTER_STUB";
73 0 : break;
74 : }
75 0 : return os;
76 : }
77 :
78 :
79 0 : std::ostream& operator<<(std::ostream& os, FrameStateInfo const& info) {
80 0 : os << info.type() << ", " << info.bailout_id() << ", "
81 0 : << info.state_combine();
82 : Handle<SharedFunctionInfo> shared_info;
83 0 : if (info.shared_info().ToHandle(&shared_info)) {
84 0 : os << ", " << Brief(*shared_info);
85 : }
86 0 : return os;
87 : }
88 :
89 : } // namespace compiler
90 : } // namespace internal
91 : } // namespace v8
|