 Chromium Code Reviews
 Chromium Code Reviews Issue 23453019:
  Allow uncacheable identifiers to go generic.  (Closed) 
  Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
    
  
    Issue 23453019:
  Allow uncacheable identifiers to go generic.  (Closed) 
  Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge| 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) |