Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(92)

Side by Side Diff: src/compiler/frame-states.h

Issue 1131853002: [turbofan] Extract frame-states.h from common-operator.h (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/compiler/common-operator.cc ('k') | src/compiler/frame-states.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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 #ifndef V8_COMPILER_FRAME_STATES_H_
6 #define V8_COMPILER_FRAME_STATES_H_
7
8 #include "src/handles-inl.h" // TODO(everyone): Fix our inl.h crap
9 #include "src/objects-inl.h" // TODO(everyone): Fix our inl.h crap
10 #include "src/utils.h"
11
12 namespace v8 {
13 namespace internal {
14 namespace compiler {
15
16 // Flag that describes how to combine the current environment with
17 // the output of a node to obtain a framestate for lazy bailout.
18 class OutputFrameStateCombine {
19 public:
20 enum Kind {
21 kPushOutput, // Push the output on the expression stack.
22 kPokeAt // Poke at the given environment location,
23 // counting from the top of the stack.
24 };
25
26 static OutputFrameStateCombine Ignore() {
27 return OutputFrameStateCombine(kPushOutput, 0);
28 }
29 static OutputFrameStateCombine Push(size_t count = 1) {
30 return OutputFrameStateCombine(kPushOutput, count);
31 }
32 static OutputFrameStateCombine PokeAt(size_t index) {
33 return OutputFrameStateCombine(kPokeAt, index);
34 }
35
36 Kind kind() const { return kind_; }
37 size_t GetPushCount() const {
38 DCHECK_EQ(kPushOutput, kind());
39 return parameter_;
40 }
41 size_t GetOffsetToPokeAt() const {
42 DCHECK_EQ(kPokeAt, kind());
43 return parameter_;
44 }
45
46 bool IsOutputIgnored() const {
47 return kind_ == kPushOutput && parameter_ == 0;
48 }
49
50 size_t ConsumedOutputCount() const {
51 return kind_ == kPushOutput ? GetPushCount() : 1;
52 }
53
54 bool operator==(OutputFrameStateCombine const& other) const {
55 return kind_ == other.kind_ && parameter_ == other.parameter_;
56 }
57 bool operator!=(OutputFrameStateCombine const& other) const {
58 return !(*this == other);
59 }
60
61 friend size_t hash_value(OutputFrameStateCombine const&);
62 friend std::ostream& operator<<(std::ostream&,
63 OutputFrameStateCombine const&);
64
65 private:
66 OutputFrameStateCombine(Kind kind, size_t parameter)
67 : kind_(kind), parameter_(parameter) {}
68
69 Kind const kind_;
70 size_t const parameter_;
71 };
72
73
74 // The type of stack frame that a FrameState node represents.
75 enum FrameStateType {
76 JS_FRAME, // Represents an unoptimized JavaScriptFrame.
77 ARGUMENTS_ADAPTOR // Represents an ArgumentsAdaptorFrame.
78 };
79
80
81 class FrameStateCallInfo final {
82 public:
83 FrameStateCallInfo(
84 FrameStateType type, BailoutId bailout_id,
85 OutputFrameStateCombine state_combine,
86 MaybeHandle<JSFunction> jsfunction = MaybeHandle<JSFunction>())
87 : type_(type),
88 bailout_id_(bailout_id),
89 frame_state_combine_(state_combine),
90 jsfunction_(jsfunction) {}
91
92 FrameStateType type() const { return type_; }
93 BailoutId bailout_id() const { return bailout_id_; }
94 OutputFrameStateCombine state_combine() const { return frame_state_combine_; }
95 MaybeHandle<JSFunction> jsfunction() const { return jsfunction_; }
96
97 private:
98 FrameStateType type_;
99 BailoutId bailout_id_;
100 OutputFrameStateCombine frame_state_combine_;
101 MaybeHandle<JSFunction> jsfunction_;
102 };
103
104 bool operator==(FrameStateCallInfo const&, FrameStateCallInfo const&);
105 bool operator!=(FrameStateCallInfo const&, FrameStateCallInfo const&);
106
107 size_t hash_value(FrameStateCallInfo const&);
108
109 std::ostream& operator<<(std::ostream&, FrameStateCallInfo const&);
110
111
112 } // namespace compiler
113 } // namespace internal
114 } // namespace v8
115
116 #endif // V8_COMPILER_FRAME_STATES_H_
OLDNEW
« no previous file with comments | « src/compiler/common-operator.cc ('k') | src/compiler/frame-states.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698