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

Unified Diff: src/objects-inl.h

Issue 23453019: Allow uncacheable identifiers to go generic. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Adding test Created 7 years, 3 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 | « src/objects.cc ('k') | test/mjsunit/regress/regress-store-uncacheable.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index f629d9f19f52b122f9f71c838c787ab91314df5f..fb8f7ce974777f8f884cad4159f2a1d9c4dfc480 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -2649,6 +2649,32 @@ bool Name::Equals(Name* other) {
}
+static bool IsIdentifier(UnicodeCache* cache, Name* name) {
Jakob Kummerow 2013/09/02 13:28:59 This seems a little large for -inl.h. Please move
+ // Checks whether the buffer contains an identifier (no escape).
+ if (!name->IsString()) return false;
+ String* string = String::cast(name);
+ if (string->length() == 0) return false;
+ ConsStringIteratorOp op;
+ StringCharacterStream stream(string, &op);
+ if (!cache->IsIdentifierStart(stream.GetNext())) {
+ return false;
+ }
+ while (stream.HasMore()) {
+ if (!cache->IsIdentifierPart(stream.GetNext())) {
+ return false;
+ }
+ }
+ return true;
+}
+
+
+bool Name::IsCacheable(Isolate* isolate) {
+ return IsSymbol() ||
+ IsIdentifier(isolate->unicode_cache(), this) ||
+ this == isolate->heap()->hidden_string();
+}
+
+
ACCESSORS(Symbol, name, Object, kNameOffset)
« no previous file with comments | « src/objects.cc ('k') | test/mjsunit/regress/regress-store-uncacheable.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698