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

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

Issue 21301003: Fixes javascript integer overflow check. (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/class_finalizer.h" 9 #include "vm/class_finalizer.h"
10 #include "vm/compiler.h" 10 #include "vm/compiler.h"
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 return Double::RawCast(literal_token_.value()); 371 return Double::RawCast(literal_token_.value());
372 } 372 }
373 373
374 374
375 RawInteger* Parser::CurrentIntegerLiteral() const { 375 RawInteger* Parser::CurrentIntegerLiteral() const {
376 literal_token_ ^= tokens_iterator_.CurrentToken(); 376 literal_token_ ^= tokens_iterator_.CurrentToken();
377 ASSERT(literal_token_.kind() == Token::kINTEGER); 377 ASSERT(literal_token_.kind() == Token::kINTEGER);
378 RawInteger* ri = Integer::RawCast(literal_token_.value()); 378 RawInteger* ri = Integer::RawCast(literal_token_.value());
379 if (FLAG_throw_on_javascript_int_overflow) { 379 if (FLAG_throw_on_javascript_int_overflow) {
380 const Integer& i = Integer::Handle(ri); 380 const Integer& i = Integer::Handle(ri);
381 if (i.CheckFiftyThreeBitOverflow()) { 381 if (i.CheckFiftyFourBitOverflow()) {
382 ErrorMsg(TokenPos(), "Integer literal does not fit in 53 bits: %s.", 382 ErrorMsg(TokenPos(), "Integer literal does not fit in 54 bits: %s.",
383 i.ToCString()); 383 i.ToCString());
384 } 384 }
385 } 385 }
386 return ri; 386 return ri;
387 } 387 }
388 388
389 389
390 // A QualIdent is an optionally qualified identifier. 390 // A QualIdent is an optionally qualified identifier.
391 struct QualIdent { 391 struct QualIdent {
392 QualIdent() { 392 QualIdent() {
(...skipping 9816 matching lines...) Expand 10 before | Expand all | Expand 10 after
10209 void Parser::SkipQualIdent() { 10209 void Parser::SkipQualIdent() {
10210 ASSERT(IsIdentifier()); 10210 ASSERT(IsIdentifier());
10211 ConsumeToken(); 10211 ConsumeToken();
10212 if (CurrentToken() == Token::kPERIOD) { 10212 if (CurrentToken() == Token::kPERIOD) {
10213 ConsumeToken(); // Consume the kPERIOD token. 10213 ConsumeToken(); // Consume the kPERIOD token.
10214 ExpectIdentifier("identifier expected after '.'"); 10214 ExpectIdentifier("identifier expected after '.'");
10215 } 10215 }
10216 } 10216 }
10217 10217
10218 } // namespace dart 10218 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698