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

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

Issue 1900863004: VM: Remove _leftShiftWithMask32. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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
« no previous file with comments | « runtime/vm/aot_optimizer.cc ('k') | runtime/vm/ast.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"
11 #include "vm/scopes.h" 11 #include "vm/scopes.h"
12 #include "vm/object.h" 12 #include "vm/object.h"
13 #include "vm/native_entry.h" 13 #include "vm/native_entry.h"
14 #include "vm/token.h" 14 #include "vm/token.h"
15 #include "vm/token_position.h" 15 #include "vm/token_position.h"
16 16
17 namespace dart { 17 namespace dart {
18 18
19 #define FOR_EACH_NODE(V) \ 19 #define FOR_EACH_NODE(V) \
20 V(Await) \ 20 V(Await) \
21 V(AwaitMarker) \ 21 V(AwaitMarker) \
22 V(Return) \ 22 V(Return) \
23 V(Literal) \ 23 V(Literal) \
24 V(Type) \ 24 V(Type) \
25 V(Assignable) \ 25 V(Assignable) \
26 V(BinaryOp) \ 26 V(BinaryOp) \
27 V(BinaryOpWithMask32) \
28 V(Comparison) \ 27 V(Comparison) \
29 V(UnaryOp) \ 28 V(UnaryOp) \
30 V(ConditionalExpr) \ 29 V(ConditionalExpr) \
31 V(If) \ 30 V(If) \
32 V(Switch) \ 31 V(Switch) \
33 V(Case) \ 32 V(Case) \
34 V(While) \ 33 V(While) \
35 V(DoWhile) \ 34 V(DoWhile) \
36 V(For) \ 35 V(For) \
37 V(Jump) \ 36 V(Jump) \
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after
762 const Token::Kind kind_; 761 const Token::Kind kind_;
763 AstNode* left_; 762 AstNode* left_;
764 AstNode* right_; 763 AstNode* right_;
765 764
766 bool IsKindValid() const; 765 bool IsKindValid() const;
767 766
768 DISALLOW_IMPLICIT_CONSTRUCTORS(BinaryOpNode); 767 DISALLOW_IMPLICIT_CONSTRUCTORS(BinaryOpNode);
769 }; 768 };
770 769
771 770
772 class BinaryOpWithMask32Node : public BinaryOpNode {
773 public:
774 BinaryOpWithMask32Node(TokenPosition token_pos,
775 Token::Kind kind_value,
776 AstNode* left,
777 AstNode* right,
778 int64_t mask32)
779 : BinaryOpNode(token_pos, kind_value, left, right), mask32_(mask32) {
780 ASSERT(mask32 >= 0 && Utils::IsUint(32, mask32));
781 ASSERT((kind_value != Token::kAND) && (kind_value != Token::kOR));
782 }
783
784 // The optional 32-bit mask must be a an unsigned 32-bit value.
785 virtual bool has_mask32() const { return true; }
786 virtual int64_t mask32() const {
787 ASSERT(has_mask32());
788 return mask32_;
789 }
790
791 const char* TokenName() const;
792 DECLARE_COMMON_NODE_FUNCTIONS(BinaryOpWithMask32Node);
793
794 private:
795 // Optional unsigned 32 bit mask applied on result. No mask: -1.
796 const int64_t mask32_;
797
798 DISALLOW_IMPLICIT_CONSTRUCTORS(BinaryOpWithMask32Node);
799 };
800
801
802 class UnaryOpNode : public AstNode { 771 class UnaryOpNode : public AstNode {
803 public: 772 public:
804 // Returns optimized version, e.g., for ('-' '1') ('-1') literal is returned. 773 // Returns optimized version, e.g., for ('-' '1') ('-1') literal is returned.
805 static AstNode* UnaryOpOrLiteral(TokenPosition token_pos, 774 static AstNode* UnaryOpOrLiteral(TokenPosition token_pos,
806 Token::Kind kind, 775 Token::Kind kind,
807 AstNode* operand); 776 AstNode* operand);
808 UnaryOpNode(TokenPosition token_pos, 777 UnaryOpNode(TokenPosition token_pos,
809 Token::Kind kind, 778 Token::Kind kind,
810 AstNode* operand) 779 AstNode* operand)
811 : AstNode(token_pos), kind_(kind), operand_(operand) { 780 : AstNode(token_pos), kind_(kind), operand_(operand) {
(...skipping 1233 matching lines...) Expand 10 before | Expand all | Expand 10 after
2045 const intptr_t try_index_; 2014 const intptr_t try_index_;
2046 2015
2047 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode); 2016 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode);
2048 }; 2017 };
2049 2018
2050 } // namespace dart 2019 } // namespace dart
2051 2020
2052 #undef DECLARE_COMMON_NODE_FUNCTIONS 2021 #undef DECLARE_COMMON_NODE_FUNCTIONS
2053 2022
2054 #endif // VM_AST_H_ 2023 #endif // VM_AST_H_
OLDNEW
« no previous file with comments | « runtime/vm/aot_optimizer.cc ('k') | runtime/vm/ast.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698