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

Unified Diff: vm/parser.cc

Issue 9462003: Changes to shrink the token stream representation from two words to one word. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 10 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
Index: vm/parser.cc
===================================================================
--- vm/parser.cc (revision 4579)
+++ vm/parser.cc (working copy)
@@ -265,6 +265,22 @@
}
+RawDouble* Parser::CurrentDoubleLiteral() const {
+ LiteralToken& token = LiteralToken::Handle();
+ token ^= tokens_.TokenAt(token_index_);
+ ASSERT(token.kind() == Token::kDOUBLE);
+ return reinterpret_cast<RawDouble*>(token.value());
+}
+
+
+RawInteger* Parser::CurrentIntegerLiteral() const {
+ LiteralToken& token = LiteralToken::Handle();
+ token ^= tokens_.TokenAt(token_index_);
+ ASSERT(token.kind() == Token::kINTEGER);
+ return reinterpret_cast<RawInteger*>(token.value());
+}
+
+
// A QualIdent is an optionally qualified identifier.
struct QualIdent {
QualIdent() {
@@ -7550,10 +7566,7 @@
primary = new LoadLocalNode(token_index_, *local);
ConsumeToken();
} else if (CurrentToken() == Token::kINTEGER) {
- String* int_literal = CurrentLiteral();
- ASSERT(int_literal != NULL);
- ASSERT(int_literal->Length() > 0);
- const Integer& literal = Integer::ZoneHandle(Integer::New(*int_literal));
+ const Integer& literal = Integer::ZoneHandle(CurrentIntegerLiteral());
primary = new LiteralNode(token_index_, literal);
ConsumeToken();
} else if (CurrentToken() == Token::kTRUE) {
@@ -7572,11 +7585,7 @@
SetAllowFunctionLiterals(saved_mode);
ExpectToken(Token::kRPAREN);
} else if (CurrentToken() == Token::kDOUBLE) {
- String* double_literal = CurrentLiteral();
- ASSERT(double_literal != NULL);
- ASSERT(double_literal->Length() > 0);
- Double& double_value =
- Double::ZoneHandle(Double::NewCanonical(*double_literal));
+ Double& double_value = Double::ZoneHandle(CurrentDoubleLiteral());
if (double_value.IsNull()) {
ErrorMsg("invalid double literal");
}

Powered by Google App Engine
This is Rietveld 408576698