OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef V8_COMPILER_COMMON_OPERATOR_H_ | 5 #ifndef V8_COMPILER_COMMON_OPERATOR_H_ |
6 #define V8_COMPILER_COMMON_OPERATOR_H_ | 6 #define V8_COMPILER_COMMON_OPERATOR_H_ |
7 | 7 |
8 #include "src/compiler/machine-type.h" | 8 #include "src/compiler/machine-type.h" |
9 #include "src/unique.h" | |
10 | 9 |
11 namespace v8 { | 10 namespace v8 { |
12 namespace internal { | 11 namespace internal { |
13 | 12 |
14 // Forward declarations. | 13 // Forward declarations. |
15 class ExternalReference; | 14 class ExternalReference; |
16 class OStream; | 15 class OStream; |
| 16 template <typename> |
| 17 class Unique; |
| 18 class Zone; |
17 | 19 |
18 | 20 |
19 namespace compiler { | 21 namespace compiler { |
20 | 22 |
21 // Forward declarations. | 23 // Forward declarations. |
22 class CallDescriptor; | 24 class CallDescriptor; |
23 struct CommonOperatorBuilderImpl; | 25 struct CommonOperatorBuilderImpl; |
24 class Operator; | 26 class Operator; |
25 | 27 |
26 | 28 |
27 // Flag that describes how to combine the current environment with | 29 // Flag that describes how to combine the current environment with |
28 // the output of a node to obtain a framestate for lazy bailout. | 30 // the output of a node to obtain a framestate for lazy bailout. |
29 enum OutputFrameStateCombine { | 31 enum OutputFrameStateCombine { |
30 kPushOutput, // Push the output on the expression stack. | 32 kPushOutput, // Push the output on the expression stack. |
31 kIgnoreOutput // Use the frame state as-is. | 33 kIgnoreOutput // Use the frame state as-is. |
32 }; | 34 }; |
33 | 35 |
34 | 36 |
35 // The type of stack frame that a FrameState node represents. | |
36 enum FrameStateType { | |
37 JS_FRAME, // Represents an unoptimized JavaScriptFrame. | |
38 ARGUMENTS_ADAPTOR // Represents an ArgumentsAdaptorFrame. | |
39 }; | |
40 | |
41 | |
42 class FrameStateCallInfo FINAL { | 37 class FrameStateCallInfo FINAL { |
43 public: | 38 public: |
44 FrameStateCallInfo( | 39 FrameStateCallInfo(BailoutId bailout_id, |
45 FrameStateType type, BailoutId bailout_id, | 40 OutputFrameStateCombine state_combine) |
46 OutputFrameStateCombine state_combine, | 41 : bailout_id_(bailout_id), frame_state_combine_(state_combine) {} |
47 MaybeHandle<JSFunction> jsfunction = MaybeHandle<JSFunction>()) | |
48 : type_(type), | |
49 bailout_id_(bailout_id), | |
50 frame_state_combine_(state_combine), | |
51 jsfunction_(jsfunction) {} | |
52 | 42 |
53 FrameStateType type() const { return type_; } | |
54 BailoutId bailout_id() const { return bailout_id_; } | 43 BailoutId bailout_id() const { return bailout_id_; } |
55 OutputFrameStateCombine state_combine() const { return frame_state_combine_; } | 44 OutputFrameStateCombine state_combine() const { return frame_state_combine_; } |
56 MaybeHandle<JSFunction> jsfunction() const { return jsfunction_; } | |
57 | 45 |
58 private: | 46 private: |
59 FrameStateType type_; | |
60 BailoutId bailout_id_; | 47 BailoutId bailout_id_; |
61 OutputFrameStateCombine frame_state_combine_; | 48 OutputFrameStateCombine frame_state_combine_; |
62 MaybeHandle<JSFunction> jsfunction_; | |
63 }; | 49 }; |
64 | 50 |
65 | 51 |
66 // Interface for building common operators that can be used at any level of IR, | 52 // Interface for building common operators that can be used at any level of IR, |
67 // including JavaScript, mid-level, and low-level. | 53 // including JavaScript, mid-level, and low-level. |
68 class CommonOperatorBuilder FINAL { | 54 class CommonOperatorBuilder FINAL { |
69 public: | 55 public: |
70 explicit CommonOperatorBuilder(Zone* zone); | 56 explicit CommonOperatorBuilder(Zone* zone); |
71 | 57 |
72 const Operator* Dead(); | 58 const Operator* Dead(); |
(...skipping 15 matching lines...) Expand all Loading... |
88 const Operator* ExternalConstant(const ExternalReference&); | 74 const Operator* ExternalConstant(const ExternalReference&); |
89 const Operator* NumberConstant(volatile double); | 75 const Operator* NumberConstant(volatile double); |
90 const Operator* HeapConstant(const Unique<Object>&); | 76 const Operator* HeapConstant(const Unique<Object>&); |
91 | 77 |
92 const Operator* Phi(MachineType type, int arguments); | 78 const Operator* Phi(MachineType type, int arguments); |
93 const Operator* EffectPhi(int arguments); | 79 const Operator* EffectPhi(int arguments); |
94 const Operator* ControlEffect(); | 80 const Operator* ControlEffect(); |
95 const Operator* ValueEffect(int arguments); | 81 const Operator* ValueEffect(int arguments); |
96 const Operator* Finish(int arguments); | 82 const Operator* Finish(int arguments); |
97 const Operator* StateValues(int arguments); | 83 const Operator* StateValues(int arguments); |
98 const Operator* FrameState( | 84 const Operator* FrameState(BailoutId bailout_id, |
99 FrameStateType type, BailoutId bailout_id, | 85 OutputFrameStateCombine combine); |
100 OutputFrameStateCombine state_combine, | |
101 MaybeHandle<JSFunction> jsfunction = MaybeHandle<JSFunction>()); | |
102 const Operator* Call(const CallDescriptor* descriptor); | 86 const Operator* Call(const CallDescriptor* descriptor); |
103 const Operator* Projection(size_t index); | 87 const Operator* Projection(size_t index); |
104 | 88 |
105 private: | 89 private: |
106 Zone* zone() const { return zone_; } | 90 Zone* zone() const { return zone_; } |
107 | 91 |
108 const CommonOperatorBuilderImpl& impl_; | 92 const CommonOperatorBuilderImpl& impl_; |
109 Zone* const zone_; | 93 Zone* const zone_; |
110 }; | 94 }; |
111 | 95 |
112 } // namespace compiler | 96 } // namespace compiler |
113 } // namespace internal | 97 } // namespace internal |
114 } // namespace v8 | 98 } // namespace v8 |
115 | 99 |
116 #endif // V8_COMPILER_COMMON_OPERATOR_H_ | 100 #endif // V8_COMPILER_COMMON_OPERATOR_H_ |
OLD | NEW |