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

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

Issue 197813004: Handlify PropertyAttribute lookups. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comment Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « src/objects.cc ('k') | src/runtime.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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 6159 matching lines...) Expand 10 before | Expand all | Expand 10 after
6170 return map()->constructor(); 6170 return map()->constructor();
6171 } 6171 }
6172 6172
6173 6173
6174 bool JSReceiver::HasProperty(Handle<JSReceiver> object, 6174 bool JSReceiver::HasProperty(Handle<JSReceiver> object,
6175 Handle<Name> name) { 6175 Handle<Name> name) {
6176 if (object->IsJSProxy()) { 6176 if (object->IsJSProxy()) {
6177 Handle<JSProxy> proxy = Handle<JSProxy>::cast(object); 6177 Handle<JSProxy> proxy = Handle<JSProxy>::cast(object);
6178 return JSProxy::HasPropertyWithHandler(proxy, name); 6178 return JSProxy::HasPropertyWithHandler(proxy, name);
6179 } 6179 }
6180 return object->GetPropertyAttribute(*name) != ABSENT; 6180 return GetPropertyAttribute(object, name) != ABSENT;
6181 } 6181 }
6182 6182
6183 6183
6184 bool JSReceiver::HasLocalProperty(Handle<JSReceiver> object, 6184 bool JSReceiver::HasLocalProperty(Handle<JSReceiver> object,
6185 Handle<Name> name) { 6185 Handle<Name> name) {
6186 if (object->IsJSProxy()) { 6186 if (object->IsJSProxy()) {
6187 Handle<JSProxy> proxy = Handle<JSProxy>::cast(object); 6187 Handle<JSProxy> proxy = Handle<JSProxy>::cast(object);
6188 return JSProxy::HasPropertyWithHandler(proxy, name); 6188 return JSProxy::HasPropertyWithHandler(proxy, name);
6189 } 6189 }
6190 return object->GetLocalPropertyAttribute(*name) != ABSENT; 6190 return GetLocalPropertyAttribute(object, name) != ABSENT;
6191 } 6191 }
6192 6192
6193 6193
6194 PropertyAttributes JSReceiver::GetPropertyAttribute(Name* key) { 6194 PropertyAttributes JSReceiver::GetPropertyAttribute(Handle<JSReceiver> object,
6195 Handle<Name> key) {
6195 uint32_t index; 6196 uint32_t index;
6196 if (IsJSObject() && key->AsArrayIndex(&index)) { 6197 if (object->IsJSObject() && key->AsArrayIndex(&index)) {
6197 return GetElementAttribute(index); 6198 return GetElementAttribute(object, index);
6198 } 6199 }
6199 return GetPropertyAttributeWithReceiver(this, key); 6200 return GetPropertyAttributeWithReceiver(object, object, key);
6200 } 6201 }
6201 6202
6202 6203
6203 PropertyAttributes JSReceiver::GetElementAttribute(uint32_t index) { 6204 PropertyAttributes JSReceiver::GetElementAttribute(Handle<JSReceiver> object,
6204 if (IsJSProxy()) { 6205 uint32_t index) {
6205 return JSProxy::cast(this)->GetElementAttributeWithHandler(this, index); 6206 if (object->IsJSProxy()) {
6207 return JSProxy::GetElementAttributeWithHandler(
6208 Handle<JSProxy>::cast(object), object, index);
6206 } 6209 }
6207 return JSObject::cast(this)->GetElementAttributeWithReceiver( 6210 return JSObject::GetElementAttributeWithReceiver(
6208 this, index, true); 6211 Handle<JSObject>::cast(object), object, index, true);
6209 } 6212 }
6210 6213
6211 6214
6212 bool JSGlobalObject::IsDetached() { 6215 bool JSGlobalObject::IsDetached() {
6213 return JSGlobalProxy::cast(global_receiver())->IsDetachedFrom(this); 6216 return JSGlobalProxy::cast(global_receiver())->IsDetachedFrom(this);
6214 } 6217 }
6215 6218
6216 6219
6217 bool JSGlobalProxy::IsDetachedFrom(GlobalObject* global) { 6220 bool JSGlobalProxy::IsDetachedFrom(GlobalObject* global) {
6218 return GetPrototype() != global; 6221 return GetPrototype() != global;
(...skipping 12 matching lines...) Expand all
6231 ? JSProxy::cast(this)->GetIdentityHash() 6234 ? JSProxy::cast(this)->GetIdentityHash()
6232 : JSObject::cast(this)->GetIdentityHash(); 6235 : JSObject::cast(this)->GetIdentityHash();
6233 } 6236 }
6234 6237
6235 6238
6236 bool JSReceiver::HasElement(Handle<JSReceiver> object, uint32_t index) { 6239 bool JSReceiver::HasElement(Handle<JSReceiver> object, uint32_t index) {
6237 if (object->IsJSProxy()) { 6240 if (object->IsJSProxy()) {
6238 Handle<JSProxy> proxy = Handle<JSProxy>::cast(object); 6241 Handle<JSProxy> proxy = Handle<JSProxy>::cast(object);
6239 return JSProxy::HasElementWithHandler(proxy, index); 6242 return JSProxy::HasElementWithHandler(proxy, index);
6240 } 6243 }
6241 return Handle<JSObject>::cast(object)->GetElementAttributeWithReceiver( 6244 return JSObject::GetElementAttributeWithReceiver(
6242 *object, index, true) != ABSENT; 6245 Handle<JSObject>::cast(object), object, index, true) != ABSENT;
6243 } 6246 }
6244 6247
6245 6248
6246 bool JSReceiver::HasLocalElement(Handle<JSReceiver> object, uint32_t index) { 6249 bool JSReceiver::HasLocalElement(Handle<JSReceiver> object, uint32_t index) {
6247 if (object->IsJSProxy()) { 6250 if (object->IsJSProxy()) {
6248 Handle<JSProxy> proxy = Handle<JSProxy>::cast(object); 6251 Handle<JSProxy> proxy = Handle<JSProxy>::cast(object);
6249 return JSProxy::HasElementWithHandler(proxy, index); 6252 return JSProxy::HasElementWithHandler(proxy, index);
6250 } 6253 }
6251 return Handle<JSObject>::cast(object)->GetElementAttributeWithReceiver( 6254 return JSObject::GetElementAttributeWithReceiver(
6252 *object, index, false) != ABSENT; 6255 Handle<JSObject>::cast(object), object, index, false) != ABSENT;
6253 } 6256 }
6254 6257
6255 6258
6256 PropertyAttributes JSReceiver::GetLocalElementAttribute(uint32_t index) { 6259 PropertyAttributes JSReceiver::GetLocalElementAttribute(
6257 if (IsJSProxy()) { 6260 Handle<JSReceiver> object, uint32_t index) {
6258 return JSProxy::cast(this)->GetElementAttributeWithHandler(this, index); 6261 if (object->IsJSProxy()) {
6262 return JSProxy::GetElementAttributeWithHandler(
6263 Handle<JSProxy>::cast(object), object, index);
6259 } 6264 }
6260 return JSObject::cast(this)->GetElementAttributeWithReceiver( 6265 return JSObject::GetElementAttributeWithReceiver(
6261 this, index, false); 6266 Handle<JSObject>::cast(object), object, index, false);
6262 } 6267 }
6263 6268
6264 6269
6265 bool AccessorInfo::all_can_read() { 6270 bool AccessorInfo::all_can_read() {
6266 return BooleanBit::get(flag(), kAllCanReadBit); 6271 return BooleanBit::get(flag(), kAllCanReadBit);
6267 } 6272 }
6268 6273
6269 6274
6270 void AccessorInfo::set_all_can_read(bool value) { 6275 void AccessorInfo::set_all_can_read(bool value) {
6271 set_flag(BooleanBit::set(flag(), kAllCanReadBit, value)); 6276 set_flag(BooleanBit::set(flag(), kAllCanReadBit, value));
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
6753 #undef READ_UINT32_FIELD 6758 #undef READ_UINT32_FIELD
6754 #undef WRITE_UINT32_FIELD 6759 #undef WRITE_UINT32_FIELD
6755 #undef READ_SHORT_FIELD 6760 #undef READ_SHORT_FIELD
6756 #undef WRITE_SHORT_FIELD 6761 #undef WRITE_SHORT_FIELD
6757 #undef READ_BYTE_FIELD 6762 #undef READ_BYTE_FIELD
6758 #undef WRITE_BYTE_FIELD 6763 #undef WRITE_BYTE_FIELD
6759 6764
6760 } } // namespace v8::internal 6765 } } // namespace v8::internal
6761 6766
6762 #endif // V8_OBJECTS_INL_H_ 6767 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698