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

Unified Diff: src/lookup.h

Issue 1144883002: Start adding support for elements to the LookupIterator (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/elements.cc ('k') | 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 a574980c1fe2ccad20ebff3ac42bb83e4929d45e..48dce3a645732df9e45a06f41be205a2a7873bb7 100644
--- a/src/lookup.h
+++ b/src/lookup.h
@@ -52,6 +52,8 @@ class LookupIterator final BASE_EMBEDDED {
property_details_(PropertyDetails::Empty()),
isolate_(name->GetIsolate()),
name_(name),
+ // kMaxUInt32 isn't a valid index.
+ index_(kMaxUInt32),
receiver_(receiver),
holder_(GetRoot(receiver_, isolate_)),
holder_map_(holder_->map(), isolate_),
@@ -70,6 +72,8 @@ class LookupIterator final BASE_EMBEDDED {
property_details_(PropertyDetails::Empty()),
isolate_(name->GetIsolate()),
name_(name),
+ // kMaxUInt32 isn't a valid index.
+ index_(kMaxUInt32),
receiver_(receiver),
holder_(holder),
holder_map_(holder_->map(), isolate_),
@@ -78,9 +82,54 @@ class LookupIterator final BASE_EMBEDDED {
Next();
}
+ LookupIterator(Isolate* isolate, Handle<Object> receiver, uint32_t index,
+ Configuration configuration = PROTOTYPE_CHAIN)
+ : configuration_(configuration),
+ state_(NOT_FOUND),
+ exotic_index_state_(ExoticIndexState::kNotExotic),
+ interceptor_state_(InterceptorState::kUninitialized),
+ property_details_(PropertyDetails::Empty()),
+ isolate_(isolate),
+ name_(),
+ index_(index),
+ receiver_(receiver),
+ holder_(GetRoot(receiver_, isolate_)),
+ holder_map_(holder_->map(), isolate_),
+ initial_holder_(holder_),
+ number_(DescriptorArray::kNotFound) {
+ // kMaxUInt32 isn't a valid index.
+ DCHECK_NE(kMaxUInt32, index_);
+ Next();
+ }
+
+ LookupIterator(Isolate* isolate, Handle<Object> receiver, uint32_t index,
+ Handle<JSReceiver> holder,
+ Configuration configuration = PROTOTYPE_CHAIN)
+ : configuration_(configuration),
+ state_(NOT_FOUND),
+ exotic_index_state_(ExoticIndexState::kNotExotic),
+ interceptor_state_(InterceptorState::kUninitialized),
+ property_details_(PropertyDetails::Empty()),
+ isolate_(isolate),
+ name_(),
+ index_(index),
+ receiver_(receiver),
+ holder_(holder),
+ holder_map_(holder_->map(), isolate_),
+ initial_holder_(holder_),
+ number_(DescriptorArray::kNotFound) {
+ // kMaxUInt32 isn't a valid index.
+ DCHECK_NE(kMaxUInt32, index_);
+ Next();
+ }
+
Isolate* isolate() const { return isolate_; }
State state() const { return state_; }
+
Handle<Name> name() const { return name_; }
+ uint32_t index() const { return index_; }
+
+ bool IsElement() const { return index_ != kMaxUInt32; }
bool IsFound() const { return state_ != NOT_FOUND; }
void Next();
@@ -161,6 +210,7 @@ class LookupIterator final BASE_EMBEDDED {
Handle<Object> FetchValue() const;
void ReloadPropertyInformation();
bool SkipInterceptor(JSObject* holder);
+ bool HasInterceptor(Map* map) const;
bool IsBootstrapping() const;
@@ -192,7 +242,7 @@ class LookupIterator final BASE_EMBEDDED {
}
}
- enum class ExoticIndexState { kUninitialized, kNoIndex, kIndex };
+ enum class ExoticIndexState { kUninitialized, kNotExotic, kExotic };
bool IsIntegerIndexedExotic(JSReceiver* holder);
// If configuration_ becomes mutable, update
@@ -205,12 +255,13 @@ class LookupIterator final BASE_EMBEDDED {
PropertyDetails property_details_;
Isolate* const isolate_;
Handle<Name> name_;
+ uint32_t index_;
Handle<Object> transition_;
const Handle<Object> receiver_;
Handle<JSReceiver> holder_;
Handle<Map> holder_map_;
const Handle<JSReceiver> initial_holder_;
- int number_;
+ uint32_t number_;
};
« no previous file with comments | « src/elements.cc ('k') | src/lookup.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698