| 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 #ifndef V8_COMPILER_FRAME_STATES_H_ | 5 #ifndef V8_COMPILER_FRAME_STATES_H_ |
| 6 #define V8_COMPILER_FRAME_STATES_H_ | 6 #define V8_COMPILER_FRAME_STATES_H_ |
| 7 | 7 |
| 8 #include "src/builtins/builtins.h" |
| 8 #include "src/handles.h" | 9 #include "src/handles.h" |
| 9 #include "src/objects/shared-function-info.h" | 10 #include "src/objects/shared-function-info.h" |
| 10 #include "src/utils.h" | 11 #include "src/utils.h" |
| 11 | 12 |
| 12 namespace v8 { | 13 namespace v8 { |
| 13 namespace internal { | 14 namespace internal { |
| 14 | 15 |
| 15 namespace compiler { | 16 namespace compiler { |
| 16 | 17 |
| 18 class JSGraph; |
| 19 class Node; |
| 20 |
| 17 // Flag that describes how to combine the current environment with | 21 // Flag that describes how to combine the current environment with |
| 18 // the output of a node to obtain a framestate for lazy bailout. | 22 // the output of a node to obtain a framestate for lazy bailout. |
| 19 class OutputFrameStateCombine { | 23 class OutputFrameStateCombine { |
| 20 public: | 24 public: |
| 21 enum Kind { | 25 enum Kind { |
| 22 kPushOutput, // Push the output on the expression stack. | 26 kPushOutput, // Push the output on the expression stack. |
| 23 kPokeAt // Poke at the given environment location, | 27 kPokeAt // Poke at the given environment location, |
| 24 // counting from the top of the stack. | 28 // counting from the top of the stack. |
| 25 }; | 29 }; |
| 26 | 30 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 | 77 |
| 74 | 78 |
| 75 // The type of stack frame that a FrameState node represents. | 79 // The type of stack frame that a FrameState node represents. |
| 76 enum class FrameStateType { | 80 enum class FrameStateType { |
| 77 kJavaScriptFunction, // Represents an unoptimized JavaScriptFrame. | 81 kJavaScriptFunction, // Represents an unoptimized JavaScriptFrame. |
| 78 kInterpretedFunction, // Represents an InterpretedFrame. | 82 kInterpretedFunction, // Represents an InterpretedFrame. |
| 79 kArgumentsAdaptor, // Represents an ArgumentsAdaptorFrame. | 83 kArgumentsAdaptor, // Represents an ArgumentsAdaptorFrame. |
| 80 kTailCallerFunction, // Represents a frame removed by tail call elimination. | 84 kTailCallerFunction, // Represents a frame removed by tail call elimination. |
| 81 kConstructStub, // Represents a ConstructStubFrame. | 85 kConstructStub, // Represents a ConstructStubFrame. |
| 82 kGetterStub, // Represents a GetterStubFrame. | 86 kGetterStub, // Represents a GetterStubFrame. |
| 83 kSetterStub // Represents a SetterStubFrame. | 87 kSetterStub, // Represents a SetterStubFrame. |
| 88 kBuiltinContinuation, // Represents a continuation to a stub. |
| 89 kJavaScriptBuiltinContinuation // Represents a continuation to a JavaScipt |
| 90 // builtin. |
| 84 }; | 91 }; |
| 85 | 92 |
| 86 class FrameStateFunctionInfo { | 93 class FrameStateFunctionInfo { |
| 87 public: | 94 public: |
| 88 FrameStateFunctionInfo(FrameStateType type, int parameter_count, | 95 FrameStateFunctionInfo(FrameStateType type, int parameter_count, |
| 89 int local_count, | 96 int local_count, |
| 90 Handle<SharedFunctionInfo> shared_info) | 97 Handle<SharedFunctionInfo> shared_info) |
| 91 : type_(type), | 98 : type_(type), |
| 92 parameter_count_(parameter_count), | 99 parameter_count_(parameter_count), |
| 93 local_count_(local_count), | 100 local_count_(local_count), |
| 94 shared_info_(shared_info) {} | 101 shared_info_(shared_info) {} |
| 95 | 102 |
| 96 int local_count() const { return local_count_; } | 103 int local_count() const { return local_count_; } |
| 97 int parameter_count() const { return parameter_count_; } | 104 int parameter_count() const { return parameter_count_; } |
| 98 Handle<SharedFunctionInfo> shared_info() const { return shared_info_; } | 105 Handle<SharedFunctionInfo> shared_info() const { return shared_info_; } |
| 99 FrameStateType type() const { return type_; } | 106 FrameStateType type() const { return type_; } |
| 100 | 107 |
| 101 static bool IsJSFunctionType(FrameStateType type) { | 108 static bool IsJSFunctionType(FrameStateType type) { |
| 102 return type == FrameStateType::kJavaScriptFunction || | 109 return type == FrameStateType::kJavaScriptFunction || |
| 103 type == FrameStateType::kInterpretedFunction; | 110 type == FrameStateType::kInterpretedFunction || |
| 111 type == FrameStateType::kJavaScriptBuiltinContinuation; |
| 104 } | 112 } |
| 105 | 113 |
| 106 private: | 114 private: |
| 107 FrameStateType const type_; | 115 FrameStateType const type_; |
| 108 int const parameter_count_; | 116 int const parameter_count_; |
| 109 int const local_count_; | 117 int const local_count_; |
| 110 Handle<SharedFunctionInfo> const shared_info_; | 118 Handle<SharedFunctionInfo> const shared_info_; |
| 111 }; | 119 }; |
| 112 | 120 |
| 113 | 121 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 std::ostream& operator<<(std::ostream&, FrameStateInfo const&); | 159 std::ostream& operator<<(std::ostream&, FrameStateInfo const&); |
| 152 | 160 |
| 153 static const int kFrameStateParametersInput = 0; | 161 static const int kFrameStateParametersInput = 0; |
| 154 static const int kFrameStateLocalsInput = 1; | 162 static const int kFrameStateLocalsInput = 1; |
| 155 static const int kFrameStateStackInput = 2; | 163 static const int kFrameStateStackInput = 2; |
| 156 static const int kFrameStateContextInput = 3; | 164 static const int kFrameStateContextInput = 3; |
| 157 static const int kFrameStateFunctionInput = 4; | 165 static const int kFrameStateFunctionInput = 4; |
| 158 static const int kFrameStateOuterStateInput = 5; | 166 static const int kFrameStateOuterStateInput = 5; |
| 159 static const int kFrameStateInputCount = kFrameStateOuterStateInput + 1; | 167 static const int kFrameStateInputCount = kFrameStateOuterStateInput + 1; |
| 160 | 168 |
| 169 enum class ContinuationFrameStateMode { EAGER, LAZY }; |
| 170 |
| 171 Node* CreateStubBuiltinContinuationFrameState(JSGraph* graph, |
| 172 Builtins::Name name, |
| 173 Node* context, Node** parameters, |
| 174 int parameter_count, |
| 175 Node* outer_frame_state, |
| 176 ContinuationFrameStateMode mode); |
| 177 |
| 178 Node* CreateJavaScriptBuiltinContinuationFrameState( |
| 179 JSGraph* graph, Handle<JSFunction> function, Builtins::Name name, |
| 180 Node* target, Node* context, Node** stack_parameters, |
| 181 int stack_parameter_count, Node* outer_frame_state, |
| 182 ContinuationFrameStateMode mode); |
| 183 |
| 161 } // namespace compiler | 184 } // namespace compiler |
| 162 } // namespace internal | 185 } // namespace internal |
| 163 } // namespace v8 | 186 } // namespace v8 |
| 164 | 187 |
| 165 #endif // V8_COMPILER_FRAME_STATES_H_ | 188 #endif // V8_COMPILER_FRAME_STATES_H_ |
| OLD | NEW |