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

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.CheckJavascriptIntegerOverflow()) {
382 ErrorMsg(TokenPos(), "Integer literal does not fit in 53 bits: %s.", 382 ErrorMsg(TokenPos(),
383 i.ToCString()); 383 "Integer literal does not fit in a Javascript integer: %s.",
384 i.ToCString());
384 } 385 }
385 } 386 }
386 return ri; 387 return ri;
387 } 388 }
388 389
389 390
390 // A QualIdent is an optionally qualified identifier. 391 // A QualIdent is an optionally qualified identifier.
391 struct QualIdent { 392 struct QualIdent {
392 QualIdent() { 393 QualIdent() {
393 Clear(); 394 Clear();
(...skipping 9815 matching lines...) Expand 10 before | Expand all | Expand 10 after
10209 void Parser::SkipQualIdent() { 10210 void Parser::SkipQualIdent() {
10210 ASSERT(IsIdentifier()); 10211 ASSERT(IsIdentifier());
10211 ConsumeToken(); 10212 ConsumeToken();
10212 if (CurrentToken() == Token::kPERIOD) { 10213 if (CurrentToken() == Token::kPERIOD) {
10213 ConsumeToken(); // Consume the kPERIOD token. 10214 ConsumeToken(); // Consume the kPERIOD token.
10214 ExpectIdentifier("identifier expected after '.'"); 10215 ExpectIdentifier("identifier expected after '.'");
10215 } 10216 }
10216 } 10217 }
10217 10218
10218 } // namespace dart 10219 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698