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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/lib/object_patch.dart ('k') | runtime/vm/ast.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/ast.h
===================================================================
--- runtime/vm/ast.h (revision 26120)
+++ runtime/vm/ast.h (working copy)
@@ -21,6 +21,7 @@
V(TypeNode, "type") \
V(AssignableNode, "assignable") \
V(BinaryOpNode, "binop") \
+ V(BinaryOpWithMask32Node, "binop with mask 32") \
V(ComparisonNode, "compare") \
V(UnaryOpNode, "unaryop") \
V(ConditionalExprNode, "?:") \
@@ -579,6 +580,12 @@
AstNode* left() const { return left_; }
AstNode* right() const { return right_; }
+ virtual bool has_mask32() const { return false; }
+ virtual int64_t mask32() const {
+ UNREACHABLE();
+ return 0;
+ }
+
virtual void VisitChildren(AstNodeVisitor* visitor) const {
left()->Visit(visitor);
right()->Visit(visitor);
@@ -601,6 +608,37 @@
};
+class BinaryOpWithMask32Node : public BinaryOpNode {
+ public:
+ BinaryOpWithMask32Node(intptr_t token_pos,
+ Token::Kind kind_value,
+ AstNode* left,
+ AstNode* right,
+ int64_t mask32)
+ : BinaryOpNode(token_pos, kind_value, left, right), mask32_(mask32) {
+ ASSERT(mask32 >= 0 && Utils::IsUint(32, mask32));
+ ASSERT((kind_value != Token::kAND) && (kind_value != Token::kOR));
+ }
+
+ // The optional 32-bit mask must be a an unsigned 32-bit value.
+ virtual bool has_mask32() const { return true; }
+ virtual int64_t mask32() const {
+ ASSERT(has_mask32());
+ return mask32_;
+ }
+
+ virtual const char* Name() const;
+ DECLARE_COMMON_NODE_FUNCTIONS(BinaryOpWithMask32Node);
+
+ private:
+ // Optional unsigned 32 bit mask applied on result. No mask: -1.
+ const int64_t mask32_;
+
+ DISALLOW_IMPLICIT_CONSTRUCTORS(BinaryOpWithMask32Node);
+};
+
+
+
class UnaryOpNode : public AstNode {
public:
// Returns optimized version, e.g., for ('-' '1') ('-1') literal is returned.
« no previous file with comments | « runtime/lib/object_patch.dart ('k') | runtime/vm/ast.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698