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