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

Unified Diff: src/lookup.h

Issue 1178893002: Introduce LookupIterator::PropertyOrElement which converts name to index if possible. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 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/json-stringifier.h ('k') | src/objects.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/lookup.h
diff --git a/src/lookup.h b/src/lookup.h
index 48604b2389a375da7a99dd09bea37e217bfb3062..7aafdea03076aa064b6b1caddf6e7b636005e04c 100644
--- a/src/lookup.h
+++ b/src/lookup.h
@@ -26,7 +26,8 @@ class LookupIterator final BASE_EMBEDDED {
HIDDEN_SKIP_INTERCEPTOR = kHidden,
HIDDEN = kHidden | kInterceptor,
PROTOTYPE_CHAIN_SKIP_INTERCEPTOR = kHidden | kPrototypeChain,
- PROTOTYPE_CHAIN = kHidden | kPrototypeChain | kInterceptor
+ PROTOTYPE_CHAIN = kHidden | kPrototypeChain | kInterceptor,
+ DEFAULT = PROTOTYPE_CHAIN
};
enum State {
@@ -44,7 +45,7 @@ class LookupIterator final BASE_EMBEDDED {
};
LookupIterator(Handle<Object> receiver, Handle<Name> name,
- Configuration configuration = PROTOTYPE_CHAIN)
+ Configuration configuration = DEFAULT)
: configuration_(ComputeConfiguration(configuration, name)),
state_(NOT_FOUND),
exotic_index_state_(ExoticIndexState::kUninitialized),
@@ -68,7 +69,7 @@ class LookupIterator final BASE_EMBEDDED {
LookupIterator(Handle<Object> receiver, Handle<Name> name,
Handle<JSReceiver> holder,
- Configuration configuration = PROTOTYPE_CHAIN)
+ Configuration configuration = DEFAULT)
: configuration_(ComputeConfiguration(configuration, name)),
state_(NOT_FOUND),
exotic_index_state_(ExoticIndexState::kUninitialized),
@@ -91,7 +92,7 @@ class LookupIterator final BASE_EMBEDDED {
}
LookupIterator(Isolate* isolate, Handle<Object> receiver, uint32_t index,
- Configuration configuration = PROTOTYPE_CHAIN)
+ Configuration configuration = DEFAULT)
: configuration_(configuration),
state_(NOT_FOUND),
exotic_index_state_(ExoticIndexState::kUninitialized),
@@ -112,7 +113,7 @@ class LookupIterator final BASE_EMBEDDED {
LookupIterator(Isolate* isolate, Handle<Object> receiver, uint32_t index,
Handle<JSReceiver> holder,
- Configuration configuration = PROTOTYPE_CHAIN)
+ Configuration configuration = DEFAULT)
: configuration_(configuration),
state_(NOT_FOUND),
exotic_index_state_(ExoticIndexState::kUninitialized),
@@ -131,6 +132,29 @@ class LookupIterator final BASE_EMBEDDED {
Next();
}
+ static LookupIterator PropertyOrElement(
+ Isolate* isolate, Handle<Object> receiver, Handle<Name> name,
+ Configuration configuration = DEFAULT) {
+ uint32_t index;
+ LookupIterator it =
+ name->AsArrayIndex(&index)
+ ? LookupIterator(isolate, receiver, index, configuration)
+ : LookupIterator(receiver, name, configuration);
+ it.name_ = name;
+ return it;
+ }
+
+ static LookupIterator PropertyOrElement(
+ Isolate* isolate, Handle<Object> receiver, Handle<Name> name,
+ Handle<JSReceiver> holder, Configuration configuration = DEFAULT) {
+ uint32_t index;
+ LookupIterator it =
+ name->AsArrayIndex(&index)
+ ? LookupIterator(isolate, receiver, index, holder, configuration)
+ : LookupIterator(receiver, name, holder, configuration);
+ it.name_ = name;
+ return it;
+ }
Isolate* isolate() const { return isolate_; }
State state() const { return state_; }
« no previous file with comments | « src/json-stringifier.h ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698