diff options
author | Zeno Albisser <zeno.albisser@theqtcompany.com> | 2014-12-05 15:04:29 +0100 |
---|---|---|
committer | Andras Becsi <andras.becsi@theqtcompany.com> | 2014-12-09 10:49:28 +0100 |
commit | af6588f8d723931a298c995fa97259bb7f7deb55 (patch) | |
tree | 060ca707847ba1735f01af2372e0d5e494dc0366 /chromium/v8/src/lookup.h | |
parent | 2fff84d821cc7b1c785f6404e0f8091333283e74 (diff) | |
download | qtwebengine-chromium-af6588f8d723931a298c995fa97259bb7f7deb55.tar.gz |
BASELINE: Update chromium to 40.0.2214.28 and ninja to 1.5.3.
Change-Id: I759465284fd64d59ad120219cbe257f7402c4181
Reviewed-by: Andras Becsi <andras.becsi@theqtcompany.com>
Diffstat (limited to 'chromium/v8/src/lookup.h')
-rw-r--r-- | chromium/v8/src/lookup.h | 204 |
1 files changed, 112 insertions, 92 deletions
diff --git a/chromium/v8/src/lookup.h b/chromium/v8/src/lookup.h index 0ac9d353adc..52231e5d908 100644 --- a/chromium/v8/src/lookup.h +++ b/chromium/v8/src/lookup.h @@ -12,70 +12,61 @@ namespace v8 { namespace internal { -class LookupIterator V8_FINAL BASE_EMBEDDED { +class LookupIterator FINAL BASE_EMBEDDED { public: enum Configuration { - CHECK_OWN_REAL = 0, - CHECK_HIDDEN = 1 << 0, - CHECK_DERIVED = 1 << 1, - CHECK_INTERCEPTOR = 1 << 2, - CHECK_ACCESS_CHECK = 1 << 3, - CHECK_ALL = CHECK_HIDDEN | CHECK_DERIVED | - CHECK_INTERCEPTOR | CHECK_ACCESS_CHECK, - SKIP_INTERCEPTOR = CHECK_ALL ^ CHECK_INTERCEPTOR, - CHECK_OWN = CHECK_ALL ^ CHECK_DERIVED + // Configuration bits. + kHidden = 1 << 0, + kInterceptor = 1 << 1, + kPrototypeChain = 1 << 2, + + // Convience combinations of bits. + OWN_SKIP_INTERCEPTOR = 0, + OWN = kInterceptor, + HIDDEN_SKIP_INTERCEPTOR = kHidden, + HIDDEN = kHidden | kInterceptor, + PROTOTYPE_CHAIN_SKIP_INTERCEPTOR = kHidden | kPrototypeChain, + PROTOTYPE_CHAIN = kHidden | kPrototypeChain | kInterceptor }; enum State { - NOT_FOUND, - PROPERTY, - INTERCEPTOR, ACCESS_CHECK, - JSPROXY - }; - - enum PropertyKind { + INTERCEPTOR, + JSPROXY, + NOT_FOUND, + ACCESSOR, DATA, - ACCESSOR - }; - - enum PropertyEncoding { - DICTIONARY, - DESCRIPTOR + TRANSITION, + // Set state_ to BEFORE_PROPERTY to ensure that the next lookup will be a + // PROPERTY lookup. + BEFORE_PROPERTY = INTERCEPTOR }; - LookupIterator(Handle<Object> receiver, - Handle<Name> name, - Configuration configuration = CHECK_ALL) - : configuration_(configuration), + LookupIterator(Handle<Object> receiver, Handle<Name> name, + Configuration configuration = PROTOTYPE_CHAIN) + : configuration_(ComputeConfiguration(configuration, name)), state_(NOT_FOUND), - property_kind_(DATA), - property_encoding_(DESCRIPTOR), - property_details_(NONE, NONEXISTENT, Representation::None()), + property_details_(NONE, NORMAL, Representation::None()), isolate_(name->GetIsolate()), name_(name), - maybe_receiver_(receiver), + receiver_(receiver), number_(DescriptorArray::kNotFound) { - Handle<JSReceiver> root = GetRoot(); - holder_map_ = handle(root->map()); - maybe_holder_ = root; + holder_ = GetRoot(); + holder_map_ = handle(holder_->map(), isolate_); Next(); } - LookupIterator(Handle<Object> receiver, - Handle<Name> name, + LookupIterator(Handle<Object> receiver, Handle<Name> name, Handle<JSReceiver> holder, - Configuration configuration = CHECK_ALL) - : configuration_(configuration), + Configuration configuration = PROTOTYPE_CHAIN) + : configuration_(ComputeConfiguration(configuration, name)), state_(NOT_FOUND), - property_kind_(DATA), - property_encoding_(DESCRIPTOR), - property_details_(NONE, NONEXISTENT, Representation::None()), + property_details_(NONE, NORMAL, Representation::None()), isolate_(name->GetIsolate()), name_(name), - holder_map_(holder->map()), - maybe_receiver_(receiver), - maybe_holder_(holder), + holder_map_(holder->map(), isolate_), + receiver_(receiver), + holder_(holder), number_(DescriptorArray::kNotFound) { Next(); } @@ -86,93 +77,122 @@ class LookupIterator V8_FINAL BASE_EMBEDDED { bool IsFound() const { return state_ != NOT_FOUND; } void Next(); + void NotFound() { + has_property_ = false; + state_ = NOT_FOUND; + } - Heap* heap() const { return isolate_->heap(); } Factory* factory() const { return isolate_->factory(); } - Handle<Object> GetReceiver() const { - return Handle<Object>::cast(maybe_receiver_.ToHandleChecked()); + Handle<Object> GetReceiver() const { return receiver_; } + Handle<JSObject> GetStoreTarget() const; + bool is_dictionary_holder() const { return holder_map_->is_dictionary_map(); } + Handle<Map> transition_map() const { + DCHECK_EQ(TRANSITION, state_); + return transition_map_; } - Handle<JSObject> GetHolder() const { - ASSERT(IsFound() && state_ != JSPROXY); - return Handle<JSObject>::cast(maybe_holder_.ToHandleChecked()); + template <class T> + Handle<T> GetHolder() const { + DCHECK(IsFound()); + return Handle<T>::cast(holder_); } Handle<JSReceiver> GetRoot() const; - - /* Dynamically reduce the trapped types. */ - void skip_interceptor() { - configuration_ = static_cast<Configuration>( - configuration_ & ~CHECK_INTERCEPTOR); - } - void skip_access_check() { - configuration_ = static_cast<Configuration>( - configuration_ & ~CHECK_ACCESS_CHECK); - } + bool HolderIsReceiverOrHiddenPrototype() const; /* ACCESS_CHECK */ bool HasAccess(v8::AccessType access_type) const; /* PROPERTY */ - // HasProperty needs to be called before any of the other PROPERTY methods - // below can be used. It ensures that we are able to provide a definite - // answer, and loads extra information about the property. - bool HasProperty(); - PropertyKind property_kind() const { - ASSERT(has_property_); - return property_kind_; + void PrepareForDataProperty(Handle<Object> value); + void PrepareTransitionToDataProperty(Handle<Object> value, + PropertyAttributes attributes, + Object::StoreFromKeyed store_mode); + bool IsCacheableTransition() { + bool cacheable = + state_ == TRANSITION && transition_map()->GetBackPointer()->IsMap(); + if (cacheable) { + property_details_ = transition_map_->GetLastDescriptorDetails(); + has_property_ = true; + } + return cacheable; } + void ApplyTransitionToDataProperty(); + void ReconfigureDataProperty(Handle<Object> value, + PropertyAttributes attributes); + void TransitionToAccessorProperty(AccessorComponent component, + Handle<Object> accessor, + PropertyAttributes attributes); PropertyDetails property_details() const { - ASSERT(has_property_); + DCHECK(has_property_); return property_details_; } + bool IsConfigurable() const { return property_details().IsConfigurable(); } + bool IsReadOnly() const { return property_details().IsReadOnly(); } + Representation representation() const { + return property_details().representation(); + } + FieldIndex GetFieldIndex() const; + Handle<HeapType> GetFieldType() const; + int GetConstantIndex() const; + Handle<PropertyCell> GetPropertyCell() const; Handle<Object> GetAccessors() const; Handle<Object> GetDataValue() const; + void WriteDataValue(Handle<Object> value); - /* JSPROXY */ + // Checks whether the receiver is an indexed exotic object + // and name is a special numeric index. + bool IsSpecialNumericIndex() const; - Handle<JSProxy> GetJSProxy() const { - return Handle<JSProxy>::cast(maybe_holder_.ToHandleChecked()); - } + void InternalizeName(); private: Handle<Map> GetReceiverMap() const; - MUST_USE_RESULT bool NextHolder(); - State LookupInHolder(); + MUST_USE_RESULT inline JSReceiver* NextHolder(Map* map); + inline State LookupInHolder(Map* map, JSReceiver* holder); Handle<Object> FetchValue() const; + void ReloadPropertyInformation(); bool IsBootstrapping() const; - // Methods that fetch data from the holder ensure they always have a holder. - // This means the receiver needs to be present as opposed to just the receiver - // map. Other objects in the prototype chain are transitively guaranteed to be - // present via the receiver map. - bool is_guaranteed_to_have_holder() const { - return !maybe_receiver_.is_null(); - } + bool check_hidden() const { return (configuration_ & kHidden) != 0; } bool check_interceptor() const { - return !IsBootstrapping() && (configuration_ & CHECK_INTERCEPTOR) != 0; + return !IsBootstrapping() && (configuration_ & kInterceptor) != 0; } - bool check_derived() const { - return (configuration_ & CHECK_DERIVED) != 0; + bool check_prototype_chain() const { + return (configuration_ & kPrototypeChain) != 0; } - bool check_hidden() const { - return (configuration_ & CHECK_HIDDEN) != 0; + int descriptor_number() const { + DCHECK(has_property_); + DCHECK(!holder_map_->is_dictionary_map()); + return number_; } - bool check_access_check() const { - return (configuration_ & CHECK_ACCESS_CHECK) != 0; + int dictionary_entry() const { + DCHECK(has_property_); + DCHECK(holder_map_->is_dictionary_map()); + return number_; + } + + static Configuration ComputeConfiguration( + Configuration configuration, Handle<Name> name) { + if (name->IsOwn()) { + return static_cast<Configuration>(configuration & HIDDEN); + } else { + return configuration; + } } + // If configuration_ becomes mutable, update + // HolderIsReceiverOrHiddenPrototype. Configuration configuration_; State state_; bool has_property_; - PropertyKind property_kind_; - PropertyEncoding property_encoding_; PropertyDetails property_details_; Isolate* isolate_; Handle<Name> name_; Handle<Map> holder_map_; - MaybeHandle<Object> maybe_receiver_; - MaybeHandle<JSReceiver> maybe_holder_; + Handle<Map> transition_map_; + Handle<Object> receiver_; + Handle<JSReceiver> holder_; int number_; }; |