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

Side by Side Diff: runtime/vm/parser.cc

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
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 #include "vm/parser.h" 5 #include "vm/parser.h"
6 6
7 #include "lib/invocation_mirror.h" 7 #include "lib/invocation_mirror.h"
8 #include "vm/bigint_operations.h" 8 #include "vm/bigint_operations.h"
9 #include "vm/bootstrap.h" 9 #include "vm/bootstrap.h"
10 #include "vm/class_finalizer.h" 10 #include "vm/class_finalizer.h"
(...skipping 7274 matching lines...) Expand 10 before | Expand all | Expand 10 after
7285 if (binary_op == Token::kDIV) { 7285 if (binary_op == Token::kDIV) {
7286 const Double& dbl_obj = Double::ZoneHandle( 7286 const Double& dbl_obj = Double::ZoneHandle(
7287 Double::NewCanonical((left_double / right_double))); 7287 Double::NewCanonical((left_double / right_double)));
7288 return new LiteralNode(op_pos, dbl_obj); 7288 return new LiteralNode(op_pos, dbl_obj);
7289 } 7289 }
7290 } 7290 }
7291 } 7291 }
7292 if ((binary_op == Token::kAND) || (binary_op == Token::kOR)) { 7292 if ((binary_op == Token::kAND) || (binary_op == Token::kOR)) {
7293 EnsureExpressionTemp(); 7293 EnsureExpressionTemp();
7294 } 7294 }
7295 if (binary_op == Token::kBIT_AND) {
7296 // Normalize so that rhs is a literal if any is.
7297 if ((rhs_literal == NULL) && (lhs_literal != NULL)) {
7298 // Swap.
7299 LiteralNode* temp = rhs_literal;
7300 rhs_literal = lhs_literal;
7301 lhs_literal = temp;
7302 }
7303 if ((rhs_literal != NULL) &&
7304 (rhs_literal->literal().IsSmi() || rhs_literal->literal().IsMint())) {
7305 const int64_t val = Integer::Cast(rhs_literal->literal()).AsInt64Value();
7306 if ((0 <= val) && (Utils::IsUint(32, val))) {
7307 if (lhs->IsBinaryOpNode() &&
7308 (lhs->AsBinaryOpNode()->kind() == Token::kSHL)) {
7309 // Merge SHL and BIT_AND into one "SHL with mask" node.
7310 lhs->AsBinaryOpNode()->set_mask32(val);
7311 return lhs;
7312 }
7313 }
7314 }
7315 }
7295 return new BinaryOpNode(op_pos, binary_op, lhs, rhs); 7316 return new BinaryOpNode(op_pos, binary_op, lhs, rhs);
7296 } 7317 }
7297 7318
7298 7319
7299 AstNode* Parser::ExpandAssignableOp(intptr_t op_pos, 7320 AstNode* Parser::ExpandAssignableOp(intptr_t op_pos,
7300 Token::Kind assignment_op, 7321 Token::Kind assignment_op,
7301 AstNode* lhs, 7322 AstNode* lhs,
7302 AstNode* rhs) { 7323 AstNode* rhs) {
7303 TRACE_PARSER("ExpandAssignableOp"); 7324 TRACE_PARSER("ExpandAssignableOp");
7304 switch (assignment_op) { 7325 switch (assignment_op) {
(...skipping 2989 matching lines...) Expand 10 before | Expand all | Expand 10 after
10294 void Parser::SkipQualIdent() { 10315 void Parser::SkipQualIdent() {
10295 ASSERT(IsIdentifier()); 10316 ASSERT(IsIdentifier());
10296 ConsumeToken(); 10317 ConsumeToken();
10297 if (CurrentToken() == Token::kPERIOD) { 10318 if (CurrentToken() == Token::kPERIOD) {
10298 ConsumeToken(); // Consume the kPERIOD token. 10319 ConsumeToken(); // Consume the kPERIOD token.
10299 ExpectIdentifier("identifier expected after '.'"); 10320 ExpectIdentifier("identifier expected after '.'");
10300 } 10321 }
10301 } 10322 }
10302 10323
10303 } // namespace dart 10324 } // namespace dart
OLDNEW
« runtime/vm/ast.h ('K') | « runtime/vm/object.cc ('k') | runtime/vm/symbols.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698