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 5344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6552 if (HasHashCode()) return this; | 6551 if (HasHashCode()) return this; |
6553 String* canonical = String::cast(READ_FIELD(this, kHashFieldSlot)); | 6552 String* canonical = String::cast(READ_FIELD(this, kHashFieldSlot)); |
6554 DCHECK(canonical->IsInternalizedString()); | 6553 DCHECK(canonical->IsInternalizedString()); |
6555 DCHECK(SlowEquals(canonical)); | 6554 DCHECK(SlowEquals(canonical)); |
6556 DCHECK(canonical->HasHashCode()); | 6555 DCHECK(canonical->HasHashCode()); |
6557 return canonical; | 6556 return canonical; |
6558 } | 6557 } |
6559 | 6558 |
6560 | 6559 |
6561 MaybeHandle<Object> Object::GetPropertyOrElement(Handle<Object> object, | 6560 MaybeHandle<Object> Object::GetPropertyOrElement(Handle<Object> object, |
6562 Handle<Name> name, | 6561 Handle<Name> name) { |
6563 LanguageMode language_mode) { | |
6564 LookupIterator it = | 6562 LookupIterator it = |
6565 LookupIterator::PropertyOrElement(name->GetIsolate(), object, name); | 6563 LookupIterator::PropertyOrElement(name->GetIsolate(), object, name); |
6566 return GetProperty(&it, language_mode); | 6564 return GetProperty(&it); |
6567 } | 6565 } |
6568 | 6566 |
6569 | 6567 |
6570 Maybe<bool> JSReceiver::HasProperty(Handle<JSReceiver> object, | 6568 Maybe<bool> JSReceiver::HasProperty(Handle<JSReceiver> object, |
6571 Handle<Name> name) { | 6569 Handle<Name> name) { |
6572 // Call the "has" trap on proxies. | 6570 // Call the "has" trap on proxies. |
6573 if (object->IsJSProxy()) { | 6571 if (object->IsJSProxy()) { |
6574 Handle<JSProxy> proxy = Handle<JSProxy>::cast(object); | 6572 Handle<JSProxy> proxy = Handle<JSProxy>::cast(object); |
6575 return JSProxy::HasPropertyWithHandler(proxy, name); | 6573 return JSProxy::HasPropertyWithHandler(proxy, name); |
6576 } | 6574 } |
(...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7331 #undef READ_SHORT_FIELD | 7329 #undef READ_SHORT_FIELD |
7332 #undef WRITE_SHORT_FIELD | 7330 #undef WRITE_SHORT_FIELD |
7333 #undef READ_BYTE_FIELD | 7331 #undef READ_BYTE_FIELD |
7334 #undef WRITE_BYTE_FIELD | 7332 #undef WRITE_BYTE_FIELD |
7335 #undef NOBARRIER_READ_BYTE_FIELD | 7333 #undef NOBARRIER_READ_BYTE_FIELD |
7336 #undef NOBARRIER_WRITE_BYTE_FIELD | 7334 #undef NOBARRIER_WRITE_BYTE_FIELD |
7337 | 7335 |
7338 } } // namespace v8::internal | 7336 } } // namespace v8::internal |
7339 | 7337 |
7340 #endif // V8_OBJECTS_INL_H_ | 7338 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |