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

Unified Diff: src/lookup.cc

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/api.cc ('k') | src/lookup-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/lookup.cc
diff --git a/src/lookup.cc b/src/lookup.cc
index 38cc522c6e0833fb740b9a8cbb00fd88d8e3d185..aa66d152e39a9cae781a9978f6fa2facecac6825 100644
--- a/src/lookup.cc
+++ b/src/lookup.cc
@@ -264,6 +264,13 @@ Handle<Object> LookupIterator::FetchValue() const {
Handle<JSObject> holder = GetHolder<JSObject>();
if (IsElement()) {
// TODO(verwaest): Optimize.
+ if (holder->IsStringObjectWithCharacterAt(index_)) {
+ Handle<JSValue> js_value = Handle<JSValue>::cast(holder);
+ Handle<String> string(String::cast(js_value->value()));
+ return factory()->LookupSingleCharacterStringFromCode(
+ String::Flatten(string)->Get(index_));
+ }
+
ElementsAccessor* accessor = holder->GetElementsAccessor();
return accessor->Get(holder, index_);
} else if (holder_map_->IsGlobalObjectMap()) {
« no previous file with comments | « src/api.cc ('k') | src/lookup-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698