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

Side by Side Diff: runtime/vm/flow_graph_builder.h

Issue 246293008: Do not ignore side effects of a type test or type cast as expression, such (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 8 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 | runtime/vm/flow_graph_builder.cc » ('j') | tests/language/language_dart2js.status » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef VM_FLOW_GRAPH_BUILDER_H_ 5 #ifndef VM_FLOW_GRAPH_BUILDER_H_
6 #define VM_FLOW_GRAPH_BUILDER_H_ 6 #define VM_FLOW_GRAPH_BUILDER_H_
7 7
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "platform/globals.h" 9 #include "platform/globals.h"
10 #include "vm/allocation.h" 10 #include "vm/allocation.h"
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 // Helpers for allocating and deallocating temporary locals on top of the 427 // Helpers for allocating and deallocating temporary locals on top of the
428 // expression stack. 428 // expression stack.
429 LocalVariable* EnterTempLocalScope(Value* value); 429 LocalVariable* EnterTempLocalScope(Value* value);
430 Definition* ExitTempLocalScope(LocalVariable* var); 430 Definition* ExitTempLocalScope(LocalVariable* var);
431 431
432 void BuildLetTempExpressions(LetNode* node); 432 void BuildLetTempExpressions(LetNode* node);
433 433
434 private: 434 private:
435 friend class TempLocalScope; // For ReturnDefinition. 435 friend class TempLocalScope; // For ReturnDefinition.
436 436
437 // Helper to drop the result value.
438 virtual void ReturnValue(Value* value) {
439 Do(new DropTempsInstr(0, value));
440 }
441
437 // Specify a definition of the final result. Adds the definition to 442 // Specify a definition of the final result. Adds the definition to
438 // the graph, but normally overridden in subclasses. 443 // the graph, but normally overridden in subclasses.
439 virtual void ReturnDefinition(Definition* definition) { 444 virtual void ReturnDefinition(Definition* definition) {
440 Do(definition); 445 Do(definition);
441 } 446 }
442 447
443 // Shared global state. 448 // Shared global state.
444 FlowGraphBuilder* owner_; 449 FlowGraphBuilder* owner_;
445 450
446 // Output parameters. 451 // Output parameters.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 private: 489 private:
485 // Helper to set the output state to return a Value. 490 // Helper to set the output state to return a Value.
486 virtual void ReturnValue(Value* value) { value_ = value; } 491 virtual void ReturnValue(Value* value) { value_ = value; }
487 492
488 // Specify a definition of the final result. Adds the definition to 493 // Specify a definition of the final result. Adds the definition to
489 // the graph and returns a use of it (i.e., set the visitor's output 494 // the graph and returns a use of it (i.e., set the visitor's output
490 // parameters). 495 // parameters).
491 virtual void ReturnDefinition(Definition* definition) { 496 virtual void ReturnDefinition(Definition* definition) {
492 ReturnValue(Bind(definition)); 497 ReturnValue(Bind(definition));
493 } 498 }
494
495 virtual void BuildTypeTest(ComparisonNode* node);
496 virtual void BuildTypeCast(ComparisonNode* node);
497 }; 499 };
498 500
499 501
500 // Translate an AstNode to a control-flow graph fragment for both its 502 // Translate an AstNode to a control-flow graph fragment for both its
501 // effects and true/false control flow (e.g., for an expression in a test 503 // effects and true/false control flow (e.g., for an expression in a test
502 // context). The resulting graph is always closed (even if it is empty) 504 // context). The resulting graph is always closed (even if it is empty)
503 // Successor control flow is explicitly set by a pair of pointers to 505 // Successor control flow is explicitly set by a pair of pointers to
504 // TargetEntryInstr*. 506 // TargetEntryInstr*.
505 // 507 //
506 // To distinguish between the graphs with only nonlocal exits and graphs 508 // To distinguish between the graphs with only nonlocal exits and graphs
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 // Output parameters. 557 // Output parameters.
556 GrowableArray<TargetEntryInstr**> true_successor_addresses_; 558 GrowableArray<TargetEntryInstr**> true_successor_addresses_;
557 GrowableArray<TargetEntryInstr**> false_successor_addresses_; 559 GrowableArray<TargetEntryInstr**> false_successor_addresses_;
558 560
559 intptr_t condition_token_pos_; 561 intptr_t condition_token_pos_;
560 }; 562 };
561 563
562 } // namespace dart 564 } // namespace dart
563 565
564 #endif // VM_FLOW_GRAPH_BUILDER_H_ 566 #endif // VM_FLOW_GRAPH_BUILDER_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/flow_graph_builder.cc » ('j') | tests/language/language_dart2js.status » ('J')

Powered by Google App Engine
This is Rietveld 408576698