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

Unified Diff: src/lookup-inl.h

Issue 1153583006: Use LookupIterator for GetElementAttributes and friends (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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
« no previous file with comments | « src/lookup.cc ('k') | src/objects.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/lookup-inl.h
diff --git a/src/lookup-inl.h b/src/lookup-inl.h
index 5bb1ba107afcf00ed95a5d76be510a6b659bfd72..5ebfcb3e11c4703373345449e1de6f9b297484fa 100644
--- a/src/lookup-inl.h
+++ b/src/lookup-inl.h
@@ -59,16 +59,23 @@ LookupIterator::State LookupIterator::LookupInHolder(Map* const map,
case INTERCEPTOR:
if (IsElement()) {
// TODO(verwaest): Optimize.
- JSObject* js_object = JSObject::cast(holder);
- ElementsAccessor* accessor = js_object->GetElementsAccessor();
- FixedArrayBase* backing_store = js_object->elements();
- number_ = accessor->GetIndexForKey(backing_store, index_);
- if (number_ == kMaxUInt32) return NOT_FOUND;
- if (accessor->GetAttributes(js_object, index_, backing_store) ==
- ABSENT) {
- return NOT_FOUND;
+ if (holder->IsStringObjectWithCharacterAt(index_)) {
+ PropertyAttributes attributes =
+ static_cast<PropertyAttributes>(READ_ONLY | DONT_DELETE);
+ property_details_ = PropertyDetails(attributes, v8::internal::DATA, 0,
+ PropertyCellType::kNoCell);
+ } else {
+ JSObject* js_object = JSObject::cast(holder);
+ ElementsAccessor* accessor = js_object->GetElementsAccessor();
+ FixedArrayBase* backing_store = js_object->elements();
+ number_ = accessor->GetIndexForKey(backing_store, index_);
+ if (number_ == kMaxUInt32) return NOT_FOUND;
+ if (accessor->GetAttributes(js_object, index_, backing_store) ==
+ ABSENT) {
+ return NOT_FOUND;
+ }
+ property_details_ = accessor->GetDetails(backing_store, number_);
}
- property_details_ = accessor->GetDetails(backing_store, number_);
} else if (holder->IsGlobalObject()) {
GlobalDictionary* dict = JSObject::cast(holder)->global_dictionary();
int number = dict->FindEntry(name_);
« no previous file with comments | « src/lookup.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698