OLD | NEW |
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 1144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1155 isolate, object, handle(isolate->context()->native_context(), isolate)); | 1155 isolate, object, handle(isolate->context()->native_context(), isolate)); |
1156 } | 1156 } |
1157 | 1157 |
1158 | 1158 |
1159 bool Object::HasSpecificClassOf(String* name) { | 1159 bool Object::HasSpecificClassOf(String* name) { |
1160 return this->IsJSObject() && (JSObject::cast(this)->class_name() == name); | 1160 return this->IsJSObject() && (JSObject::cast(this)->class_name() == name); |
1161 } | 1161 } |
1162 | 1162 |
1163 | 1163 |
1164 MaybeHandle<Object> Object::GetProperty(Handle<Object> object, | 1164 MaybeHandle<Object> Object::GetProperty(Handle<Object> object, |
1165 Handle<Name> name, | 1165 Handle<Name> name) { |
1166 LanguageMode language_mode) { | |
1167 LookupIterator it(object, name); | 1166 LookupIterator it(object, name); |
1168 return GetProperty(&it, language_mode); | 1167 return GetProperty(&it); |
1169 } | 1168 } |
1170 | 1169 |
1171 | 1170 |
1172 MaybeHandle<Object> Object::GetElement(Isolate* isolate, Handle<Object> object, | 1171 MaybeHandle<Object> Object::GetElement(Isolate* isolate, |
1173 uint32_t index, | 1172 Handle<Object> object, |
1174 LanguageMode language_mode) { | 1173 uint32_t index) { |
1175 LookupIterator it(isolate, object, index); | 1174 LookupIterator it(isolate, object, index); |
1176 return GetProperty(&it, language_mode); | 1175 return GetProperty(&it); |
1177 } | 1176 } |
1178 | 1177 |
1179 | 1178 |
1180 Handle<Object> Object::GetPrototypeSkipHiddenPrototypes( | 1179 Handle<Object> Object::GetPrototypeSkipHiddenPrototypes( |
1181 Isolate* isolate, Handle<Object> receiver) { | 1180 Isolate* isolate, Handle<Object> receiver) { |
1182 PrototypeIterator iter(isolate, receiver); | 1181 PrototypeIterator iter(isolate, receiver); |
1183 while (!iter.IsAtEnd(PrototypeIterator::END_AT_NON_HIDDEN)) { | 1182 while (!iter.IsAtEnd(PrototypeIterator::END_AT_NON_HIDDEN)) { |
1184 if (PrototypeIterator::GetCurrent(iter)->IsJSProxy()) { | 1183 if (PrototypeIterator::GetCurrent(iter)->IsJSProxy()) { |
1185 return PrototypeIterator::GetCurrent(iter); | 1184 return PrototypeIterator::GetCurrent(iter); |
1186 } | 1185 } |
1187 iter.Advance(); | 1186 iter.Advance(); |
1188 } | 1187 } |
1189 return PrototypeIterator::GetCurrent(iter); | 1188 return PrototypeIterator::GetCurrent(iter); |
1190 } | 1189 } |
1191 | 1190 |
1192 | 1191 |
1193 MaybeHandle<Object> Object::GetProperty(Isolate* isolate, Handle<Object> object, | 1192 MaybeHandle<Object> Object::GetProperty(Isolate* isolate, |
1194 const char* name, | 1193 Handle<Object> object, |
1195 LanguageMode language_mode) { | 1194 const char* name) { |
1196 Handle<String> str = isolate->factory()->InternalizeUtf8String(name); | 1195 Handle<String> str = isolate->factory()->InternalizeUtf8String(name); |
1197 return GetProperty(object, str, language_mode); | 1196 return GetProperty(object, str); |
1198 } | 1197 } |
1199 | 1198 |
1200 | 1199 |
1201 #define FIELD_ADDR(p, offset) \ | 1200 #define FIELD_ADDR(p, offset) \ |
1202 (reinterpret_cast<byte*>(p) + offset - kHeapObjectTag) | 1201 (reinterpret_cast<byte*>(p) + offset - kHeapObjectTag) |
1203 | 1202 |
1204 #define FIELD_ADDR_CONST(p, offset) \ | 1203 #define FIELD_ADDR_CONST(p, offset) \ |
1205 (reinterpret_cast<const byte*>(p) + offset - kHeapObjectTag) | 1204 (reinterpret_cast<const byte*>(p) + offset - kHeapObjectTag) |
1206 | 1205 |
1207 #define READ_FIELD(p, offset) \ | 1206 #define READ_FIELD(p, offset) \ |
(...skipping 5337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6545 if (HasHashCode()) return this; | 6544 if (HasHashCode()) return this; |
6546 String* canonical = String::cast(READ_FIELD(this, kHashFieldSlot)); | 6545 String* canonical = String::cast(READ_FIELD(this, kHashFieldSlot)); |
6547 DCHECK(canonical->IsInternalizedString()); | 6546 DCHECK(canonical->IsInternalizedString()); |
6548 DCHECK(SlowEquals(canonical)); | 6547 DCHECK(SlowEquals(canonical)); |
6549 DCHECK(canonical->HasHashCode()); | 6548 DCHECK(canonical->HasHashCode()); |
6550 return canonical; | 6549 return canonical; |
6551 } | 6550 } |
6552 | 6551 |
6553 | 6552 |
6554 MaybeHandle<Object> Object::GetPropertyOrElement(Handle<Object> object, | 6553 MaybeHandle<Object> Object::GetPropertyOrElement(Handle<Object> object, |
6555 Handle<Name> name, | 6554 Handle<Name> name) { |
6556 LanguageMode language_mode) { | |
6557 LookupIterator it = | 6555 LookupIterator it = |
6558 LookupIterator::PropertyOrElement(name->GetIsolate(), object, name); | 6556 LookupIterator::PropertyOrElement(name->GetIsolate(), object, name); |
6559 return GetProperty(&it, language_mode); | 6557 return GetProperty(&it); |
6560 } | 6558 } |
6561 | 6559 |
6562 | 6560 |
6563 Maybe<bool> JSReceiver::HasProperty(Handle<JSReceiver> object, | 6561 Maybe<bool> JSReceiver::HasProperty(Handle<JSReceiver> object, |
6564 Handle<Name> name) { | 6562 Handle<Name> name) { |
6565 // Call the "has" trap on proxies. | 6563 // Call the "has" trap on proxies. |
6566 if (object->IsJSProxy()) { | 6564 if (object->IsJSProxy()) { |
6567 Handle<JSProxy> proxy = Handle<JSProxy>::cast(object); | 6565 Handle<JSProxy> proxy = Handle<JSProxy>::cast(object); |
6568 return JSProxy::HasPropertyWithHandler(proxy, name); | 6566 return JSProxy::HasPropertyWithHandler(proxy, name); |
6569 } | 6567 } |
(...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7322 #undef READ_SHORT_FIELD | 7320 #undef READ_SHORT_FIELD |
7323 #undef WRITE_SHORT_FIELD | 7321 #undef WRITE_SHORT_FIELD |
7324 #undef READ_BYTE_FIELD | 7322 #undef READ_BYTE_FIELD |
7325 #undef WRITE_BYTE_FIELD | 7323 #undef WRITE_BYTE_FIELD |
7326 #undef NOBARRIER_READ_BYTE_FIELD | 7324 #undef NOBARRIER_READ_BYTE_FIELD |
7327 #undef NOBARRIER_WRITE_BYTE_FIELD | 7325 #undef NOBARRIER_WRITE_BYTE_FIELD |
7328 | 7326 |
7329 } } // namespace v8::internal | 7327 } } // namespace v8::internal |
7330 | 7328 |
7331 #endif // V8_OBJECTS_INL_H_ | 7329 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |