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

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

Issue 450103004: Reland "More lazy deoptimization in Turbofan (binops, loads/stores)" (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add missing deopts (still with invalid bailout id) 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 | « src/compiler/arm64/linkage-arm64.cc ('k') | 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 // other dependencies tracked by the environment might be mutated though. 71 // other dependencies tracked by the environment might be mutated though.
72 // 72 //
73 73
74 // Builder to create a local function context. 74 // Builder to create a local function context.
75 Node* BuildLocalFunctionContext(Node* context, Node* closure); 75 Node* BuildLocalFunctionContext(Node* context, Node* closure);
76 76
77 // Builder to create an arguments object if it is used. 77 // Builder to create an arguments object if it is used.
78 Node* BuildArgumentsObject(Variable* arguments); 78 Node* BuildArgumentsObject(Variable* arguments);
79 79
80 // Builders for variable load and assignment. 80 // Builders for variable load and assignment.
81 Node* BuildVariableAssignment(Variable* var, Node* value, Token::Value op); 81 Node* BuildVariableAssignment(Variable* var, Node* value, Token::Value op,
82 BailoutId bailout_id);
82 Node* BuildVariableDelete(Variable* var); 83 Node* BuildVariableDelete(Variable* var);
83 Node* BuildVariableLoad(Variable* var, ContextualMode mode = CONTEXTUAL); 84 Node* BuildVariableLoad(Variable* var, BailoutId bailout_id,
85 ContextualMode mode = CONTEXTUAL);
84 86
85 // Builders for accessing the function context. 87 // Builders for accessing the function context.
86 Node* BuildLoadBuiltinsObject(); 88 Node* BuildLoadBuiltinsObject();
87 Node* BuildLoadGlobalObject(); 89 Node* BuildLoadGlobalObject();
88 Node* BuildLoadClosure(); 90 Node* BuildLoadClosure();
89 91
90 // Builders for automatic type conversion. 92 // Builders for automatic type conversion.
91 Node* BuildToBoolean(Node* value); 93 Node* BuildToBoolean(Node* value);
92 94
93 // Builders for error reporting at runtime. 95 // Builders for error reporting at runtime.
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 165
164 // Dispatched from VisitBinaryOperation. 166 // Dispatched from VisitBinaryOperation.
165 void VisitComma(BinaryOperation* expr); 167 void VisitComma(BinaryOperation* expr);
166 void VisitLogicalExpression(BinaryOperation* expr); 168 void VisitLogicalExpression(BinaryOperation* expr);
167 void VisitArithmeticExpression(BinaryOperation* expr); 169 void VisitArithmeticExpression(BinaryOperation* expr);
168 170
169 // Dispatched from VisitForInStatement. 171 // Dispatched from VisitForInStatement.
170 void VisitForInAssignment(Expression* expr, Node* value); 172 void VisitForInAssignment(Expression* expr, Node* value);
171 173
172 void BuildLazyBailout(Node* node, BailoutId ast_id); 174 void BuildLazyBailout(Node* node, BailoutId ast_id);
175 void BuildLazyBailoutWithPushedNode(Node* node, BailoutId ast_id);
173 176
174 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); 177 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS();
175 DISALLOW_COPY_AND_ASSIGN(AstGraphBuilder); 178 DISALLOW_COPY_AND_ASSIGN(AstGraphBuilder);
176 }; 179 };
177 180
178 181
179 // The abstract execution environment for generated code consists of 182 // The abstract execution environment for generated code consists of
180 // parameter variables, local variables and the operand stack. The 183 // parameter variables, local variables and the operand stack. The
181 // environment will perform proper SSA-renaming of all tracked nodes 184 // environment will perform proper SSA-renaming of all tracked nodes
182 // 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 // decides how the evaluation result is passed up the visitor. 278 // decides how the evaluation result is passed up the visitor.
276 class AstGraphBuilder::AstContext BASE_EMBEDDED { 279 class AstGraphBuilder::AstContext BASE_EMBEDDED {
277 public: 280 public:
278 bool IsEffect() const { return kind_ == Expression::kEffect; } 281 bool IsEffect() const { return kind_ == Expression::kEffect; }
279 bool IsValue() const { return kind_ == Expression::kValue; } 282 bool IsValue() const { return kind_ == Expression::kValue; }
280 bool IsTest() const { return kind_ == Expression::kTest; } 283 bool IsTest() const { return kind_ == Expression::kTest; }
281 284
282 // 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
283 // position in the Visit functions for expressions. 286 // position in the Visit functions for expressions.
284 virtual void ProduceValue(Node* value) = 0; 287 virtual void ProduceValue(Node* value) = 0;
288 virtual void ProduceValueWithLazyBailout(Node* value) = 0;
285 289
286 // 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
287 // result of another Visit function that already plugged the context. 291 // result of another Visit function that already plugged the context.
288 virtual Node* ConsumeValue() = 0; 292 virtual Node* ConsumeValue() = 0;
289 293
290 // Shortcut for "context->ProduceValue(context->ConsumeValue())". 294 // Shortcut for "context->ProduceValue(context->ConsumeValue())".
291 void ReplaceValue() { ProduceValue(ConsumeValue()); } 295 void ReplaceValue() { ProduceValue(ConsumeValue()); }
292 296
293 protected: 297 protected:
294 AstContext(AstGraphBuilder* owner, Expression::Context kind); 298 AstContext(AstGraphBuilder* owner, Expression::Context kind,
299 BailoutId bailout_id);
295 virtual ~AstContext(); 300 virtual ~AstContext();
296 301
297 AstGraphBuilder* owner() const { return owner_; } 302 AstGraphBuilder* owner() const { return owner_; }
298 Environment* environment() const { return owner_->environment(); } 303 Environment* environment() const { return owner_->environment(); }
299 304
300 // 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
301 // height makes sense when the context is filled. 306 // height makes sense when the context is filled.
302 #ifdef DEBUG 307 #ifdef DEBUG
303 int original_height_; 308 int original_height_;
304 #endif 309 #endif
305 310
311 BailoutId bailout_id_;
312
306 private: 313 private:
307 Expression::Context kind_; 314 Expression::Context kind_;
308 AstGraphBuilder* owner_; 315 AstGraphBuilder* owner_;
309 AstContext* outer_; 316 AstContext* outer_;
310 }; 317 };
311 318
312 319
313 // Context to evaluate expression for its side effects only. 320 // Context to evaluate expression for its side effects only.
314 class AstGraphBuilder::AstEffectContext V8_FINAL : public AstContext { 321 class AstGraphBuilder::AstEffectContext V8_FINAL : public AstContext {
315 public: 322 public:
316 explicit AstEffectContext(AstGraphBuilder* owner) 323 explicit AstEffectContext(AstGraphBuilder* owner, BailoutId bailout_id)
317 : AstContext(owner, Expression::kEffect) {} 324 : AstContext(owner, Expression::kEffect, bailout_id) {}
318 virtual ~AstEffectContext(); 325 virtual ~AstEffectContext();
319 virtual void ProduceValue(Node* value) V8_OVERRIDE; 326 virtual void ProduceValue(Node* value) V8_OVERRIDE;
327 virtual void ProduceValueWithLazyBailout(Node* value) V8_OVERRIDE;
320 virtual Node* ConsumeValue() V8_OVERRIDE; 328 virtual Node* ConsumeValue() V8_OVERRIDE;
321 }; 329 };
322 330
323 331
324 // Context to evaluate expression for its value (and side effects). 332 // Context to evaluate expression for its value (and side effects).
325 class AstGraphBuilder::AstValueContext V8_FINAL : public AstContext { 333 class AstGraphBuilder::AstValueContext V8_FINAL : public AstContext {
326 public: 334 public:
327 explicit AstValueContext(AstGraphBuilder* owner) 335 explicit AstValueContext(AstGraphBuilder* owner, BailoutId bailout_id)
328 : AstContext(owner, Expression::kValue) {} 336 : AstContext(owner, Expression::kValue, bailout_id) {}
329 virtual ~AstValueContext(); 337 virtual ~AstValueContext();
330 virtual void ProduceValue(Node* value) V8_OVERRIDE; 338 virtual void ProduceValue(Node* value) V8_OVERRIDE;
339 virtual void ProduceValueWithLazyBailout(Node* value) V8_OVERRIDE;
331 virtual Node* ConsumeValue() V8_OVERRIDE; 340 virtual Node* ConsumeValue() V8_OVERRIDE;
332 }; 341 };
333 342
334 343
335 // Context to evaluate expression for a condition value (and side effects). 344 // Context to evaluate expression for a condition value (and side effects).
336 class AstGraphBuilder::AstTestContext V8_FINAL : public AstContext { 345 class AstGraphBuilder::AstTestContext V8_FINAL : public AstContext {
337 public: 346 public:
338 explicit AstTestContext(AstGraphBuilder* owner) 347 explicit AstTestContext(AstGraphBuilder* owner, BailoutId bailout_id)
339 : AstContext(owner, Expression::kTest) {} 348 : AstContext(owner, Expression::kTest, bailout_id) {}
340 virtual ~AstTestContext(); 349 virtual ~AstTestContext();
341 virtual void ProduceValue(Node* value) V8_OVERRIDE; 350 virtual void ProduceValue(Node* value) V8_OVERRIDE;
351 virtual void ProduceValueWithLazyBailout(Node* value) V8_OVERRIDE;
342 virtual Node* ConsumeValue() V8_OVERRIDE; 352 virtual Node* ConsumeValue() V8_OVERRIDE;
343 }; 353 };
344 354
345 355
346 // Scoped class tracking breakable statements entered by the visitor. Allows to 356 // Scoped class tracking breakable statements entered by the visitor. Allows to
347 // properly 'break' and 'continue' iteration statements as well as to 'break' 357 // properly 'break' and 'continue' iteration statements as well as to 'break'
348 // from blocks within switch statements. 358 // from blocks within switch statements.
349 class AstGraphBuilder::BreakableScope BASE_EMBEDDED { 359 class AstGraphBuilder::BreakableScope BASE_EMBEDDED {
350 public: 360 public:
351 BreakableScope(AstGraphBuilder* owner, BreakableStatement* target, 361 BreakableScope(AstGraphBuilder* owner, BreakableStatement* target,
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 }; 419 };
410 420
411 Scope* AstGraphBuilder::current_scope() const { 421 Scope* AstGraphBuilder::current_scope() const {
412 return execution_context_->scope(); 422 return execution_context_->scope();
413 } 423 }
414 } 424 }
415 } 425 }
416 } // namespace v8::internal::compiler 426 } // namespace v8::internal::compiler
417 427
418 #endif // V8_COMPILER_AST_GRAPH_BUILDER_H_ 428 #endif // V8_COMPILER_AST_GRAPH_BUILDER_H_
OLDNEW
« no previous file with comments | « src/compiler/arm64/linkage-arm64.cc ('k') | src/compiler/ast-graph-builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698