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

Unified Diff: src/lookup.h

Issue 1753273002: Specialize helper methods in the LookupIterator by is_element. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase fix Created 4 years, 10 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 | « no previous file | src/lookup.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 f19b6982095274d42a0561674204f2b68716fdfc..026a575f66b03c81b8d2e48265b355205b8569b7 100644
--- a/src/lookup.h
+++ b/src/lookup.h
@@ -59,7 +59,7 @@ class LookupIterator final BASE_EMBEDDED {
uint32_t index; // Assert that the name is not an array index.
DCHECK(!name->AsArrayIndex(&index));
#endif // DEBUG
- Start();
+ Start<false>();
}
LookupIterator(Handle<Object> receiver, Handle<Name> name,
@@ -78,7 +78,7 @@ class LookupIterator final BASE_EMBEDDED {
uint32_t index; // Assert that the name is not an array index.
DCHECK(!name->AsArrayIndex(&index));
#endif // DEBUG
- Start();
+ Start<false>();
}
LookupIterator(Isolate* isolate, Handle<Object> receiver, uint32_t index,
@@ -93,7 +93,7 @@ class LookupIterator final BASE_EMBEDDED {
initial_holder_(GetRoot(isolate, receiver, index)) {
// kMaxUInt32 isn't a valid index.
DCHECK_NE(kMaxUInt32, index_);
- Start();
+ Start<true>();
}
LookupIterator(Isolate* isolate, Handle<Object> receiver, uint32_t index,
@@ -109,7 +109,7 @@ class LookupIterator final BASE_EMBEDDED {
initial_holder_(holder) {
// kMaxUInt32 isn't a valid index.
DCHECK_NE(kMaxUInt32, index_);
- Start();
+ Start<true>();
}
static LookupIterator PropertyOrElement(
@@ -142,7 +142,10 @@ class LookupIterator final BASE_EMBEDDED {
Isolate* isolate, Handle<Object> receiver, Handle<Object> key,
bool* success, Configuration configuration = DEFAULT);
- void Restart() { RestartInternal(InterceptorState::kUninitialized); }
+ void Restart() {
+ InterceptorState state = InterceptorState::kUninitialized;
+ IsElement() ? RestartInternal<true>(state) : RestartInternal<false>(state);
+ }
Isolate* isolate() const { return isolate_; }
State state() const { return state_; }
@@ -257,9 +260,6 @@ class LookupIterator final BASE_EMBEDDED {
void UpdateProtector();
private:
- void Start();
- void NextInternal(Map* map, JSReceiver* holder);
-
enum class InterceptorState {
kUninitialized,
kSkipNonMasking,
@@ -269,21 +269,32 @@ class LookupIterator final BASE_EMBEDDED {
Handle<Map> GetReceiverMap() const;
MUST_USE_RESULT inline JSReceiver* NextHolder(Map* map);
+
+ template <bool is_element>
+ void Start();
+ template <bool is_element>
+ void NextInternal(Map* map, JSReceiver* holder);
+ template <bool is_element>
inline State LookupInHolder(Map* map, JSReceiver* holder) {
return map->instance_type() <= LAST_SPECIAL_RECEIVER_TYPE
- ? LookupInSpecialHolder(map, holder)
- : LookupInRegularHolder(map, holder);
+ ? LookupInSpecialHolder<is_element>(map, holder)
+ : LookupInRegularHolder<is_element>(map, holder);
}
+ template <bool is_element>
State LookupInRegularHolder(Map* map, JSReceiver* holder);
+ template <bool is_element>
State LookupInSpecialHolder(Map* map, JSReceiver* holder);
+ template <bool is_element>
void RestartLookupForNonMaskingInterceptors() {
- RestartInternal(InterceptorState::kProcessNonMasking);
+ RestartInternal<is_element>(InterceptorState::kProcessNonMasking);
}
+ template <bool is_element>
void RestartInternal(InterceptorState interceptor_state);
Handle<Object> FetchValue() const;
+ template <bool is_element>
void ReloadPropertyInformation();
+
inline bool SkipInterceptor(JSObject* holder);
- bool HasInterceptor(Map* map) const;
inline InterceptorInfo* GetInterceptor(JSObject* holder) const {
if (IsElement()) return holder->GetIndexedInterceptor();
return holder->GetNamedInterceptor();
« no previous file with comments | « no previous file | src/lookup.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698