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

Side by Side Diff: src/objects-inl.h

Issue 2085223002: Add HasOwnProperty with array indexes (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 4 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 unified diff | Download patch
« no previous file with comments | « src/objects.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // 4 //
5 // Review notes: 5 // Review notes:
6 // 6 //
7 // - The use of macros in these inline functions may seem superfluous 7 // - The use of macros in these inline functions may seem superfluous
8 // but it is absolutely needed to make sure gcc generates optimal 8 // but it is absolutely needed to make sure gcc generates optimal
9 // code. gcc is not happy when attempting to inline too deep. 9 // code. gcc is not happy when attempting to inline too deep.
10 // 10 //
(...skipping 7159 matching lines...) Expand 10 before | Expand all | Expand 10 after
7170 object->GetIsolate(), object, name, object, LookupIterator::OWN); 7170 object->GetIsolate(), object, name, object, LookupIterator::OWN);
7171 return HasProperty(&it); 7171 return HasProperty(&it);
7172 } 7172 }
7173 7173
7174 Maybe<PropertyAttributes> attributes = 7174 Maybe<PropertyAttributes> attributes =
7175 JSReceiver::GetOwnPropertyAttributes(object, name); 7175 JSReceiver::GetOwnPropertyAttributes(object, name);
7176 MAYBE_RETURN(attributes, Nothing<bool>()); 7176 MAYBE_RETURN(attributes, Nothing<bool>());
7177 return Just(attributes.FromJust() != ABSENT); 7177 return Just(attributes.FromJust() != ABSENT);
7178 } 7178 }
7179 7179
7180 Maybe<bool> JSReceiver::HasOwnProperty(Handle<JSReceiver> object,
7181 uint32_t index) {
7182 if (object->IsJSObject()) { // Shortcut
7183 LookupIterator it(object->GetIsolate(), object, index, object,
7184 LookupIterator::OWN);
7185 return HasProperty(&it);
7186 }
7187
7188 Maybe<PropertyAttributes> attributes =
7189 JSReceiver::GetOwnPropertyAttributes(object, index);
7190 MAYBE_RETURN(attributes, Nothing<bool>());
7191 return Just(attributes.FromJust() != ABSENT);
7192 }
7180 7193
7181 Maybe<PropertyAttributes> JSReceiver::GetPropertyAttributes( 7194 Maybe<PropertyAttributes> JSReceiver::GetPropertyAttributes(
7182 Handle<JSReceiver> object, Handle<Name> name) { 7195 Handle<JSReceiver> object, Handle<Name> name) {
7183 LookupIterator it = LookupIterator::PropertyOrElement(name->GetIsolate(), 7196 LookupIterator it = LookupIterator::PropertyOrElement(name->GetIsolate(),
7184 object, name, object); 7197 object, name, object);
7185 return GetPropertyAttributes(&it); 7198 return GetPropertyAttributes(&it);
7186 } 7199 }
7187 7200
7188 7201
7189 Maybe<PropertyAttributes> JSReceiver::GetOwnPropertyAttributes( 7202 Maybe<PropertyAttributes> JSReceiver::GetOwnPropertyAttributes(
7190 Handle<JSReceiver> object, Handle<Name> name) { 7203 Handle<JSReceiver> object, Handle<Name> name) {
7191 LookupIterator it = LookupIterator::PropertyOrElement( 7204 LookupIterator it = LookupIterator::PropertyOrElement(
7192 name->GetIsolate(), object, name, object, LookupIterator::OWN); 7205 name->GetIsolate(), object, name, object, LookupIterator::OWN);
7193 return GetPropertyAttributes(&it); 7206 return GetPropertyAttributes(&it);
7194 } 7207 }
7195 7208
7209 Maybe<PropertyAttributes> JSReceiver::GetOwnPropertyAttributes(
7210 Handle<JSReceiver> object, uint32_t index) {
7211 LookupIterator it(object->GetIsolate(), object, index, object,
7212 LookupIterator::OWN);
7213 return GetPropertyAttributes(&it);
7214 }
7196 7215
7197 Maybe<bool> JSReceiver::HasElement(Handle<JSReceiver> object, uint32_t index) { 7216 Maybe<bool> JSReceiver::HasElement(Handle<JSReceiver> object, uint32_t index) {
7198 LookupIterator it(object->GetIsolate(), object, index, object); 7217 LookupIterator it(object->GetIsolate(), object, index, object);
7199 return HasProperty(&it); 7218 return HasProperty(&it);
7200 } 7219 }
7201 7220
7202 7221
7203 Maybe<PropertyAttributes> JSReceiver::GetElementAttributes( 7222 Maybe<PropertyAttributes> JSReceiver::GetElementAttributes(
7204 Handle<JSReceiver> object, uint32_t index) { 7223 Handle<JSReceiver> object, uint32_t index) {
7205 Isolate* isolate = object->GetIsolate(); 7224 Isolate* isolate = object->GetIsolate();
(...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after
7908 #undef WRITE_INT64_FIELD 7927 #undef WRITE_INT64_FIELD
7909 #undef READ_BYTE_FIELD 7928 #undef READ_BYTE_FIELD
7910 #undef WRITE_BYTE_FIELD 7929 #undef WRITE_BYTE_FIELD
7911 #undef NOBARRIER_READ_BYTE_FIELD 7930 #undef NOBARRIER_READ_BYTE_FIELD
7912 #undef NOBARRIER_WRITE_BYTE_FIELD 7931 #undef NOBARRIER_WRITE_BYTE_FIELD
7913 7932
7914 } // namespace internal 7933 } // namespace internal
7915 } // namespace v8 7934 } // namespace v8
7916 7935
7917 #endif // V8_OBJECTS_INL_H_ 7936 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698