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

Side by Side Diff: src/compiler/ast-graph-builder.h

Issue 470573002: Revert "Refactor building of lazy bailouts in AstGraphBuilder." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/compiler/ast-graph-builder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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_AST_GRAPH_BUILDER_H_ 5 #ifndef V8_COMPILER_AST_GRAPH_BUILDER_H_
6 #define V8_COMPILER_AST_GRAPH_BUILDER_H_ 6 #define V8_COMPILER_AST_GRAPH_BUILDER_H_
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/ast.h" 10 #include "src/ast.h"
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 void VisitNot(UnaryOperation* expr); 164 void VisitNot(UnaryOperation* expr);
165 165
166 // Dispatched from VisitBinaryOperation. 166 // Dispatched from VisitBinaryOperation.
167 void VisitComma(BinaryOperation* expr); 167 void VisitComma(BinaryOperation* expr);
168 void VisitLogicalExpression(BinaryOperation* expr); 168 void VisitLogicalExpression(BinaryOperation* expr);
169 void VisitArithmeticExpression(BinaryOperation* expr); 169 void VisitArithmeticExpression(BinaryOperation* expr);
170 170
171 // Dispatched from VisitForInStatement. 171 // Dispatched from VisitForInStatement.
172 void VisitForInAssignment(Expression* expr, Node* value); 172 void VisitForInAssignment(Expression* expr, Node* value);
173 173
174 // Flag that describes how to combine the current environment with 174 void BuildLazyBailout(Node* node, BailoutId ast_id);
175 // the output of a node to obtain a framestate for lazy bailout. 175 void BuildLazyBailoutWithPushedNode(Node* node, BailoutId ast_id);
176 enum OutputFrameStateCombine {
177 PUSH_OUTPUT, // Push the output on the expression stack.
178 IGNORE_OUTPUT // Use the frame state as-is.
179 };
180
181 // Builds deoptimization for a given node.
182 void PrepareFrameState(Node* node, BailoutId ast_id,
183 OutputFrameStateCombine combine = IGNORE_OUTPUT);
184
185 OutputFrameStateCombine StateCombineFromAstContext();
186 176
187 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); 177 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS();
188 DISALLOW_COPY_AND_ASSIGN(AstGraphBuilder); 178 DISALLOW_COPY_AND_ASSIGN(AstGraphBuilder);
189 }; 179 };
190 180
191 181
192 // The abstract execution environment for generated code consists of 182 // The abstract execution environment for generated code consists of
193 // parameter variables, local variables and the operand stack. The 183 // parameter variables, local variables and the operand stack. The
194 // environment will perform proper SSA-renaming of all tracked nodes 184 // environment will perform proper SSA-renaming of all tracked nodes
195 // at split and merge points in the control flow. Internally all the 185 // at split and merge points in the control flow. Internally all the
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 275
286 276
287 // Each expression in the AST is evaluated in a specific context. This context 277 // Each expression in the AST is evaluated in a specific context. This context
288 // decides how the evaluation result is passed up the visitor. 278 // decides how the evaluation result is passed up the visitor.
289 class AstGraphBuilder::AstContext BASE_EMBEDDED { 279 class AstGraphBuilder::AstContext BASE_EMBEDDED {
290 public: 280 public:
291 bool IsEffect() const { return kind_ == Expression::kEffect; } 281 bool IsEffect() const { return kind_ == Expression::kEffect; }
292 bool IsValue() const { return kind_ == Expression::kValue; } 282 bool IsValue() const { return kind_ == Expression::kValue; }
293 bool IsTest() const { return kind_ == Expression::kTest; } 283 bool IsTest() const { return kind_ == Expression::kTest; }
294 284
295 // Determines how to combine the frame state with the value
296 // that is about to be plugged into this AstContext.
297 AstGraphBuilder::OutputFrameStateCombine GetStateCombine() {
298 return IsEffect() ? IGNORE_OUTPUT : PUSH_OUTPUT;
299 }
300
301 // Plug a node into this expression context. Call this function in tail 285 // Plug a node into this expression context. Call this function in tail
302 // position in the Visit functions for expressions. 286 // position in the Visit functions for expressions.
303 virtual void ProduceValue(Node* value) = 0; 287 virtual void ProduceValue(Node* value) = 0;
288 virtual void ProduceValueWithLazyBailout(Node* value) = 0;
304 289
305 // Unplugs a node from this expression context. Call this to retrieve the 290 // Unplugs a node from this expression context. Call this to retrieve the
306 // result of another Visit function that already plugged the context. 291 // result of another Visit function that already plugged the context.
307 virtual Node* ConsumeValue() = 0; 292 virtual Node* ConsumeValue() = 0;
308 293
309 // Shortcut for "context->ProduceValue(context->ConsumeValue())". 294 // Shortcut for "context->ProduceValue(context->ConsumeValue())".
310 void ReplaceValue() { ProduceValue(ConsumeValue()); } 295 void ReplaceValue() { ProduceValue(ConsumeValue()); }
311 296
312 protected: 297 protected:
313 AstContext(AstGraphBuilder* owner, Expression::Context kind); 298 AstContext(AstGraphBuilder* owner, Expression::Context kind,
299 BailoutId bailout_id);
314 virtual ~AstContext(); 300 virtual ~AstContext();
315 301
316 AstGraphBuilder* owner() const { return owner_; } 302 AstGraphBuilder* owner() const { return owner_; }
317 Environment* environment() const { return owner_->environment(); } 303 Environment* environment() const { return owner_->environment(); }
318 304
319 // We want to be able to assert, in a context-specific way, that the stack 305 // We want to be able to assert, in a context-specific way, that the stack
320 // height makes sense when the context is filled. 306 // height makes sense when the context is filled.
321 #ifdef DEBUG 307 #ifdef DEBUG
322 int original_height_; 308 int original_height_;
323 #endif 309 #endif
324 310
311 BailoutId bailout_id_;
312
325 private: 313 private:
326 Expression::Context kind_; 314 Expression::Context kind_;
327 AstGraphBuilder* owner_; 315 AstGraphBuilder* owner_;
328 AstContext* outer_; 316 AstContext* outer_;
329 }; 317 };
330 318
331 319
332 // Context to evaluate expression for its side effects only. 320 // Context to evaluate expression for its side effects only.
333 class AstGraphBuilder::AstEffectContext V8_FINAL : public AstContext { 321 class AstGraphBuilder::AstEffectContext V8_FINAL : public AstContext {
334 public: 322 public:
335 explicit AstEffectContext(AstGraphBuilder* owner) 323 explicit AstEffectContext(AstGraphBuilder* owner, BailoutId bailout_id)
336 : AstContext(owner, Expression::kEffect) {} 324 : AstContext(owner, Expression::kEffect, bailout_id) {}
337 virtual ~AstEffectContext(); 325 virtual ~AstEffectContext();
338 virtual void ProduceValue(Node* value) V8_OVERRIDE; 326 virtual void ProduceValue(Node* value) V8_OVERRIDE;
327 virtual void ProduceValueWithLazyBailout(Node* value) V8_OVERRIDE;
339 virtual Node* ConsumeValue() V8_OVERRIDE; 328 virtual Node* ConsumeValue() V8_OVERRIDE;
340 }; 329 };
341 330
342 331
343 // Context to evaluate expression for its value (and side effects). 332 // Context to evaluate expression for its value (and side effects).
344 class AstGraphBuilder::AstValueContext V8_FINAL : public AstContext { 333 class AstGraphBuilder::AstValueContext V8_FINAL : public AstContext {
345 public: 334 public:
346 explicit AstValueContext(AstGraphBuilder* owner) 335 explicit AstValueContext(AstGraphBuilder* owner, BailoutId bailout_id)
347 : AstContext(owner, Expression::kValue) {} 336 : AstContext(owner, Expression::kValue, bailout_id) {}
348 virtual ~AstValueContext(); 337 virtual ~AstValueContext();
349 virtual void ProduceValue(Node* value) V8_OVERRIDE; 338 virtual void ProduceValue(Node* value) V8_OVERRIDE;
339 virtual void ProduceValueWithLazyBailout(Node* value) V8_OVERRIDE;
350 virtual Node* ConsumeValue() V8_OVERRIDE; 340 virtual Node* ConsumeValue() V8_OVERRIDE;
351 }; 341 };
352 342
353 343
354 // Context to evaluate expression for a condition value (and side effects). 344 // Context to evaluate expression for a condition value (and side effects).
355 class AstGraphBuilder::AstTestContext V8_FINAL : public AstContext { 345 class AstGraphBuilder::AstTestContext V8_FINAL : public AstContext {
356 public: 346 public:
357 explicit AstTestContext(AstGraphBuilder* owner) 347 explicit AstTestContext(AstGraphBuilder* owner, BailoutId bailout_id)
358 : AstContext(owner, Expression::kTest) {} 348 : AstContext(owner, Expression::kTest, bailout_id) {}
359 virtual ~AstTestContext(); 349 virtual ~AstTestContext();
360 virtual void ProduceValue(Node* value) V8_OVERRIDE; 350 virtual void ProduceValue(Node* value) V8_OVERRIDE;
351 virtual void ProduceValueWithLazyBailout(Node* value) V8_OVERRIDE;
361 virtual Node* ConsumeValue() V8_OVERRIDE; 352 virtual Node* ConsumeValue() V8_OVERRIDE;
362 }; 353 };
363 354
364 355
365 // Scoped class tracking breakable statements entered by the visitor. Allows to 356 // Scoped class tracking breakable statements entered by the visitor. Allows to
366 // properly 'break' and 'continue' iteration statements as well as to 'break' 357 // properly 'break' and 'continue' iteration statements as well as to 'break'
367 // from blocks within switch statements. 358 // from blocks within switch statements.
368 class AstGraphBuilder::BreakableScope BASE_EMBEDDED { 359 class AstGraphBuilder::BreakableScope BASE_EMBEDDED {
369 public: 360 public:
370 BreakableScope(AstGraphBuilder* owner, BreakableStatement* target, 361 BreakableScope(AstGraphBuilder* owner, BreakableStatement* target,
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 }; 419 };
429 420
430 Scope* AstGraphBuilder::current_scope() const { 421 Scope* AstGraphBuilder::current_scope() const {
431 return execution_context_->scope(); 422 return execution_context_->scope();
432 } 423 }
433 } 424 }
434 } 425 }
435 } // namespace v8::internal::compiler 426 } // namespace v8::internal::compiler
436 427
437 #endif // V8_COMPILER_AST_GRAPH_BUILDER_H_ 428 #endif // V8_COMPILER_AST_GRAPH_BUILDER_H_
OLDNEW
« no previous file with comments | « no previous file | src/compiler/ast-graph-builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698