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

Unified Diff: src/ast.cc

Issue 231073002: WIP: Parser: delay string internalization. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: internalizing better Created 6 years, 7 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: src/ast.cc
diff --git a/src/ast.cc b/src/ast.cc
index 303c442f8434301165ec8afd2106637cc410e8ac..024513b7775636b3f5e1b78e0fb6ae1a46d252fb 100644
--- a/src/ast.cc
+++ b/src/ast.cc
@@ -55,14 +55,13 @@ bool Expression::IsUndefinedLiteral(Isolate* isolate) const {
// The global identifier "undefined" is immutable. Everything
// else could be reassigned.
return var != NULL && var->location() == Variable::UNALLOCATED &&
- String::Equals(var_proxy->name(),
- isolate->factory()->undefined_string());
+ ParserSymbolTable::SymbolMatches(var_proxy->raw_name(), "undefined", 9);
}
VariableProxy::VariableProxy(Zone* zone, Variable* var, int position)
: Expression(zone, position),
- name_(var->name()),
+ raw_name_(var->raw_name()),
var_(NULL), // Will be set by the call to BindTo.
is_this_(var->is_this()),
is_trivial_(false),
@@ -73,19 +72,17 @@ VariableProxy::VariableProxy(Zone* zone, Variable* var, int position)
VariableProxy::VariableProxy(Zone* zone,
- Handle<String> name,
+ ParserSymbolTable::Symbol* raw_name,
bool is_this,
Interface* interface,
int position)
: Expression(zone, position),
- name_(name),
+ raw_name_(raw_name),
var_(NULL),
is_this_(is_this),
is_trivial_(false),
is_lvalue_(false),
interface_(interface) {
- // Names must be canonicalized for fast equality checks.
- ASSERT(name->IsInternalizedString());
}
@@ -93,7 +90,7 @@ void VariableProxy::BindTo(Variable* var) {
ASSERT(var_ == NULL); // must be bound only once
ASSERT(var != NULL); // must bind
ASSERT(!FLAG_harmony_modules || interface_->IsUnified(var->interface()));
- ASSERT((is_this() && var->is_this()) || name_.is_identical_to(var->name()));
+ ASSERT((is_this() && var->is_this()) || raw_name_ == var->raw_name());
// Ideally CONST-ness should match. However, this is very hard to achieve
// because we don't know the exact semantics of conflicting (const and
// non-const) multiple variable declarations, const vars introduced via
@@ -185,10 +182,7 @@ ObjectLiteralProperty::ObjectLiteralProperty(
emit_store_ = true;
key_ = key;
value_ = value;
- Handle<Object> k = key->value();
- if (k->IsInternalizedString() &&
- String::Equals(Handle<String>::cast(k),
- zone->isolate()->factory()->proto_string())) {
+ if (ParserSymbolTable::SymbolMatches(key->string(), "__proto__", 9)) {
kind_ = PROTOTYPE;
} else if (value_->AsMaterializedLiteral() != NULL) {
kind_ = MATERIALIZED_LITERAL;
@@ -1122,9 +1116,10 @@ void AstConstructionVisitor::VisitCallRuntime(CallRuntime* node) {
// optimize them.
add_flag(kDontInline);
} else if (node->function()->intrinsic_type == Runtime::INLINE &&
- (node->name()->IsOneByteEqualTo(
- STATIC_ASCII_VECTOR("_ArgumentsLength")) ||
- node->name()->IsOneByteEqualTo(STATIC_ASCII_VECTOR("_Arguments")))) {
+ (ParserSymbolTable::SymbolMatches(node->raw_name(),
+ "_ArgumentsLength", 16) ||
+ ParserSymbolTable::SymbolMatches(node->raw_name(), "_Arguments",
+ 9))) {
// Don't inline the %_ArgumentsLength or %_Arguments because their
// implementation will not work. There is no stack frame to get them
// from.

Powered by Google App Engine
This is Rietveld 408576698