Allow all Names to be fast property names

R=verwaest@chromium.org

Review URL: https://codereview.chromium.org/329393005

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21834 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent a4d1e01b
...@@ -1326,8 +1326,7 @@ MaybeHandle<Object> StoreIC::Store(Handle<Object> object, ...@@ -1326,8 +1326,7 @@ MaybeHandle<Object> StoreIC::Store(Handle<Object> object,
TRACE_IC("StoreIC", name); TRACE_IC("StoreIC", name);
} else if (can_store) { } else if (can_store) {
UpdateCaches(&lookup, receiver, name, value); UpdateCaches(&lookup, receiver, name, value);
} else if (!name->IsCacheable(isolate()) || } else if (lookup.IsNormal() ||
lookup.IsNormal() ||
(lookup.IsField() && lookup.CanHoldValue(value))) { (lookup.IsField() && lookup.CanHoldValue(value))) {
Handle<Code> stub = generic_stub(); Handle<Code> stub = generic_stub();
set_target(*stub); set_target(*stub);
......
...@@ -1802,11 +1802,7 @@ MaybeHandle<Map> Map::CopyWithField(Handle<Map> map, ...@@ -1802,11 +1802,7 @@ MaybeHandle<Map> Map::CopyWithField(Handle<Map> map,
return MaybeHandle<Map>(); return MaybeHandle<Map>();
} }
// Normalize the object if the name is an actual name (not the
// hidden strings) and is not a real identifier.
// Normalize the object if it will have too many fast properties.
Isolate* isolate = map->GetIsolate(); Isolate* isolate = map->GetIsolate();
if (!name->IsCacheable(isolate)) return MaybeHandle<Map>();
// Compute the new index for new field. // Compute the new index for new field.
int index = map->NextFreePropertyIndex(); int index = map->NextFreePropertyIndex();
...@@ -8403,30 +8399,6 @@ bool DescriptorArray::IsEqualTo(DescriptorArray* other) { ...@@ -8403,30 +8399,6 @@ bool DescriptorArray::IsEqualTo(DescriptorArray* other) {
#endif #endif
static bool IsIdentifier(UnicodeCache* cache, Name* name) {
// Checks whether the buffer contains an identifier (no escape).
if (!name->IsString()) return false;
String* string = String::cast(name);
if (string->length() == 0) return true;
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);
}
bool String::LooksValid() { bool String::LooksValid() {
if (!GetIsolate()->heap()->Contains(this)) return false; if (!GetIsolate()->heap()->Contains(this)) return false;
return true; return true;
......
...@@ -8928,8 +8928,6 @@ class Name: public HeapObject { ...@@ -8928,8 +8928,6 @@ class Name: public HeapObject {
// Casting. // Casting.
static inline Name* cast(Object* obj); static inline Name* cast(Object* obj);
bool IsCacheable(Isolate* isolate);
DECLARE_PRINTER(Name) DECLARE_PRINTER(Name)
// Layout description. // Layout description.
......
...@@ -108,6 +108,6 @@ var obj3 = {}; ...@@ -108,6 +108,6 @@ var obj3 = {};
AddProps3(obj3); AddProps3(obj3);
assertTrue(%HasFastProperties(obj3)); assertTrue(%HasFastProperties(obj3));
var bad_name = {}; var funny_name = {};
bad_name[".foo"] = 0; funny_name[".foo"] = 0;
assertFalse(%HasFastProperties(bad_name)); assertTrue(%HasFastProperties(funny_name));
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment