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

Unified Diff: vm/scanner.cc

Issue 10783035: Create frequently used symbols in the vm isolate (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 5 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 | « vm/runtime_entry_test.cc ('k') | vm/scopes.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: vm/scanner.cc
===================================================================
--- vm/scanner.cc (revision 9829)
+++ vm/scanner.cc (working copy)
@@ -8,6 +8,7 @@
#include "vm/flags.h"
#include "vm/object.h"
#include "vm/object_store.h"
+#include "vm/symbols.h"
#include "vm/thread.h"
#include "vm/token.h"
@@ -74,7 +75,7 @@
void Scanner::ErrorMsg(const char* msg) {
current_token_.kind = Token::kERROR;
- current_token_.literal = &String::ZoneHandle(String::NewSymbol(msg));
+ current_token_.literal = &String::ZoneHandle(Symbols::New(msg));
current_token_.position = c0_pos_;
token_start_ = lookahead_pos_;
current_token_.offset = lookahead_pos_;
@@ -276,7 +277,7 @@
String& symbol = String::ZoneHandle();
symbol ^= keyword_symbol_table_.At(i);
if (symbol.IsNull()) {
- symbol = String::NewSymbol(source_, ident_pos, ident_length);
+ symbol = Symbols::New(source_, ident_pos, ident_length);
keyword_symbol_table_.SetAt(i, symbol);
}
keywords_[i].keyword_symbol = &symbol;
@@ -292,11 +293,11 @@
// We did not read a keyword.
current_token_.kind = Token::kIDENT;
String& literal =
- String::ZoneHandle(String::NewSymbol(source_, ident_pos, ident_length));
+ String::ZoneHandle(Symbols::New(source_, ident_pos, ident_length));
if ((ident_char0 == kPrivateIdentifierStart) && !FLAG_disable_privacy) {
// Private identifiers are mangled on a per script basis.
literal = String::Concat(literal, private_key_);
- literal = String::NewSymbol(literal);
+ literal = Symbols::New(literal);
}
current_token_.literal = &literal;
}
@@ -366,7 +367,7 @@
ReadChar();
ident_length++;
}
- return String::NewSymbol(source_, ident_pos, ident_length);
+ return Symbols::New(source_, ident_pos, ident_length);
}
@@ -391,10 +392,10 @@
SkipLine();
return;
}
- const String& kLibrary = String::Handle(String::NewSymbol("library"));
- const String& kImport = String::Handle(String::NewSymbol("import"));
- const String& kSource = String::Handle(String::NewSymbol("source"));
- const String& kResource = String::Handle(String::NewSymbol("resource"));
+ const String& kLibrary = String::Handle(Symbols::New("library"));
+ const String& kImport = String::Handle(Symbols::New("import"));
+ const String& kSource = String::Handle(Symbols::New("source"));
+ const String& kResource = String::Handle(Symbols::New("resource"));
const String& ident = String::Handle(ConsumeIdentChars(false));
if (ident.Equals(kLibrary)) {
current_token_.kind = Token::kLIBRARY;
@@ -553,7 +554,7 @@
ASSERT(string_chars.data() != NULL);
// Strings are canonicalized: Allocate a symbol.
current_token_.literal = &String::ZoneHandle(
- String::NewSymbol(string_chars.data(), string_chars.length()));
+ Symbols::New(string_chars.data(), string_chars.length()));
// Preserve error tokens.
if (current_token_.kind != Token::kERROR) {
current_token_.kind = Token::kSTRING;
@@ -576,7 +577,7 @@
ASSERT(string_chars.data() != NULL);
// Strings are canonicalized: Allocate a symbol.
current_token_.literal = &String::ZoneHandle(
- String::NewSymbol(string_chars.data(), string_chars.length()));
+ Symbols::New(string_chars.data(), string_chars.length()));
}
EndStringLiteral();
return;
« no previous file with comments | « vm/runtime_entry_test.cc ('k') | vm/scopes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698