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

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

Issue 1532723005: [proxies] Fix Object.prototype.hasOwnProperty (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address comment Created 5 years 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') | src/runtime/runtime-object.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 7165 matching lines...) Expand 10 before | Expand all | Expand 10 after
7176 Maybe<bool> JSReceiver::HasProperty(Handle<JSReceiver> object, 7176 Maybe<bool> JSReceiver::HasProperty(Handle<JSReceiver> object,
7177 Handle<Name> name) { 7177 Handle<Name> name) {
7178 LookupIterator it = 7178 LookupIterator it =
7179 LookupIterator::PropertyOrElement(object->GetIsolate(), object, name); 7179 LookupIterator::PropertyOrElement(object->GetIsolate(), object, name);
7180 return HasProperty(&it); 7180 return HasProperty(&it);
7181 } 7181 }
7182 7182
7183 7183
7184 Maybe<bool> JSReceiver::HasOwnProperty(Handle<JSReceiver> object, 7184 Maybe<bool> JSReceiver::HasOwnProperty(Handle<JSReceiver> object,
7185 Handle<Name> name) { 7185 Handle<Name> name) {
7186 LookupIterator it = LookupIterator::PropertyOrElement( 7186 if (object->IsJSObject()) { // Shortcut
7187 object->GetIsolate(), object, name, LookupIterator::HIDDEN); 7187 LookupIterator it = LookupIterator::PropertyOrElement(
7188 return HasProperty(&it); 7188 object->GetIsolate(), object, name, LookupIterator::HIDDEN);
7189 return HasProperty(&it);
7190 }
7191
7192 Maybe<PropertyAttributes> attributes =
7193 JSReceiver::GetOwnPropertyAttributes(object, name);
7194 MAYBE_RETURN(attributes, Nothing<bool>());
7195 return Just(attributes.FromJust() != ABSENT);
7189 } 7196 }
7190 7197
7191 7198
7192 Maybe<PropertyAttributes> JSReceiver::GetPropertyAttributes( 7199 Maybe<PropertyAttributes> JSReceiver::GetPropertyAttributes(
7193 Handle<JSReceiver> object, Handle<Name> name) { 7200 Handle<JSReceiver> object, Handle<Name> name) {
7194 LookupIterator it = 7201 LookupIterator it =
7195 LookupIterator::PropertyOrElement(name->GetIsolate(), object, name); 7202 LookupIterator::PropertyOrElement(name->GetIsolate(), object, name);
7196 return GetPropertyAttributes(&it); 7203 return GetPropertyAttributes(&it);
7197 } 7204 }
7198 7205
7199 7206
7200 Maybe<PropertyAttributes> JSReceiver::GetOwnPropertyAttributes( 7207 Maybe<PropertyAttributes> JSReceiver::GetOwnPropertyAttributes(
7201 Handle<JSReceiver> object, Handle<Name> name) { 7208 Handle<JSReceiver> object, Handle<Name> name) {
7202 LookupIterator it = LookupIterator::PropertyOrElement( 7209 LookupIterator it = LookupIterator::PropertyOrElement(
7203 name->GetIsolate(), object, name, LookupIterator::HIDDEN); 7210 name->GetIsolate(), object, name, LookupIterator::HIDDEN);
7204 return GetPropertyAttributes(&it); 7211 return GetPropertyAttributes(&it);
7205 } 7212 }
7206 7213
7207 7214
7208 Maybe<bool> JSReceiver::HasElement(Handle<JSReceiver> object, uint32_t index) { 7215 Maybe<bool> JSReceiver::HasElement(Handle<JSReceiver> object, uint32_t index) {
7209 LookupIterator it(object->GetIsolate(), object, index); 7216 LookupIterator it(object->GetIsolate(), object, index);
7210 return HasProperty(&it); 7217 return HasProperty(&it);
7211 } 7218 }
7212 7219
7213 7220
7214 Maybe<bool> JSReceiver::HasOwnElement(Handle<JSReceiver> object,
7215 uint32_t index) {
7216 LookupIterator it(object->GetIsolate(), object, index,
7217 LookupIterator::HIDDEN);
7218 return HasProperty(&it);
7219 }
7220
7221
7222 Maybe<PropertyAttributes> JSReceiver::GetElementAttributes( 7221 Maybe<PropertyAttributes> JSReceiver::GetElementAttributes(
7223 Handle<JSReceiver> object, uint32_t index) { 7222 Handle<JSReceiver> object, uint32_t index) {
7224 Isolate* isolate = object->GetIsolate(); 7223 Isolate* isolate = object->GetIsolate();
7225 LookupIterator it(isolate, object, index); 7224 LookupIterator it(isolate, object, index);
7226 return GetPropertyAttributes(&it); 7225 return GetPropertyAttributes(&it);
7227 } 7226 }
7228 7227
7229 7228
7230 Maybe<PropertyAttributes> JSReceiver::GetOwnElementAttributes( 7229 Maybe<PropertyAttributes> JSReceiver::GetOwnElementAttributes(
7231 Handle<JSReceiver> object, uint32_t index) { 7230 Handle<JSReceiver> object, uint32_t index) {
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after
7886 #undef WRITE_INT64_FIELD 7885 #undef WRITE_INT64_FIELD
7887 #undef READ_BYTE_FIELD 7886 #undef READ_BYTE_FIELD
7888 #undef WRITE_BYTE_FIELD 7887 #undef WRITE_BYTE_FIELD
7889 #undef NOBARRIER_READ_BYTE_FIELD 7888 #undef NOBARRIER_READ_BYTE_FIELD
7890 #undef NOBARRIER_WRITE_BYTE_FIELD 7889 #undef NOBARRIER_WRITE_BYTE_FIELD
7891 7890
7892 } // namespace internal 7891 } // namespace internal
7893 } // namespace v8 7892 } // namespace v8
7894 7893
7895 #endif // V8_OBJECTS_INL_H_ 7894 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/runtime/runtime-object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698