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_BYTECODE_GRAPH_BUILDER_H_ | 5 #ifndef V8_COMPILER_BYTECODE_GRAPH_BUILDER_H_ |
6 #define V8_COMPILER_BYTECODE_GRAPH_BUILDER_H_ | 6 #define V8_COMPILER_BYTECODE_GRAPH_BUILDER_H_ |
7 | 7 |
8 #include "src/compiler/bytecode-analysis.h" | 8 #include "src/compiler/bytecode-analysis.h" |
9 #include "src/compiler/js-graph.h" | 9 #include "src/compiler/js-graph.h" |
10 #include "src/compiler/liveness-analyzer.h" | 10 #include "src/compiler/liveness-analyzer.h" |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 // Prepare information for eager deoptimization. This information is carried | 128 // Prepare information for eager deoptimization. This information is carried |
129 // by dedicated {Checkpoint} nodes that are wired into the effect chain. | 129 // by dedicated {Checkpoint} nodes that are wired into the effect chain. |
130 // Conceptually this frame state is "before" a given operation. | 130 // Conceptually this frame state is "before" a given operation. |
131 void PrepareEagerCheckpoint(); | 131 void PrepareEagerCheckpoint(); |
132 | 132 |
133 // Prepare information for lazy deoptimization. This information is attached | 133 // Prepare information for lazy deoptimization. This information is attached |
134 // to the given node and the output value produced by the node is combined. | 134 // to the given node and the output value produced by the node is combined. |
135 // Conceptually this frame state is "after" a given operation. | 135 // Conceptually this frame state is "after" a given operation. |
136 void PrepareFrameState(Node* node, OutputFrameStateCombine combine); | 136 void PrepareFrameState(Node* node, OutputFrameStateCombine combine); |
137 | 137 |
| 138 // Computes register liveness and replaces dead ones in frame states with the |
| 139 // undefined values. |
| 140 void ClearNonLiveSlotsInFrameStates(); |
| 141 |
138 void BuildCreateArguments(CreateArgumentsType type); | 142 void BuildCreateArguments(CreateArgumentsType type); |
139 Node* BuildLoadGlobal(Handle<Name> name, uint32_t feedback_slot_index, | 143 Node* BuildLoadGlobal(Handle<Name> name, uint32_t feedback_slot_index, |
140 TypeofMode typeof_mode); | 144 TypeofMode typeof_mode); |
141 void BuildStoreGlobal(LanguageMode language_mode); | 145 void BuildStoreGlobal(LanguageMode language_mode); |
142 void BuildNamedStore(LanguageMode language_mode); | 146 void BuildNamedStore(LanguageMode language_mode); |
143 void BuildKeyedStore(LanguageMode language_mode); | 147 void BuildKeyedStore(LanguageMode language_mode); |
144 void BuildLdaLookupSlot(TypeofMode typeof_mode); | 148 void BuildLdaLookupSlot(TypeofMode typeof_mode); |
145 void BuildLdaLookupContextSlot(TypeofMode typeof_mode); | 149 void BuildLdaLookupContextSlot(TypeofMode typeof_mode); |
146 void BuildLdaLookupGlobalSlot(TypeofMode typeof_mode); | 150 void BuildLdaLookupGlobalSlot(TypeofMode typeof_mode); |
147 void BuildStaLookupSlot(LanguageMode language_mode); | 151 void BuildStaLookupSlot(LanguageMode language_mode); |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 } | 253 } |
250 | 254 |
251 const BytecodeAnalysis* bytecode_analysis() const { | 255 const BytecodeAnalysis* bytecode_analysis() const { |
252 return bytecode_analysis_; | 256 return bytecode_analysis_; |
253 } | 257 } |
254 | 258 |
255 void set_bytecode_analysis(const BytecodeAnalysis* bytecode_analysis) { | 259 void set_bytecode_analysis(const BytecodeAnalysis* bytecode_analysis) { |
256 bytecode_analysis_ = bytecode_analysis; | 260 bytecode_analysis_ = bytecode_analysis; |
257 } | 261 } |
258 | 262 |
| 263 LivenessAnalyzer* liveness_analyzer() { return &liveness_analyzer_; } |
| 264 |
259 bool IsLivenessAnalysisEnabled() const { | 265 bool IsLivenessAnalysisEnabled() const { |
260 return this->is_liveness_analysis_enabled_; | 266 return this->is_liveness_analysis_enabled_; |
261 } | 267 } |
262 | 268 |
263 #define DECLARE_VISIT_BYTECODE(name, ...) void Visit##name(); | 269 #define DECLARE_VISIT_BYTECODE(name, ...) void Visit##name(); |
264 BYTECODE_LIST(DECLARE_VISIT_BYTECODE) | 270 BYTECODE_LIST(DECLARE_VISIT_BYTECODE) |
265 #undef DECLARE_VISIT_BYTECODE | 271 #undef DECLARE_VISIT_BYTECODE |
266 | 272 |
267 Zone* local_zone_; | 273 Zone* local_zone_; |
268 JSGraph* jsgraph_; | 274 JSGraph* jsgraph_; |
(...skipping 25 matching lines...) Expand all Loading... |
294 SetOncePointer<Node> function_closure_; | 300 SetOncePointer<Node> function_closure_; |
295 SetOncePointer<Node> new_target_; | 301 SetOncePointer<Node> new_target_; |
296 | 302 |
297 // Control nodes that exit the function body. | 303 // Control nodes that exit the function body. |
298 ZoneVector<Node*> exit_controls_; | 304 ZoneVector<Node*> exit_controls_; |
299 | 305 |
300 bool const is_liveness_analysis_enabled_; | 306 bool const is_liveness_analysis_enabled_; |
301 | 307 |
302 StateValuesCache state_values_cache_; | 308 StateValuesCache state_values_cache_; |
303 | 309 |
| 310 // Analyzer of register liveness. |
| 311 LivenessAnalyzer liveness_analyzer_; |
| 312 |
304 // The Turbofan source position table, to be populated. | 313 // The Turbofan source position table, to be populated. |
305 SourcePositionTable* source_positions_; | 314 SourcePositionTable* source_positions_; |
306 | 315 |
307 SourcePosition const start_position_; | 316 SourcePosition const start_position_; |
308 | 317 |
309 // Update [source_positions_]'s current position to that of the bytecode at | 318 // Update [source_positions_]'s current position to that of the bytecode at |
310 // [offset], if any. | 319 // [offset], if any. |
311 void UpdateCurrentSourcePosition(SourcePositionTableIterator* it, int offset); | 320 void UpdateCurrentSourcePosition(SourcePositionTableIterator* it, int offset); |
312 | 321 |
313 static int const kBinaryOperationHintIndex = 1; | 322 static int const kBinaryOperationHintIndex = 1; |
314 static int const kCountOperationHintIndex = 0; | 323 static int const kCountOperationHintIndex = 0; |
315 static int const kBinaryOperationSmiHintIndex = 2; | 324 static int const kBinaryOperationSmiHintIndex = 2; |
316 | 325 |
317 DISALLOW_COPY_AND_ASSIGN(BytecodeGraphBuilder); | 326 DISALLOW_COPY_AND_ASSIGN(BytecodeGraphBuilder); |
318 }; | 327 }; |
319 | 328 |
320 } // namespace compiler | 329 } // namespace compiler |
321 } // namespace internal | 330 } // namespace internal |
322 } // namespace v8 | 331 } // namespace v8 |
323 | 332 |
324 #endif // V8_COMPILER_BYTECODE_GRAPH_BUILDER_H_ | 333 #endif // V8_COMPILER_BYTECODE_GRAPH_BUILDER_H_ |
OLD | NEW |