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

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

Issue 22640019: Fix for running with --throw_on_javascript_int_overflow: recognize pattern (a << b) & mask and test… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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 | « runtime/lib/object_patch.dart ('k') | runtime/vm/ast_printer.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 (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_AST_H_ 5 #ifndef VM_AST_H_
6 #define VM_AST_H_ 6 #define VM_AST_H_
7 7
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/allocation.h" 9 #include "vm/allocation.h"
10 #include "vm/growable_array.h" 10 #include "vm/growable_array.h"
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 DISALLOW_IMPLICIT_CONSTRUCTORS(ComparisonNode); 562 DISALLOW_IMPLICIT_CONSTRUCTORS(ComparisonNode);
563 }; 563 };
564 564
565 565
566 class BinaryOpNode : public AstNode { 566 class BinaryOpNode : public AstNode {
567 public: 567 public:
568 BinaryOpNode(intptr_t token_pos, 568 BinaryOpNode(intptr_t token_pos,
569 Token::Kind kind, 569 Token::Kind kind,
570 AstNode* left, 570 AstNode* left,
571 AstNode* right) 571 AstNode* right)
572 : AstNode(token_pos), kind_(kind), left_(left), right_(right) { 572 : AstNode(token_pos),
573 kind_(kind),
574 left_(left),
575 right_(right),
576 mask32_(-1) {
573 ASSERT(left_ != NULL); 577 ASSERT(left_ != NULL);
574 ASSERT(right_ != NULL); 578 ASSERT(right_ != NULL);
575 ASSERT(IsKindValid()); 579 ASSERT(IsKindValid());
576 } 580 }
577 581
578 Token::Kind kind() const { return kind_; } 582 Token::Kind kind() const { return kind_; }
579 AstNode* left() const { return left_; } 583 AstNode* left() const { return left_; }
580 AstNode* right() const { return right_; } 584 AstNode* right() const { return right_; }
581 585
586 // The optional 32-bit mask must be a an unsigned 32-bit value.
587 bool has_mask32() const { return mask32_ >= 0; }
588 int64_t mask32() const {
589 ASSERT(has_mask32());
590 return mask32_;
591 }
592 void set_mask32(int64_t value) {
593 ASSERT(Utils::IsUint(32, value));
594 mask32_ = value;
595 }
596
582 virtual void VisitChildren(AstNodeVisitor* visitor) const { 597 virtual void VisitChildren(AstNodeVisitor* visitor) const {
583 left()->Visit(visitor); 598 left()->Visit(visitor);
584 right()->Visit(visitor); 599 right()->Visit(visitor);
585 } 600 }
586 601
587 virtual const char* Name() const; 602 virtual const char* Name() const;
588 virtual bool IsPotentiallyConst() const; 603 virtual bool IsPotentiallyConst() const;
589 virtual const Instance* EvalConstExpr() const; 604 virtual const Instance* EvalConstExpr() const;
590 605
591 DECLARE_COMMON_NODE_FUNCTIONS(BinaryOpNode); 606 DECLARE_COMMON_NODE_FUNCTIONS(BinaryOpNode);
592 607
593 private: 608 private:
594 const Token::Kind kind_; 609 const Token::Kind kind_;
595 AstNode* left_; 610 AstNode* left_;
596 AstNode* right_; 611 AstNode* right_;
612 // Optional unsigned 32 bit mask applied on result. No mask: -1.
613 int64_t mask32_;
Florian Schneider 2013/08/13 15:29:52 I think it would be cleaner to have a separate AST
srdjan 2013/08/13 18:44:59 Done.
597 614
598 bool IsKindValid() const; 615 bool IsKindValid() const;
599 616
600 DISALLOW_IMPLICIT_CONSTRUCTORS(BinaryOpNode); 617 DISALLOW_IMPLICIT_CONSTRUCTORS(BinaryOpNode);
601 }; 618 };
602 619
603 620
604 class UnaryOpNode : public AstNode { 621 class UnaryOpNode : public AstNode {
605 public: 622 public:
606 // Returns optimized version, e.g., for ('-' '1') ('-1') literal is returned. 623 // Returns optimized version, e.g., for ('-' '1') ('-1') literal is returned.
(...skipping 1103 matching lines...) Expand 10 before | Expand all | Expand 10 after
1710 const intptr_t try_index_; 1727 const intptr_t try_index_;
1711 1728
1712 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode); 1729 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode);
1713 }; 1730 };
1714 1731
1715 } // namespace dart 1732 } // namespace dart
1716 1733
1717 #undef DECLARE_COMMON_NODE_FUNCTIONS 1734 #undef DECLARE_COMMON_NODE_FUNCTIONS
1718 1735
1719 #endif // VM_AST_H_ 1736 #endif // VM_AST_H_
OLDNEW
« no previous file with comments | « runtime/lib/object_patch.dart ('k') | runtime/vm/ast_printer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698